Question

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 be entered. That value should be used in an input loop to receive the series of records and store them in the parallel arrays.

Add a function to printout all records stored in the array. Only print records that were input from the keyboard. Much of the arrays will be unused. Add another function to search the arrays using a specific student ID and display the student's ID, course number, and grade wherever found, OR the message "<student ID> doesn't exist in array

Add code in main to print all records and prompt a user to enter a studentID and search for it in the arrays. Test both possible outcomes.

Sample trace:

Enter the number of records to be input : 6

Enter record 1 (student ID, Course number and grade) : 12 COSC175 A

Enter record 2 (student ID, Course number and grade) : 15 COSC175 B

Enter record 3 (student ID, Course number and grade) : 22 COSC175 C

Enter record 4 (student ID, Course number and grade) : 12 ENG317 A

Enter record 5 (student ID, Course number and grade) : 15 ENG317 A

Enter record 6 (student ID, Course number and grade) : 12 PSYC101 A

Enter a student ID for a record search : 12

12 COSC175 A

12 ENG317 A

12 PSYC101 A

Note : If a search had been made for 17, the message "17 doesn't exist in array" would have been displayed.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

100%WORKING....

PROGRAM:::

#include <iostream>

using namespace std;

void printall(int *id,string *course,string *grade,int n)

{

int i=0;

cout<<"\n\t\tRecords" <<endl;

for(i=0;i<n;i++)

{

cout<<id[i]<<" "<<course[i]<<" "<<grade[i]<<endl;

}

}

int main()

{

int studentID[100],i=0,number=0,searchID;

string courseNumber[100],grade[100];

cout<<"Enter the number of records to be input : ";

cin>>number;

for(i=0;i<number;i++)

{

cout<<"Enter record "<<i+1<<" (student ID, Course number and grade) : ";

cin>>studentID[i]>>courseNumber[i]>>grade[i];

}

printall(studentID,courseNumber,grade,number);

while(true)

{

cout<<"Enter the Student ID to Search (0 to quit):: ";

cin>>searchID;

if(searchID==0) break;

cout<<"\n\t\tSearch Result" <<endl;

bool notFound=true;

for(i=0;i<number;i++)

{

if(searchID==studentID[i])

{

cout<<studentID[i]<<" "<<courseNumber[i]<<" "<<grade[i]<<endl;

notFound=false;

}

}

if(notFound)

cout<<"Student with ID "<<searchID<<" not Found"<<endl;

}

}

OUTPUT:::

Add a comment
Know the answer?
Add Answer to:
In C++, write a complete program that receives a series of student records from the keyboard...
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
  • Implement a software program in C++ t stores and searches the Student records using double-hashing algorithm.  Double...

    Implement a software program in C++ t stores and searches the Student records using double-hashing algorithm.  Double hashing uses the idea of applying a second hash function to key when a collision occurs.   The software program will be based on the following requirements: Development Environment: If the software program is written in C++, its project must be created using Microsoft Visual Studio 2017. If the software program is written in Java, its project must be created using NetBeans v8.2. Algorithm: If...

  • Kindly solve this using C PROGRAMMING ONLY. 4. Write a program marks.c which consists of a...

    Kindly solve this using C PROGRAMMING ONLY. 4. Write a program marks.c which consists of a main function and three other functions called. readmarks , changemarks (, and writemarks() The program begins by calling the function readmarks () to read the input file marksin. txt which consists of a series of lines containing a student ID number (an integer) and a numeric mark (a float). Once the ID numbers and marks have been read into arrays (by readmarks () the...

  • Looking for some help with this Java program I am totally lost on how to go about this. You have been approached by a local grocery store to write a program that will track the progress of their sale...

    Looking for some help with this Java program I am totally lost on how to go about this. You have been approached by a local grocery store to write a program that will track the progress of their sales people (SalesPerson.java) The information needed are: D Number integer Month 1 Sales Amount-Double Month 2 Sales Amount-Double Month 3 Sales Amount-Double Write a Java program that allows you to store the information of any salesperson up to 20 While the user...

  • Hello. can anyone solve this. i am having hard time with this. please post a solution...

    Hello. can anyone solve this. i am having hard time with this. please post a solution ASAP a) Create a class named Student. Data fields for Student class include an integer Student ID, a String name, and a double CGPA. Methods include a constructor that requires values for all data fields, as well as get and set methods for each of the data fields. b) Create an application that allows a user to enter values for an array of 15...

  • : Files and Exceptions: Write a program to create and use a grade book for a...

    : Files and Exceptions: Write a program to create and use a grade book for a course. The gradebook is created as a file named as “Course_Name.dat” and includes the following information about students: Student ID, First Name, Last Name, and Grade. Assume the following structure for the gradebook file:1.Students’ records are separated by a new-line character.2.No field includes any white-space character, and fields are separated by space.3.The order of the fields is the same for all the records.Based on...

  • Write a C++ program that defines a structure called StudentInfo for records consisting of a student’s...

    Write a C++ program that defines a structure called StudentInfo for records consisting of a student’s ID, age, final grade for math, final grade for reading, and final grade for music. Define an array of such records to hold up to eight students’ records that the user input students’ information from the keyboard. Then compute and print out the average of their math grades and average of reading, and each student’s average grade of math, reading and music .

  • Write a program that performs the following: 1. Presents the user a menu where they choose...

    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                           i. Prompts for first name, last name                           ii. If assignments already exist, ask user for new student’s scores to assignments              b. Assign grades for a new assignment                           i. If students already exist, prompt user with student name, ask them for score                           ii. Students created after assignment will need to...

  • Write a C++ program to keep records and perform statistical analysis for a class of 20...

    Write a C++ program to keep records and perform statistical analysis for a class of 20 students. The information of each student contains ID, Name, Sex, quizzes Scores (2 quizzes per semester), mid-term score, final score, and total score. The program will prompt the user to choose the operation of records from a menu as shown below: ==============================================                                            MENU =============================================== 1. Add student records 2. Delete student records 3. Update student records 4. View all student records 5. Calculate...

  • Write the code to maintain a list of student records. The main flow of your program...

    Write the code to maintain a list of student records. The main flow of your program should be to read all information from file(s) and place it in arrays, loop and do stuff with the records (e.g., add, update, look up, etc.), before exiting optionally write the new information back to the file(s) before exiting. Please note the files are only accessed at the beginning and the end, do not change the files during the "do stuff loop" (unless you...

  • Write a C program that allows a user to enter up to 30 student id’s and...

    Write a C program that allows a user to enter up to 30 student id’s and 3 grades per student. It will then compute and display a report of the students averages, and then a statement of the class average for those grades. The following is a sample run that demonstrates what your program should look like: Please enter your school name: Cape Tech Welcome to the Cape Tech Grade Calculator Enter the number of students to process (0 -...

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