int main(){
int num, flag;
char name[8];
int retry = 1;
int end_flag;
while(retry == 1){
srand(time(0));
num = rand() % 90;
printf("do not put captions and by the way its yes or no questions ") ;
printf("\ntest number: %d\n", num);
printf("goldfish say ask a question?\n");
scanf("%s", &name);
printf("Goldfish say your answers is %S\n", name);
if (num >= 10)
flag = 1;
if (num >= 11 && num <= 20)
flag = 2;
if(num >= 21 && num <= 30)
flag = 3;
if (num >= 31 && num <= 40)
flag = 4;
if (num >= 41 && num <= 50)
flag = 5;
if (num >= 51 && num <= 60)
flag = 6;
if(num >= 61 && num <= 70)
flag = 7;
if (num >= 71 && num <= 80)
flag = 8;
if (num >= 81 && num <= 90)
flag = 9;
if (flag == 1)
printf("no\n");
else if (flag == 2)
printf("yes\n");
else if(flag == 3)
printf("never\n");
else if (flag == 4)
printf("what?\n");
else if (flag == 5)
printf("maybe\n");
else if (flag == 6)
printf("indeed\n");
else if(flag == 7)
printf("i don't not know the answer\n");
else if (flag == 8)
printf("really?\n");
else if (flag == 9)
printf("don't ask me!\n");
printf("Would you like to retry? (Type 1 for retry, or 2 to end it)\n");
scanf("%d", &retry);
printf("\n");
}
Please edit your post and make sure your code is [code]between code tags[/code] so that it has line numbers and syntax highlighting, as well a proper indentation.
Do you want help in C, or C++? This is a C++ forum, but your code is written entirely in C. http://www.LB-Stuff.com/cc