1,
#include <stdio.h>structstudent{Charnumber[Ten]; Charname[ -]; intAge ; Chargender[5]; Chartelephone[ the]; Chardepartment[ -]; intscore;}; intMain () {printf ("define struct type \ n"); return 0;}
2, the code of the problem does not know why the operation will be error, appear (Ld.exe), no matter how the changes can not be normal operation, to find other students to inquire also did not find any problems, is the software broken?
#include <stdio.h>#include<stdlib.h>structstudent{Charnumber[Ten]; Charname[ -]; intAge ;}; intMain () {student class3[ to]; FILE*fp=fopen ("E:\input.txt","R"); FSCANF (FP,"%s%s%d", class3[0].number,class3[0].name,&class3[0].age); Fclose (FP); FP=fopen ("E:\output.txt","W"); fprintf (FP,"%s%s%d\n", class3[0].number,class3[0].name,class3[0].age); Fclose (FP); return 0;}
3, and the teacher in class to talk about the knowledge is almost the same, no big changes.
#include <stdio.h>structstudent{Charnumber[Ten]; Charname[ -]; intAge ;}; voidAddstudent () {student class3; intch; FILE*fp=fopen ("E:\student.txt","A +"); printf ("Please enter the number of the study:"); scanf ("%s", Class3.number); printf ("Please enter your name:"); scanf ("%s", Class3.name); printf ("Please enter your age:"); scanf ("%d",&class3.age); fprintf (FP,"%s%s%d\n", Class3.number,class3.name,class3.age); printf ("Information added successfully, whether to continue to add student information (a)"); scanf ("%s",&ch); Do{printf ("Please enter the number of the study:"); scanf ("%s", Class3.number); printf ("Please enter your name:"); scanf ("%s", Class3.name); printf ("Please enter your age:"); scanf ("%d",&class3.age); fprintf (FP,"%s%s%d\n", Class3.number,class3.name,class3.age); printf ("Information added successfully, whether to continue to add student information (a)"); scanf ("%s",&ch); } while(ch==1);}intMain () {printf ("class three student management system \ n"); printf ("1. Add student information \ n"); printf ("2.............\n"); printf ("3.............\n"); intA; scanf ("%d",&a); if(a==1) addstudent (); return 0;}
This homework feeling difficulty is not particularly big, the teacher in class time has spoken, do up still is relatively easy.
C Language 12th time assignment