Using Structs Write a program that performs the following 1

Using Structs

Write a program that performs the following:

1) Presents the user a menu where they choose between:

a) Add a new student to the class

Prompts for first name, last name

If assignments already exist, ask user for new student’s scores to assignments

b) Assign grades for a new assignment

If students already exist, prompt user with student name, ask them for score

Students created after assignment will need to have score provided

c) List one student, displaying all their grades and their course average

Prompt user for student, telling them which inputs are valid

If no students and/or no assignments, tell user to try after data input

d) List all the scores for a chosen assignment

Prompt user for assignment, telling them which options are valid

includes class average

if no valid assignments and/or students, tell user to try after data input

e) Display all grades currently contained in the gradebook

After displaying the gradebook, ask the user if they’d like to save the data as file “grades.txt”

f) Exit the program       

2) Return to step 1

For your program you will be using an array (size: 10 elements) of the Student struct, which contains First Name, Last Name (char arrays or strings), and 10 assignment scores (double array). Keep track the number of students and number of assignments with variables (might need to pass them to functions as arguments). If the user tries to add students or assignments when they are already full, they should get an error message.

Solution

#include /* I have created structure of name – StudentData*/ struct StudentData{ char *stu_name; int stu_id; int stu_age; } int main() { /* student is a variable of data type – StudentData*/ struct StudentData student; /*below I’m accessing struct members through variable –student*/ student = {\"Chaitanya\", 1234, 25}; printf(\"Student Name is: %s\", student.stu_name); return 0; }
Using Structs Write a program that performs the following: 1) Presents the user a menu where they choose between: a) Add a new student to the class Prompts for

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site