#include #include #include #include using namespace std; int main(){ ? ? cout<< "請輸入1-10的數(shù)字"< cout<<"你有十次機會"<< endl; ? ? srand(time(0)); int val = rand()%(10-5+1)+5; int a; int k=0,j=10; while(k<10){ cout<<"你還有"< k=k+1; j=j-1;? cin>>a; if(a==val){ cout<<"正確" < break; }else{ cout< cout<<"錯誤"< } } cout<<"機會用完了!??!"<
? return 0; } |
|