Question:
i have to make ma final project of C Programming in that the outline is STUDENT RECORD MANAGEMENT SYSTEM.?
pinky
2010-01-13 05:05:43 UTC
in that i have to take 10 students and store their data in FILES then we can search their detail like first name last name roll no etc by structures . use switch statement to search the student by first name . and beside this we can enter or delete a student
Six answers:
?
2010-01-17 02:02:16 UTC
Simple:



- define a suitable struct

- declare an array of these structs

- implement functions for manipulating the array of structs
2010-01-15 21:52:09 UTC
Hi Pinky

What exactly your are looking for. I do not think so MA need any project in C programing. Any way i am usiing this free online project management software . You just need to have internet connection , Jst login and start working on the project. Of couse include your friends in that also.

For more info click on http://www.proofhub.com
2016-04-03 10:20:26 UTC
Well you should read up about file handling in C as for the struct it is an abstract data type so you cna define it to do anything - as you are needing the data of 10 students you can use an array, a linked list would be better but I suspect that your programming skill would not be up for it though it would help with deleting. So here is a rough and ready idea of what you need to do try this code to start with and then improve on it #include #include #include int age (int date, int month, int year); int main (void) { FILE *infile, *outfile1, *outfile2; /* Try and make this a struct */ int recno, birthdate, birthmonth, birthyear, ageyears; char sex; if ((infile=fopen("students.txt","r")) == NULL) { printf("Error: input file students.txt cannot be opened"); system("pause"); return 1; } if ((outfile1=fopen("M.txt","w")) == NULL) { printf("Error: output file M.txt cannot be opened"); system("pause"); return 1; } if ((outfile2=fopen("F.dat","w")) == NULL) { printf("Error: output file F.dat cannot be opened"); system("pause"); return 1; } while ( fscanf(infile, "%d %*s %c %d %d %d", &recno, &sex, &birthdate, &birthmonth, &birthyear) > 0 ) { ageyears = age ( birthdate, birthmonth, birthyear ); if ( sex == 'M' ) fprintf ( outfile1, "%-8d%2d\n", recno, ageyears ); else if (sex == 'F' ) fprintf ( outfile2, "%-8d%2d\n", recno, ageyears ); }; fclose(infile); fclose(outfile1); fclose(outfile2); system("pause"); return 0; } int age (int date, int month, int year) { int startdate = 1; int startmonth = 11; int startyear = 2005; int ageinyears; ageinyears = startyear - year; if (month > startmonth || (month == startmonth && date > startdate)) ageinyears--; return ageinyears; }
Princess Psycho
2010-01-15 13:31:26 UTC
Well you should read up about file handling in C as for the struct it is an abstract data type so you cna define it to do anything - as you are needing the data of 10 students you can use an array, a linked list would be better but I suspect that your programming skill would not be up for it though it would help with deleting.

So here is a rough and ready idea of what you need to do try this code to start with and then improve on it

#include

#include

#include



int age (int date, int month, int year);



int main (void)

{

FILE *infile, *outfile1, *outfile2;

/* Try and make this a struct */

int recno, birthdate, birthmonth, birthyear, ageyears;

char sex;



if ((infile=fopen("students.txt","r")) == NULL)

{

printf("Error: input file students.txt cannot be opened");

system("pause");

return 1;

}

if ((outfile1=fopen("M.txt","w")) == NULL)

{

printf("Error: output file M.txt cannot be opened");

system("pause");

return 1;

}

if ((outfile2=fopen("F.dat","w")) == NULL)

{

printf("Error: output file F.dat cannot be opened");

system("pause");

return 1;

}

while ( fscanf(infile, "%d %*s %c %d %d %d", &recno, &sex, &birthdate, &birthmonth, &birthyear) > 0 )

{

ageyears = age ( birthdate, birthmonth, birthyear );

if ( sex == 'M' ) fprintf ( outfile1, "%-8d%2d\n", recno, ageyears );

else if (sex == 'F' ) fprintf ( outfile2, "%-8d%2d\n", recno, ageyears );

};

fclose(infile);

fclose(outfile1);

fclose(outfile2);

system("pause");

return 0;

}

int age (int date, int month, int year)

{

int startdate = 1;

int startmonth = 11;

int startyear = 2005;

int ageinyears;



ageinyears = startyear - year;

if (month > startmonth || (month == startmonth && date > startdate)) ageinyears--;

return ageinyears;

}
Kardinal
2010-01-13 05:52:35 UTC
What's the question?
Suman
2010-01-13 07:24:23 UTC
Do you expect somebody to actually write the entire code for you ?

Please specify your exact problem.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...