不知道自己的错误在哪希望网友可以指出我的问题所在
谢谢,万分感谢!
4ac 这种用法显然是错误的,
4 * a * c
如下标红的都有问题
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void menu(void){
printf("*******************************\n");
printf("**** 1, play ****************\n");
printf("**** 0, exit ****************\n");
printf("*******************************\n");
}
void game (void){
int guess = 0;
//初始化
int r = rand()%100+1;
while (1) {
printf("猜数字:>");
scanf("%d",&guess);
if (guess>r) {
printf("输入数字过大\n");
}
else if (guess<r){
printf("输入数字过小\n");
}
else{
printf("输入正确\n");
break;
}
}
}
int main(int argc, const char * argv[]) {
// insert code here...
int input ;
srand((unsigned int)time(NULL));
do {
menu();
scanf("%d",&input);
switch (input) {
case 1:
game();
break;
case 2:
printf("退出游戏");
default:
break;
}
} while (input);
return 0;
}