In: Computer Science
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.
#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