第1个回答 2017-09-24
#include<stdio.h>
#include<stdlib.h>
struct Student
{
char name[16],sex[8],tel[16],addr[64];
int age;
};
int main()
{
int i;
struct Student stus[]={{"李丽","女","111","湖南长沙",18},{"张爽","男","222","北京",17},{"王力","男","333","江苏南京",19},{"刘敏","女","444","四川成都",20}};
printf("请输入一个编号(1至4),将显示对应成员的信息:");
scanf("%d",&i);
if(i>=1 && i<=4)
{
printf("编号为%d的成员的信息如下:\n姓名=%s,性别=%s,电话号码=%s,家庭住址=%s,年龄=%d。\n",
i,stus[i-1].name,stus[i-1].sex,stus[i-1].tel,stus[i-1].addr,stus[i-1].age);
}
else
{
printf("编号超出了范围!\n");
}
return 0;
}
第2个回答 2017-09-24
main()
{
char name[][7]={
"张三",
"李四",
"王五",
"麻六",
"牛七",
"马八"};
int n;
printf("请输入您想查看的");
printf("组员号码,如1,2,3,4: ");
scanf("%d",&n);
printf("%d号组员",n);
printf("姓名%s\n",name[n-1]);
}本回答被网友采纳