我正在尝试使用Ctrl+退出循环Z,但它不起作用。我仔细查看了我的代码,但我无法找出问题所在。您的帮助将不胜感激。我正在使用 Dev-C++。代码如下:
#include <iostream>
#include<conio.h>
using namespace std;
class student
{
private:
string name;
int age;
double GPA;
public:
void read ();
};
void student::read()
{
do
{ //enter student data
cout << "Name: " ;
cin>>name;
cout<<"Age: ";
cin>>age;
cout << "GPA: ";
cin>>GPA;
cout<<"\n\n any key to continue or Ctrl+Z to exit."<<endl<<endl;
}
while(getch()!=EOF); //Ctrl+Z to exit
}
int main()
{
student stud;
stud.read();
return 0;
}