Question

In: Computer Science

Suppose you have a class with 9 students. Create an Array called StudentName and StudentGrade which...

Suppose you have a class with 9 students. Create an Array called StudentName and StudentGrade which contains the student's name and the student's final grade.
Create a function called "GetStudentInfo" for who you will pass the arrays and the user will enter the data for those 9 students.
Back in main, loop through both arrays and display the information for each student after its entered in GetStudentInfo

I need a C++ code for visual studio. Can anyone help me? I'll thumb up.

Solutions

Expert Solution

#include<iostream>
using namespace std;
void GetStudentInfo(string arr1[],int arr2[]){
    //reading 9 studnets data
        for(int i=0;i<9;i++){
                cout<<"Enter student #"<<i+1<<" name and grade: ";
                cin>>arr1[i];
                cin>>arr2[i];
        }
}
int main(){
        string StudentName[9];
        int StudentGrade[9];
        GetStudentInfo(StudentName,StudentGrade);
        cout<<"Name\tGrade"<<endl;
        //printing the studnets data after reading
        for(int i=0;i<9;i++)
                cout<<StudentName[i]<<"\t"<<StudentGrade[i]<<endl;
}

NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.

Please Like and Support me as it helps me a lot


Related Solutions

Suppose you have declared a character array called board of size 9 for a game by...
Suppose you have declared a character array called board of size 9 for a game by the declaration char board[9] and you want to initialize it with a loop so that each array member has a space character each at the beginning of the game. Which one of the following loops is the correct initialization?
You are to create a class called ManageDB. The ManageDB class will have a 2 input...
You are to create a class called ManageDB. The ManageDB class will have a 2 input constructor that has the following definition: ManageDB(int number, String fileName) The constructor will create an array of EmployeeDB objects of length "number". The constructor will read the file located at "fileName" and extract the information from that file to populate a database of EmployeeDB objects. The file contains information on the EmployeeDB objects. This information is contained in records. The format of each record...
JAVA program Create a class called Array Outside of the class, import the Scanner library Outside...
JAVA program Create a class called Array Outside of the class, import the Scanner library Outside of main declare two static final variables and integer for number of days in the week and a double for the revenue per pizza (which is $8.50). Create a method called main Inside main: Declare an integer array that can hold the number of pizzas purchased each day for one week. Declare two additional variables one to hold the total sum of pizzas sold...
Create a class called “Array” that implements a fixed-sized two-dimensional array of floating-point numbers.
Programing in Scala language: Create a class called “Array” that implements a fixed-sized two-dimensional array of floating-point numbers. Write separate methods to get an element (given parametersrow and col), set an element (given parametersrow, col, and value), and output the matrix to the console formatted properly in rows and columns. Next, provide an immutable method to perform array addition given two same-sized array.
array • First, create a function called addNumber, which has a formal parameter for an array...
array • First, create a function called addNumber, which has a formal parameter for an array of integers and increase the value of each array element by a random integer number between 1 to 10. o Add any other formal parameters that are needed. • Second, create another function called printReverse that prints this array in reverse order. • Then, you need to write a C++ program to test the use of these two functions.
Create a class and name it MyArray. This class must have an internal array of integers...
Create a class and name it MyArray. This class must have an internal array of integers and the consumer should specify the maximum capacity when instantiating. MyArray class must provide following functions: 1- insert: This method receives and integer and inserts into the array. For simplicity you can assume the array is large enough and never overflows. 2- display: This method displays all integers stored in the array in the same order as they are inserted (first in first out)....
Needed in C++ In this assignment, you are asked to create a class called Account, which...
Needed in C++ In this assignment, you are asked to create a class called Account, which models a bank account. The requirement of the account class is as follows (1) It contains two data members: accountNumber and balance, which maintains the current account name and balance, respectively. (1) It contains three functions: functions credit() and debit(), which adds or subtracts the given amount from the balance, respectively. The debit() function shall print ”amount withdrawn exceeds the current balance!” if the...
C++ Memory Management: - Create a class called DynamicArray that allocates an integer array of user...
C++ Memory Management: - Create a class called DynamicArray that allocates an integer array of user defined size on the heap - Don't not use any of the STL containers (vector, list, etc) - Create the necessary constructors and destructor, code should allocate the array using new. - Write a method print_array that prints the array’s length and the contents of the array. - Create at least 2 DynamicArray objects and print their contents. Include your DynamicArray class below along...
For this assignment you will implement a dynamic array. You are to build a class called...
For this assignment you will implement a dynamic array. You are to build a class called MyDynamicArray. Your dynamic array class should manage the storage of an array that can grow and shrink. The public methods of your class should be the following: MyDynamicArray(); Default Constructor. The array should be of size 2. MyDynamicArray(int s); For this constructor the array should be of size s. ~MyDynamicArray(); Destructor for the class. int& operator[](int i); Traditional [] operator. Should print a message...
Create a class called Student which stores • the name of the student • the grade...
Create a class called Student which stores • the name of the student • the grade of the student • Write a main method that asks the user for the name of the input file and the name of the output file. Main should open the input file for reading . It should read in the first and last name of each student into the Student’s name field. It should read the grade into the grade field. • Calculate the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT