我這個(gè)猜數(shù)字游戲怎么才能設(shè)置輸入的次數(shù)
#include<iostream>#include <stdlib.h>#include<ctime>using namespace std;int main(){ srand((unsigned int)time(NULL)); int num= rand()%100+1;int a ;while (1){cin>>a;{ break;}if(a>num){ cout<<"數(shù)字過(guò)大"<<endl;}else if (a<num){cout<<"數(shù)字過(guò)小"<<endl;}else{ cout<<"恭喜你猜對(duì)了"<<endl; break;}}return 0;}
問(wèn)題固定的無(wú)法更換了...坑,
相關(guān)推薦
便查問(wèn)答是一款實(shí)用的網(wǎng)絡(luò)熱門知識(shí)問(wèn)答平臺(tái),,專注于分享你不知道的知識(shí)、經(jīng)驗(yàn)及生活問(wèn)題,,在這里所有人都能找到答案歡迎網(wǎng)友參與討論,。