Write a program that display the following information each

Write a program that display the following information, each on a separate line: a. your name b. student # c. you college major

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

 Write a program that display the following information, each on a separate line: a. your name b. student # c. you college majorSolution#include <iostream>

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site