廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 6600 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
guaat2001
數位造型
個人文章 個人相簿 個人日記 個人地圖
路人甲
級別: 路人甲 該用戶目前不上站
推文 x0 鮮花 x0
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[C/C++][求助] 急~c++作業~擲骰子遊戲
擲骰子遊戲
1.請由鍵盤輸入你要使用幾顆骰子(必須大於0,輸入非正整數離開)
2.電腦 ..

訪客只能看到部份內容,免費 加入會員 或由臉書 Google 可以看到全部內容



獻花 x0 回到頂端 [樓 主] From:台灣教育部 | Posted:2006-10-22 23:02 |
guaat2001
數位造型
個人文章 個人相簿 個人日記 個人地圖
路人甲
級別: 路人甲 該用戶目前不上站
推文 x0 鮮花 x0
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

我最後寫出來的結果,但是是黑箱作業~誰能幫我解決一下這問題
還有我是用unix寫的
老師規定的
好像沒辦法跑randmize這個函數
謝謝大家哦~^^



#include <stdio.h>
#include <stdlib.h>

int main()
{
int a,player,computer,flag=0,winc=0,winp=0;

while(flag==0)
  {
printf("plz enter the 1 to 3 bones to play the game;otherwise:exit\n");
scanf("%d",&a);

if(a>3)
    {
    exit(0);
    }
if(a<1)
    {
    exit(0);
    }
player=a+rand()%(5*a+1);
computer=a+rand()%(5*a+1);

if(computer > player)
    {
    printf("computer is winer and win: %d point is %d\n",++winc,computer);
    }
if(player > computer)
    {
    printf("player is winer and win: %d   point is %d\n",++winp,player);
    }
if(player == computer)
    {
    printf("Draw\n");
    }
if(winp==2)
    {
    flag=1;
    }
if(winc==2)
    {
    flag=2;
    }
if(flag==1)
    {
    printf("the winer is player");
    }
if(flag==2)
    {
    printf("the winer is computer ");
    }
  }
return 0;



}


獻花 x0 回到頂端 [1 樓] From:台灣教育部 | Posted:2006-10-23 16:39 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.014338 second(s),query:16 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言