求教,一直报错
程序代码:
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { srand((unsigned int)time(0)); puts("\t\t\t\t猜大小"); puts("-------------------------------------------------------------"); int n; while(1) puts("即将随机输出一个0~99的数,你是准备押大(50~99),还是押小(0~49)?"); do { puts("押大,输入1"); puts("押小,输入0"); scanf("%d",&n); } while(n==1||n==0); { if(n==1||n==0) { int value_n=rand()%100; printf("随机数是:%d\n",value_n); if(value_n>=50) { printf("%d是大\n",value_n); if(n==1) puts("真厉害,你猜对了~"); else puts("哈哈,这局运气不行啊~"); } else { printf("%d数是小\n",value_n); if(n==0) puts("真厉害,你猜对了~"); else puts("哈哈,这局运气不行啊~"); } } puts("还继续吗?(Y/N)"); char c; c=getchar(); if(c=='n'||c=='N') break; } printf("\n"); return 0; }