?? play.c
字號:
#include "heads_or_tails.h"
void play(int how_many) /*machine tosses,user calls */
{
int coin, i, lose=0, win=0;
for(i=0; i<how_many; i++){
coin=toss();
if(get_call_from_user()==coin){
win++;
report_a_win(coin);
}
else {
lose++;
report_a_lose(coin);
}
}
prt_final_report(win, lose, how_many);
}
void report_a_win(coin)
{
printf("the machine is: %d ",coin);
}
void report_a_lose(coin)
{
printf("the machine: %d ",coin);
}
int toss()
{
return(rand()%2); /*0=heads, 1=tails*/
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -