卡罗拉保养费用明细:C编程问题
#include <stdio.h>
main(){
int i,k,j=0;
i = rand()%1000 + 1;
do{
j++;
printf ("Please enter the num you guess:(1-1000):\n");
scanf ("%d",&k);
if (i == k)
{
printf ("this is the %d,you right,the num is %d",j,k);
break;
}
else
{
printf ("this is the %d,you are wrong ,please enter the num again!\n");
scanf ("%d",&k);
}
} while (1);
}
不懂的话可以来我的群:13526460
#include "stdio.h"
#include"stdlib.h"
void main()
{int m,n,t=1;
while(1)
{m=random(1000);
if(m=!0)break;}
while(1)
{ printf("Please guess:\n");
scanf("%d",&n);
printf("\n");
if(m==n)
{printf("your are right! %d\n",t++);
break;}
else if(m>n)
printf("Error! your number is smaller %d\n",t++);
else if(m<n)
printf("Error! your number is bigger %d\n",t++);
}
}