关于数组的问题。
想用二维数组打印字符串,不知道二维数组怎么用。#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define NO 0
#define YES 1
char str[30]={"就被你猜中了!"};
char str1[30]={"才猜中答案!"};
char str2[30]={"看来你的IQ很低!"};
char fall[30]={"请重新输入!"};
int main()
{
int guess_value=-1;
int number;
int nbr_of_guesses;
int done=NO;
srand((unsigned)time(NULL));
number=rand();
nbr_of_guesses=0;
while(done=YES)
{
//printf("\n随机数是%d",number);//作弊码。
printf("\n选一个0到%d的数字:",RAND_MAX);
scanf("%d",&guess_value);
nbr_of_guesses++;
if(number==guess_value)
{
printf("\n太厉害了!居然被你猜中了。");
goto AAA;
}
else if(number<guess_value)
{
printf("\n你输入的数太大!%s",fall);
}
else
{
printf("\n你输入的数太小!%s",fall);
}
}
AAA:if(nbr_of_guesses<=3)
{
printf("\n你猜了%d次,%s",nbr_of_guesses,str);
}
else if(nbr_of_guesses>=4&&nbr_of_guesses<=10)
{
printf("\n你猜了%d次,%s",nbr_of_guesses,str1);
}
else if(nbr_of_guesses>10)
{
printf("\n你猜了%d次,%s",nbr_of_guesses,str2);
}
system("pause");
}