Write a program that display the following information each
Solution
#include <iostream>
using namespace std;
int main()
{
string name, major;
int id;
cout << \"Enter student name: \" ;
cin >> name;
cout<<\"Enter studnet ID: \";
cin >> id;
cout<<\"Enter student major: \";
cin >> major;
cout<<endl<<\"Student Name: \"<<name<<endl;
cout<<endl<<\"Student ID: \"<<id<<endl;
cout<<endl<<\"Student Major: \"<<major<<endl;
return 0;
}
Output:
sh-4.2$ g++ -o main *.cpp
sh-4.2$ main
Enter student name: Suresh
Enter studnet ID: 1111
Enter student major: ComputerScience
Student Name: Suresh
Student ID: 1111
Student Major: ComputerScience
