#include <QCoreApplication>
#define NUM 3
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
char names[NUM][20];
char phoneNumbers[NUM][20];
char provinces[NUM][50];
int ages[NUM];
float heights[NUM];
int personID=0;
char ch;
//接收用户输入的信息
do{
printf("please input info for person %d\n",personID);
puts("input name: ");
gets(names[personID]);
puts("input phoneNumbers: ");
gets(phoneNumbers[personID]);
puts("input provinces: ");
gets(provinces[personID]);
puts("input ages: ");
scanf("%d",&ages[personID]);
puts("input heights: ");
scanf("%f",&heights[personID]);
getchar();
puts("yes or no?\n");
ch=getchar();
if(ch=='y'){
printf("name:");
puts(names[personID]);
printf("phoneNumbers:");
puts(phoneNumbers[personID]);
printf("provinces:");
puts(provinces[personID]);
printf("age is %d\n:",ages[personID]);
printf("height is .1%f\n",heights[personID]);
}
else{
break;
}
personID+=1;
}while(personID<NUM);
puts("input personID(1-20)");
scanf("%d",&personID);
printf("name:");
puts(names[personID]);
printf("phoneNumbers:");
puts(phoneNumbers[personID]);
printf("provinces:");
puts(provinces[personID]);
printf("age is %d\n:",ages[personID]);
printf("height is .1%f\n",heights[personID]);
return a.exec();
}