程序程序源码如下:
#include "stdafx.h"
#include
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char firstname[20];
char lastname[20];
char grade;
int age;
cout << "what is your first name? ";
cin.getline(firstname,20);
cout << "what is your last name? ";
cin.getline(lastname,20);
cout << "what letter grade do you deserve? ";
cin >> grade;
cout << "what is your age? ";
cin >> age;
cout << "Name:" << lastname << "," << firstname << endl;
cout << "Grade:" << grade << endl;
cout << "Age:" << age << endl;
return 0;
}
在运行到cin>>age;时,我输入年龄后就直接被终止程序了是为什么,为什么后面的代码运行不了了??求指教