This program shows use various data types in C++.
#include<iostream>
using namespace std;
int main()
{
int rollno;
char name[20];
float age;
char grade;
cout << "Enter your roll no.:";
cin >> rollno;
cout << "Enter your name:";
cin >> name;
cout << "Enter your age:";
cin >> age;
cout << "Enter your grade:";
cin >> grade;
//Logic for Printing output....
cout << "========================\n";
cout << "Your Roll No is " << rollno << "\n";
cout << "Your Name is " << name << "\n";
cout << "Your Age is " << age << "\n";
cout << "Your Grade is " << grade << "\n";
cout << "========================\n";
return 0;
}
Output of program
Enter your roll no.:101
Enter your name:ABC
Enter your age:25
Enter your grade:A
========================
Your Roll No is 101
Your Name is ABC
Your Age is 25
Your Grade is A
========================
#include<iostream>
using namespace std;
int main()
{
int rollno;
char name[20];
float age;
char grade;
cout << "Enter your roll no.:";
cin >> rollno;
cout << "Enter your name:";
cin >> name;
cout << "Enter your age:";
cin >> age;
cout << "Enter your grade:";
cin >> grade;
//Logic for Printing output....
cout << "========================\n";
cout << "Your Roll No is " << rollno << "\n";
cout << "Your Name is " << name << "\n";
cout << "Your Age is " << age << "\n";
cout << "Your Grade is " << grade << "\n";
cout << "========================\n";
return 0;
}
Output of program
Enter your roll no.:101
Enter your name:ABC
Enter your age:25
Enter your grade:A
========================
Your Roll No is 101
Your Name is ABC
Your Age is 25
Your Grade is A
========================
No comments:
Post a Comment