Question
Hello im looking for the solution for this program that is in C Concepts for this are ( malloc/realloc, structs, and stdin/fgets/getc/scanf) Description Your program
Hello im looking for the solution for this program that is in C
Concepts for this are (malloc/realloc, structs, and stdin/fgets/getc/scanf)
Description
Your program will ask the user to type in the following information:
First Name:
Last Name:
ID#:
Email:
The program will terminate when a single . is entered as a First Name.
This information will be stored in the following structure type:
struct student {
int recordCount;
char *firstName;
char *lastName;
char *id;
char *email;
}
recordCount is a number assigned at the beginning of the program starting at 1 and increasing by 1 for each student record entered. No name (first or last) will be more than 50 characters long but you must only store the exact number of characters needed. The id will be 9 characters in length (plus end of string). You must check to see if this is the case and that each character is a decimal digit (0 to 9). If it is not, the program will tell the user this and ask for the ID# again until it is entered correctly. There is no error checking on the email input.
Any number of students can be input to the program.
After all student records have been input, the program will print out all of the records sorted by ID# (smallest to largest). The output will look like the following:
091234567,Emma,Peel,mrspeel@avengers.co.uk
092345678,John,Steed,steed@avengers.co.uk
Sample Input and Output
$ ./enterStudents
First Name: Emma
Last Name: Peel
ID#: 091234567
Email: mrspeel@avengers.co.uk
First Name: John
Last Name: Steed
ID#: 092345678
Email: steed@avengers.co.uk
First Name:.
091234567,Emma,Peel,mrspeel@avengers.co.uk
092345678,John,Steed,steed@avengers.co.uk
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started