Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 2: Write a C++program to search a 2D array and print the first and last

ID: 3701444 • Letter: Q

Question

Question 2: Write a C++program to search a 2D array and print the first and last names of all students that have scored above a value entered by the user the array consist of the following columns ID first-name last-name total-score the array currently holds the information of 5 students but can hold up to 100 students. For example, if your array consist of the following data: 111 Tom Jones 80 222 Jack Williams 70 333 Sarah Jones 100 Judy Thomson 99 555 Sandra Will 65 and we want the names of all students who scored 70 and above, your program will list Tom Jones Jack Williams Sarah Jones

Explanation / Answer

#include<stdio.h>

#include<iostream>

#include<string>

using namespace std;

int main()

{

string a[100][4]={ {"111","tom" , "Jones" ,"80"}, {"222" , "Jack" , "Williams" , "70"},

{"333" , "Sarah" , "Johns" , "100"}, {"444" , "Judy" , "Tomson" , "99"}, {"555" , "Sandra" , "Will" , "65"} };

string target;

cout<<"Please enter a secured score in test:"<<endl;

cin<<target;

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

{

if(target == a[i][3])

{

cout<<"Students who had a "<< target << "and above: " <<endl;

cout<<a[i][1] << " " << a[i][2] << endl;

}

}

system("Pause");

return 0;

}

answer: Jack Williams

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote