little to fix it array(little hey little ho)

Pages: 12
closed account (D80DSL3A)
It should work but you still haven't fixed line 7 (I think you've been told about it maybe 4 times now), so there is no telling what the output will be.

Same for line 42. You have been shown how to fix this a couple of times too.
Failing to respond to advice often results in replies drying up. Just FYI on that.
If you don't understand a correction ask about it, but try not to ignore them.
Last edited on
closed account (4y79216C)
my problem is now how to post there name in the highest and lowest
Last edited on
closed account (D80DSL3A)
You will need to save some more info in your for loops.
You could save the indexes to the largest and smallest values in the scores array. This may be confusing to explain though.
You could also just save the two names.
Like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
string nameLargest;
max=score[0];
for(i=0;i<hn;i++){
if(score[i]>max){
   max=score[i];
   nameLargest = name[i];
}
}
string nameSmallest;
min=score[0];
for(i=0;i<hn-1;i++){
if(score[i]<min)// you had an { placement error here
   {
    min=score[i];
    nameSmallest = name[i];
}
}

cout<<"HIGHEST SCORE IS: "<<max<< " earned by: " << nameLargest << endl;
cout<<"LOWEST SCORE IS:"<<min<< " earned by: " << nameSmallest << endl;
Last edited on
closed account (4y79216C)
Thank you to all who help me .. for the code it help fun2code and to Jackson Marie thanks for the code too.
Topic archived. No new replies allowed.
Pages: 12