我不知道如何在我点击“ 或者' N' ...一旦我把它最终关闭了所以我怎么回到循环中?
int counter = 5;
while(counter > 1)
linear(xcoordinateone, xcoordinatetwo, ycoordinateone, ycoordinatetwo, slope, intercept); //calling
{
cout<<"The points you entered define the function: y = " << slope << xone << "+" << intercept;
cout << "\n Do you want to continue?";
if (answer == 'N' || answer == 'n');
cin >> answer;
return 0;
}
答案 0 :(得分:1)
你可以在while循环中使用多个条件:
answer = 'y';
while(answer != 'N' && answer != 'n'){
cout << "\n Do you want to continue?";
cin >> answer;
}
答案 1 :(得分:1)
do {
// do stuff
cout << "\n Do you want to continue?";
cin >> answer;
} while (answer!='N' && answer!='n');