1.编写一个C++程序,如下述输出示例所示的那样请求并显示信息。
What is your first name? Betty Sue
What is your last name? Yewe
What letter grade do you deserve? B
What is your age? 22
Name: Yewe, Betty Sue
Grade: C
Age: 22
#include<iostream>
using namespace std;
int main()
{
const int a = 50 ;
char name[a];
char lname[a];
char grade[a];
char age[a];
cout << "What is your first name?";
cin.get(name, a).get();
cout << "What is your last name?";
cin.get(lname, a).get();
cout << "What letter grade do you deserve?";
cin.get(grade, a).get();
cout << "What is your age?";
cin.get(age, a).get();
cout << "Name:" << lname << "," << name <<endl;
cout << "Grade:" << grade << endl;
cout << "Age:" << age << endl;
return 0;
}
|