标签:style blog http color os art
1 #include<iostream> 2 using namespace std; 3 int main(){ 4 int a,n,g,i=1; 5 cin>>a>>n; 6 while(cin>>g){ 7 if(i>n||g<0){ 8 cout<<"Game Over"<<endl; 9 break; 10 } 11 else{ 12 if(g>a) 13 cout<<"Too big"<<endl; 14 else if(g<a) 15 cout<<"Too small"<<endl; 16 else if(g==a&&i==1){ 17 cout<<"Bingo!"<<endl; 18 break; 19 } 20 else if(g==a&&i<=3){ 21 cout<<"Lucky You!"<<endl; 22 break; 23 } 24 else{ 25 cout<<"Good Guess!"<<endl; 26 break; 27 } 28 } 29 i++; 30 } 31 return 0; 32 }
参考:
循环-20. 猜数字游戏(15),布布扣,bubuko.com
标签:style blog http color os art
原文地址:http://www.cnblogs.com/gnodidux/p/3822503.html