伊莉部落格、伊莉交友、伊莉聊天、伊莉相簿
急問!!有關於while迴圈
#include <cstdlib>
#include <iostream>
#include <time.h>
using namespace std;
int main(int argc, char *argv[])
{
int i,k,j,s,x;
printf("準備好開始了嗎....(1)開始(2)還沒\n");
scanf("%d",&j);
srand((int)time(0));
if(j==1){
x = rand()%6+1;
printf("你骰出的是%d點\n",x);
s = rand()%6+1;
printf("莊家骰出的是%d點\n",s);
if(x>s){
printf("哇塞你贏了\n");}
else if(x<s) {
printf("你輸了請付給我一百萬\n");}
else{
printf("平手ㄟ請附遊戲費50\n");}
}
else
printf("去旁邊睡覺賣亂\n");
system("PAUSE");
return EXIT_SUCCESS;
}
我想請問這個程式想把他加入do-while迴圈,可以讓它不斷的玩,要如何寫入?
|