Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

#include <stdio.

h>

#include <string.h>

#include <stdlib.h>

/*Function Declaration */

int AddRecords();

/*Struct declared to store Teacher data */

struct TeacherRecord{

char Name[30];

int Age;

char Date_of_Birth[30];

char Subject_Taught[30];

char Gender[30];

char Team[30];

char Ethnicity[30];

}teacherRecords;

int main(){
printf("\t\t\t\t=====TEACHER AND STUDENT DATABASE MANAGEMENT SYSTEM=====\n");

printf("\n\n\n\n\n\n\n\n\n\t\t\t\t\t\t A.Add Records\n\t\t\t\t\t\t B.List Records\n\t\t\t\t\t\t


C.Modify Records\n\t\t\t\t\t\t D.Delete Records\n");

printf("\n\n\n\n\n\n\n Select Instruction by its corresponding Letter:");

char GetNo = getchar();

if(GetNo =="A"||GetNo =="a"){

AddRecords();

int AddRecords()

struct TeacherRecord s1;

FILE *file = fopen("d://Teacher.txt","w+");

if(file = NULL){
printf("Error in writing File");

return 1;

while(1){

printf("Enter Name of Teacher:");

scanf("%d",&s1.Name);

printf("Enter the Age of Teacher:");

scanf("%s",&s1.Age);

printf("Enter Date of Birth of Teacher:");

scanf("%lf",&s1.Date_of_Birth);

printf("Enter Subject Taught by Teacher:");

scanf("%f",&s1.Subject_Taught);

printf("Enter the Gender of Teacher:");

scanf("%g",&s1.Gender);

printf("Enter Team the Teacher is apart of:");

scanf("%a",&s1.Team);

printf("Enter the Ethnicity of Teacher:");

scanf("%b",&s1.Ethnicity);

fprintf(file,"%d\n%s\n%lf\n%f\n%g\n%g\n%a\n
%b\n",&s1.Name,&s1.Age,&s1.Date_of_Birth,&s1.Subject_Taught,&s1.Gender,&s1.Team,s1.Ethnicity);

printf("Do you want to continue?:N/Y");

char ch = getchar();

if(ch =="N"|| ch == "n")

break;

fclose(file);
return 0;

/*Got to type out the rest of Code :) */

You might also like