Program the following Student struct In main create a class

Program the following Student struct. In main () create a class of 10 students. Print all students to the screen. And then print a list of honor roll students to the screen. student first name: char[] last name: char[] gap: float id: int email: string

Solution

Here is the code for you:

#include <stdio.h>
typedef struct Student
{
char firstName[80];
char lastName[80];
float gpa;
int id;
char email[100];
}Student;

int main()
{
Student students[10];
for(int i = 0; i < 10; i++)
{
printf(\"Enter the details of student #%d: \", i+1);
printf(\"First name: \");
scanf(\"%s\", students[i].firstName);
printf(\"Last name: \");
scanf(\"%s\", students[i].lastName);
printf(\"GPA: \");
scanf(\"%f\", &students[i].gpa);
printf(\"Student ID: \");
scanf(\"%i\", &students[i].id);
printf(\"e-mail address: \");
scanf(\"%s\", students[i].email);
}
//Print all students to screen.
for(int i = 0; i < 10; i++)
printf(\"%10s %10s %.1f %5i %25s\ \", students[i].firstName, students[i].lastName, students[i].gpa, students[i].id, students[i].email);
  
//Print the list of honor roll students.
//Assuming honor roll students are students with gpa > 4.0.
printf(\"\ List of honor roll students:\ \");
for(int i = 0; i < 10; i++)
if(students[i].gpa > 4.0)
printf(\"%10s %10s %.1f %5i %25s\ \", students[i].firstName, students[i].lastName, students[i].gpa, students[i].id, students[i].email);

}

 Program the following Student struct. In main () create a class of 10 students. Print all students to the screen. And then print a list of honor roll students

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site