新人起步(4.1/n)
阿新 • • 發佈:2018-12-20
== signed 努力 錯誤 錯誤類型 %d amp while 輸入
題目來自網絡:模仿價格猜測,輸入數字猜價格
個人未完成。
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int cishu = 0;
int jiage;
int biaozhun;
srand((unsigned) (NULL));
biaozhun = (rand() * rand()) % 59 + 1;
do
{
printf("請輸入你猜測的價格:");
scanf("%d",&jiage);
if(biaozhun > jiage)
{
printf("太小了\n");
printf("價格為:%d\n",biaozhun);
cishu++;
}
else if(biaozhun < jiage)
{
printf("太大了\n");
printf("價格為:%d\n",biaozhun);
cishu++;
}
else
{
break;
}
}
while(biaozhun == jiage);
printf("一共猜測%d次,價格為%d",cishu,jiage);
return 0;
}
錯誤類型:還未找出。繼續努力
新人起步(4.1/n)