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?
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.
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...
For this lab you will continue your dynamic array by completing the class called MyDynamicArray. The...
For this lab you will continue your dynamic array by completing the class called MyDynamicArray. The MyDynamicArray class should manage the storage of an array that can grow and shrink. The public methods of your class should already be the following: MyDynamicArray(); Default Constructor. The array should be of capacity 2. MyDynamicArray(int s); For this constructor the array should be of capacity and size s. int& operator[](int i); Traditional [] operator. Should print a message if i is out of...
Create a file called grocery.ts. It should have a definition of a class with the obvious...
Create a file called grocery.ts. It should have a definition of a class with the obvious name Grocery. The class should have some basic attributes such as name, quantity, etc. Feel free to add any other attributes you think will be necessary. Add few grocery items to an array of groceries, such as milk, bread, and eggs, along with some quantities (i.e. 3, 6, 11). Display these grocery items as HTML output. The output of this assignment will be grocery.ts...
Suppose you are given the following array X = [7, 9, 1, 6] Sort the array...
Suppose you are given the following array X = [7, 9, 1, 6] Sort the array in ascending order using the selction sort algorithm. Write the state of the array after each pass. Pass1: Pass2: Pass3: Suppose you are given the following array X = [7, 9, 1, 6] Sort the array in ascending order using the selction sort algorithm. Write the state of the array after each pass. Pass1: Pass2: Pass3:
Suppose you have a STAT class from 8:30–9:30 and an ECON class from 9:30–10:30. Assuming you...
Suppose you have a STAT class from 8:30–9:30 and an ECON class from 9:30–10:30. Assuming you arrive to school at 8:30 with zero text messages on your cell phone and you receive 6 texts every 45 minutes on average, find the following probabilities. a)Based on the information above, find the probability that you receive at least 3 texts during your STAT class. N.B. I suggest you find these in R studio. b)find the probability that you receive exactly 3 texts...
Create a class, called Song. Song will have the following fields:  artist (a string) ...
Create a class, called Song. Song will have the following fields:  artist (a string)  title (a string)  duration (an integer, recorded in seconds)  collectionName (a string) All fields, except for collectionName, will be unique for each song. The collectionName will have the same value for all songs. In addition to these four fields, you will also create a set of get/set methods and a constructor. The get/set methods must be present for artist, title, and duration....
Implement the Shape hierarchy -- create an abstract class called Shape, which will be the parent...
Implement the Shape hierarchy -- create an abstract class called Shape, which will be the parent class to TwoDimensionalShape and ThreeDimensionalShape. The classes Circle, Square, and Triangle should inherit from TwoDimensionalShape, while Sphere, Cube, and Tetrahedron should inherit from ThreeDimensionalShape. Each TwoDimensionalShape should have the methods getArea() and getPerimeter(), which calculate the area and perimeter of the shape, respectively. Every ThreeDimensionalShape should have the methods getArea() and getVolume(), which respectively calculate the surface area and volume of the shape. Every...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT