萌新请教,这需要怎么该才不是死循环
#include <iostream>using namespace std;
int main()
{
int a;
cin>>a;
while ( a<=10 )
if (a<5)
{
cout << " hello good "<<endl;
}
else
{
cout <<"hello baibai"<<endl;
}
(a=a+1);
return 0;
}
#include <iostream> using namespace std; int main() { int a; cin>>a; while ( a<=10 ) if (a<5) { cout << " hello good "<<endl; } else { cout <<"hello baibai"<<endl; } (a=a+1); return 0; }
#include <iostream> using namespace std; int main() { int a; cin>>a; while ( a<=10 ) if (a<5) { cout << " hello good "<<endl; } else { cout <<"hello baibai"<<endl; } (a=a+1); return 0; }
[此贴子已经被作者于2020-7-4 08:59编辑过]
if() { } while() { } for(;;) { }