#include<stdlib.h>
#include<stdio.h>
#include<time.h>
int main()
{
int a,b;
srand((unsigned)time(NULL));
a=rand()%100;
printf("请输入一个数\n");
scanf("%d\n",&b);
while (b>100)
{
printf("您输入的数超过了取值范围,请在1到100中取值\n");
printf("请输入一个数\n");
scanf("%d\n",&b);
}
if(a=b) printf("平局\n");
else
{
if(a>b) printf("你输了");
else printf("你赢了");
}
return 0;
}
this above is my work today,and there are three points need to be corrected.
the first : [how to control the progress working all the time ]
use the kind of < while(i<-1){} > can accomplish this task.
the second: [\n] is seldom used in the sentence of scanf() , while often in the sentense of printf().
P.S.according to this error,it can be shown that i have not mastered it's using methods.
the third:[]
by the way,next time when i need to use some function,i can just search on the internet ,and see how to utilise it and how does it work.