Write a C Program to create a structured data file named
Student.dat to store the roll no, name
and course.
Provide following functions:
1. Accept the values from the user using structure
variables. Store the contents in a file.
2. Display the file.
3. The user should be able to add new records to the
existing file. And display the new file.

Answer Posted / muklesh kumr

#include <stdio.h>
#include <ctype.h>

struct Student
{
int ID;
char LastName[32];
char FirstName[32];
int DateOfBirth; // This could be of the form YYYYMMDD. For example someone born on December 21st, 1990 would have a value of 19901221
char Address[32];
char TelephoneNumber[11]; // a 10-digit string
char ProgramPursued[32];
};


char GetUserOption()
{
char option = 'I'; // 'I' for Invalid

while(option == 'I')
{
// Print the menu items
printf("\n");
printf("Choose one of the following options:\n[u]pdate [P]rint [S]earch [E]xit\n");
scanf("%c", &option);

switch(toupper(option))
{
case 'U':
case 'P':
case 'S':
case 'E':
break;
default:
option = 'I';
break;
}
}

return option;
}


// students must hold 10 students
void LoadStudents(Student students[])
{
// TODO: load students from file
}


// students must hold 10 students
void SaveStudents(Student students[])
{
// TODO: save students to file
}


int main()
{
Student students[10];
int looping = 1;

// Load the students from the file
LoadStudents(students);

// Loop until exit
while(looping)
{
char option = GetUserOption();
switch(option)
{
case 'U':
// TODO: Let the user update a record
break;

case 'P':
// TODO: Print the students to the screen
break;

case 'S':
// TODO: Let the user search for a student
break;

case 'E':
looping = 0; // exit the loop
break;
}
}

// Save the students to the file
SaveStudents(students);

return 0;

Is This Answer Correct ?    73 Yes 64 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you personally involved with Major incident process ? If yes, how do you manage it in your present organization ? explain with real scenario !

1298


cost accounting is a tool for dicission making expline

1656


7. (a) How do you implement internal controls in IT systems? (b) How to design internal controls over financial reporting, when financial reporting is performed totally from the software application? Explain briefly the major points. (c) What are the additional controls needed, when the software interfaces are webbased? Explain the materiality of the payroll processing functions to be performed by webinterfaces from the control perspective.

1899


hi i am doing cause study about Enterprising young IT Entrepreneur who has recently started a small business running web hosting services for SME (Small to Medium Enterprise). You frequently need to meet (potential) clients to sell your services to them. You do so with presentations and demonstrations of your products. You will also want to install certain development software for your software development projects. So what software to use? need a server? what types of hosting should i use?

1770


I didn't see any category for Project Management. What are the activities, documents; how to plan, schedule and monitor tasks, statuses, people...?

1709






Can you help me what kind of PM interview questions company can ask based on below job description?: *Work with business development, editorial, marketing and other departments as needed to understand and prioritize project requests. *Work with online creative, IT, and development departments to gather and disseminate project requirements. *Maintain weekly web projects production calendar *Assist in the quality assurance process associated with code releases to development, staging and production servers. *Participate in planning meetings for new site initiatives. Document, clarify and articulate requirements and bring thoughts to the discussion. *Distribute reports summarizing project milestones and associated tasks. *Create rough wireframes and functional diagrams for developers using Microsoft Visio. *Work with third party vendors to procure services associated with web development. *Work with our partners to ensure deliverables and associated tasks stay on track. Can you help me what kind of PM question company can ask based on above job description?

2124


What change management processes have you used to ensure that change is introduced properly?

2964


I have given ielts exam and i got 5.5 bands and i also got three I-20s from the US universities, so my ielts score will interrupt my visa or not? I want to confirm it.

1858


What id the meaning of MIS ? MIS nasure, charactersitcs, purpose ? how can the leanr about them ?

2069


what is variable?

2026


Why general ledger accounts require "post automatically" setting in SAP??

1501


what is erp manufacturing perspective??

3903


what is capital

2135


Is any one has SAP GTS( Global Trade Services)Reading and Exercise material. If so, please e-mail me.

3293


What are the practices you follow for closing a project and meeting the conditions required to establish closure?

8033