#include<stdio.h> struct student{ char number[10]; char name[20]; int age; char gender[5]; char phone[15]; char dept[20]; int score; }; int main() { return 0; }
-
#include<stdio.h> #include<stdlib.h> struct student { char no[10]; char name[20]; int age; }; int main() { student class3[31]; FILE *fp=fopen("d:\input.txt","r"); fscanf(fp,"%s%s%d",class3[0].no,class3[0].name,&class3[0].age); fclose(fp); fp=fopen("d:\output.txt","w"); fprintf(fp,"%s %s %d ",class3[0].no,class3[0].name,class3[0].age); fclose(fp); return 0; }
#include<stdio.h> struct student{ char sno[10]; char sname[20]; int age; }; int ch; student s1; void addStudent() { FILE *fp=fopen("c:\input.txt","a+"); do { printf("请输入学号: "); scanf("%s",s1.sno); printf("请输入姓名: "); scanf("%s",s1.sname); printf("请输入年龄: "); scanf("%d",&s1.age); fprintf(fp," %s %s %d",s1.sno,s1.sname,s1.age); printf("继续添加学生信息(1:是/2:否): "); scanf("%d",&ch); }while(ch==1); } int main() { int a; printf("学生管理系统 "); printf("1.添加学生信息 "); printf("请输入序号: "); scanf("%d",&a); if(a==1) addStudent(); return 0; }