Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Overview: Write a program in C that read the id, names, and marks for a number of students from the user. The program must then
Overview:
Write a program in C that read the id, names, and marks for a number of students from the user. The program must then display a list of all the students and their average marks. This assignment will use C pointers, characters, and strings.
IMPORTANT: Can NOT use scanf in this program
The program will have:
- Main function: read the total # of students entered by the user. (Valid number of students is 1 to 10). When the number entered by the user is valid, then create three arrays for storing the name, id and marks. Then call the following two functions bellow.
- Call Function 1: Read name, id and marks for each student from the user, store them into the three arrays defined in the main function. Do not use structure here. Each record is given in a line of text, with id, name, and marks separated by a comma. Student id is a positive integer, name is any string that contains letters and spaces, and mark is a positive double value not greater than 10. Validate the id and the marks, and read the line again if there is any errors in the data.
- Call Function 2: Print the list of students and the average mark. Student names are displayed in all-uppercase letters. Average mark must be formatted to 2 decimals.
Note: The output of the program must be similar to image bellow:
Enter number of students (1-10): 33 === Enter number of students (1-10): -2 Enter number of students (1-10): 4 := Enter id, name, and mark separated by comma. Student #1: abc, Superman, 9.5 Student #1: 123, Superman, abc Student #1: 0, Superman, 9.5 Student #1: 123, Superman, Student #1: 123, Superman, 12.3 Student #1: 123, Superman, 9.5 Student #2: 124, Spider Man,8.7 Student #3: 125, Super Gir1,6.3 Student #4: 126, The Hulk, 9.2 ID Name Mark 1 2 3 4 123 124 125 126 SUPERMAN SPIDER MAN SUPER GIRL THE HULK 9.50 8.70 6.30 9.20 AVERAGE 8.43Step 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