導航:首頁 > 源碼編譯 > C編譯指定編碼

C編譯指定編碼

發布時間:2023-09-15 02:59:43

『壹』 C語言的編程問題,不知道如何編碼,希望寫一遍代碼。謝謝

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
voidmain()
{inthp_a=100,hp_b=100,i=0;
intflag=0;
intattact;
srand((unsigned)time(NULL));
while(hp_a>0&&hp_b>0)
{
i++;
/*printf(" Round:%d ",i);*/
if(flag==0)
{
attact=rand()%(12-8+1)+8;
hp_b-=attact;
printf("AttactA=%d,HP_A=%d,HP_B=%d ",attact,hp_a,hp_b>0?hp_b:0);
flag=1;
}
else
{
attact=rand()%(16-6+1)+6;
hp_a-=attact;
printf("AttactB=%d,HP_A=%d,HP_B=%d ",attact,hp_a>0?hp_a:0,hp_b);
flag=0;
}
}
if(hp_a<=0)printf("****Aisdied**** ");
if(hp_b<=0)printf("****Bisdied**** ");
}

閱讀全文

與C編譯指定編碼相關的資料

熱點內容
車用空調壓縮機品牌 瀏覽:830
在回收站中可以恢復幾個文件夾 瀏覽:916
phpget轉義 瀏覽:322
我的世界寶可夢伺服器叫什麼名字 瀏覽:748
新聞編譯難嗎 瀏覽:582
ia架構伺服器是什麼意思 瀏覽:220
linux查看區域網 瀏覽:77
金蝶啟動命令 瀏覽:480
安卓如何執行shell命令 瀏覽:947
linux路由控制 瀏覽:434
碧藍航線壓縮包解壓密碼 瀏覽:439
抗性提升命令方塊指令 瀏覽:769
程序員那麼可愛第30集免費看 瀏覽:637
如何下載老友麻將app 瀏覽:445
java路徑參數 瀏覽:592
php命名空間使用 瀏覽:298
app的競爭力如何寫 瀏覽:587
linux刪除swp 瀏覽:590
pdfxchange40 瀏覽:77
車牌號碼是哪個app 瀏覽:50