Home » » Different data types in C++ - Example program

Different data types in C++ - Example program


Different data types in C++ - Example program

Write a C++ program in which declare different data types including int, double and char. initialize values to all variables and print values as output.


See snapshot of above program below

In this program different data types used in C++ are declared and initialized.

CODE:

#include<iostream.h>
#include<conio.h>
main(){
     int roll, marks;
     double avg;
     char grade, name[20]="Kashif Nadeem";
clrscr();

roll=1204;
marks=714;
avg=84.6;
grade='A';

cout<<"-----------------------------------"<<endl;
cout<<"Student roll No. : "<<roll<<endl;
cout<<"Student Name     : "<<name<<endl;
cout<<"Student Marks    : "<<marks<<endl;
cout<<"Student average  : "<<avg<<endl;
cout<<"Student Grade    : "<<grade<<endl;
cout<<"----------------------------------"<<endl;
}

Thanks for visiting Different data types in C++ - Example program

Download
more from: CS Adventures

0 comments:

Post a Comment

LIKE US

Popular Posts

My FANS around the WORLD

Flag Counter