Question

SC 111 - BMCC Exam Student Name: Type # 4 - 20 Points write a program that uses a structure named Student to store the follow
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream> #include <cstring> 2 using namespace std 3 4 struct Student 5 6 char name[50], address[50]; int id double

25 int main) int x[] 1, 3, 4, 5}; Student s[3] s[e].id s[1].id s[2].id strcpy(s[0].name, Will Smith); strcpy(s[1].name, Jo

// OUTPUT

Name:Will Smith | ID: 12 | GPA 6 Address: one Name:John Nash | ID: 13 | GPA: 9.7 | Address: two Name:Carey Hart | ID: 14 | GP

#include <iostream>

#include <cstring>

using namespace std;

struct Student

{

char name[50], address[50];

int id;

double GPA;

};

void showData(Student a[], int size)

{

for(int i=0; i<size; i++)

cout << "Name:" << a[i].name << " | ID: " << a[i].id << " | GPA: " << a[i].GPA << " | Address: " << a[i].address << endl;

}

double avgGPA(Student a[], int size)

{

double total = 0;

for(int i=0; i<size; i++)

total += a[i].GPA;

return total / size*1.0;

}

int main() {

int x[] = {1, 3, 4, 5};

Student s[3];

s[0].id = 12;

s[1].id = 13;

s[2].id = 14;

strcpy(s[0].name, "Will Smith");

strcpy(s[1].name, "John Nash");

strcpy(s[2].name, "Carey Hart");

s[0].GPA = 6.0;

s[1].GPA = 9.7;

s[2].GPA = 5.9;

strcpy(s[0].address, "one");

strcpy(s[1].address, "two");

strcpy(s[2].address, "three");

showData(s, 3);

cout << "Average GPA = " << avgGPA(s, 3);

}

// Hit the thumbs up if you are fine with the answer. Happy Learning!

Add a comment
Know the answer?
Add Answer to:
SC 111 - BMCC Exam Student Name: Type # 4 - 20 Points write a program...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 2. Write a program named lab3 2.app that contains a class named Student to store student...

    2. Write a program named lab3 2.app that contains a class named Student to store student information Information that will be relevant to store is first name, last name, id number, GPA, and major (1) Define a member function named set0, which allows you to set all member variables. This function has an empty parameter list, and its return type is void. So, within the function you'll prompt for information. Note: For entering major, if you need a space, use...

  • C++Write a program that uses a class name MovieData to store the following information about a...

    C++Write a program that uses a class name MovieData to store the following information about a movie: create a class not a strcuture please. Title Director Year release Running time Inclue a constructor that allows all four of these memberdata values to be sprcified at the time a MovieData variable is created The program should create two MovieData variable. Do not use user input. Have a stand alone function that displays the information about the movie in a clearly formatted...

  • Write a Java program which will store, manipulate, and print student registration information. As part of...

    Write a Java program which will store, manipulate, and print student registration information. As part of the solution, identify the following classes: Student Admissions. The class Student must have the following fields – Name, Address, Id number, Courses, and Date, where: Name is a user defined class comprising of at minimum first name and last name. Address is a user defined class comprising of fields - street, city, state, and zip code. Date is a predefined class in the java.util...

  • Add additional information to the student class below such as name, address, major, and contact information...

    Add additional information to the student class below such as name, address, major, and contact information along with all the getters and setters (methods) needed to access all data. Submit your code along with a sample run of your program. Comment all your code. Cite any sources of information you use. Write a note on the process of completing the assignment in a Microsoft Word document. // ShowStudent.java // client to test the Student class class ShowStudent { public static...

  • C++ program Write a C++ program to manage a hospital system, the system mainly uses file...

    C++ program Write a C++ program to manage a hospital system, the system mainly uses file handling to perform basic operations like how to add, edit, search, and delete record. Write the following functions: 1. hospital_menu: This function will display the following menu and prompt the user to enter her/his option. The system will keep showing the menu repeatedly until the user selects option 'e' from the menu. Arkansas Children Hospital a. Add new patient record b. Search record c....

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

  • Add additional information to the student class below such as name, address, major, and contact information...

    Add additional information to the student class below such as name, address, major, and contact information along with all the getters and setters (methods) needed to access all data. Submit your code along with a sample run of your program. Comment all your code. Cite any sources of information you use. Write a note on the process of completing the assignment in a Microsoft Word document. // ShowStudent.java // client to test the Student class class ShowStudent { public static...

  • Please write comments with the program. Python programming!! Part III - write student data In this...

    Please write comments with the program. Python programming!! Part III - write student data In this part the program should create a .csv file and fill it with generated student information. The program should: Ask the user for a name for the .csv file (use your own name for the exercise) Create the .csv file with columns named - ID, first-name, GPA Based on the information received in part I, generate and fill students information in the CSV file Tell...

  • PROGRAMMING LANGUAGE OOP'S WITH C++ Functional Requirements: A jewelry designer friend of mine requires a program...

    PROGRAMMING LANGUAGE OOP'S WITH C++ Functional Requirements: A jewelry designer friend of mine requires a program to hold information about the gemstones he has in his safe. Offer the jewelry designer the following menu that loops until he chooses option 4. 1. Input a gemstone 2. Search for a gemstone by ID number 3. Display all gemstone information with total value 4. Exit ------------------------------------- Gemstone data: ID number (int > 0, must be unique) Gem Name (string, length < 15)...

  • In C++, write a complete program that receives a series of student records from the keyboard...

    In C++, write a complete program that receives a series of student records from the keyboard and stores them in three parallel arrays named studentID and courseNumber and grade. All arrays are to be 100 elements. The studentID array is to be of type int and the courseNumber and grade arrays are to be of type string. The program should prompt for the number of records to be entered and then receive user input on how many records are to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT