首页 > 代码库 > 12ci zuoye

12ci zuoye

#include<stdio.h>
struct student
{
    char number[10];
    char name[20];
    int age;
}; 
void one()
{
    student class3;
    char b;
    FILE *fp=fopen("c:\\student.txt","a+");
    printf("?????:");
    scanf("%s",class3.number);
    printf("?????:");
    scanf("%s",class3.name);
    printf("?????:");
    scanf("%d",&class3.age);
    fprintf(fp,"%s    %s    %d\n",class3.number,class3.name,class3.age);
    printf("????,??????????(yes/no):");
    scanf("%s",&b);
    do
    {
        printf("?????:");
        scanf("%s",class3.number);
        printf("?????:");
        scanf("%s",class3.name);
        printf("?????:");
        scanf("%d",&class3.age);
        fprintf(fp,"%s    %s    %d\n",class3.number,class3.name,class3.age);
        printf("????,??????????(yes/no):");
        scanf("%s",&b);
    }while(b==yes);
}
int main()
{
    printf("----------??????----------\n");
    printf("1.??????\n"); 
    printf("2.??????\n");
    printf("3.??????\n");
    printf("4.??????\n");
    printf("???:\n");
    int a;
    scanf("%d",&a);
    if(a==1)
        one();     
    return 0;
}
#include<stdio.h>
#include<stdlib.h>
struct student{
    char sno[10];
    char stele[15];    
};
int main()
{    
    student class3[31];
    scanf("%s%s%s%d%d",&class3[0].sno,&class3[0].sname,&class3[0].stele,&class3[0].age,&class3[0].score);
    printf("%s %s %s %d %d",class3[0].sno,class3[0].sname,class3[0].stele,class3[0].age,class3[0].score);
    return 0;    
}
#include<stdio.h>
struct student
{
    char sno[10];
    char sname[20];
    int age;
    char tel[11];
    int score;
}; 

int main()
{
    student class3[31];
    int i;
    for(i=0;i<31;i++)
          scanf("%s%s%d%s%d",class3[i].sno,class3[i].sname,&class3[i].age,class3[i].tel,&class3[i].score);
    for(i=0;i<31;i++)
          printf("%s %s %d %s %d\n",class3[i].sno,class3[i].sname,class3[i].age,class3[i].tel,class3[i].score);
    return 0;
}

 

12ci zuoye