sunny801's Profile
Reputation: 1
Apprentice
- Group:
- Members
- Active Posts:
- 25 (0.06 per day)
- Joined:
- 04-April 12
- Profile Views:
- 46
- Last Active:
Apr 26 2012 06:16 PM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Question about finding largest number in 2d array (column)
Posted 26 Apr 2012
Of course! -
In Topic: Question about finding largest number in 2d array (column)
Posted 26 Apr 2012
Moving this statement should do the job " cout << "The highest grade from test " << test + 1 << " is a " << highest << "%. \n";, correct?
Thank you so so so much rstiltskin for all your help
If I move it inside the if statement, it does not show up at all -
In Topic: Question about finding largest number in 2d array (column)
Posted 26 Apr 2012
It seems like whenever I enter a 99% the highest grades for all tests become a 99, otherwise the code seems to work.. Any ideas why?
Nevermind, the code is off ):
OUTPUT:
Enter 4 test scores for each student.
Student #1
-----------
Enter grade for test number 1: 42
Enter grade for test number 2: 12
Enter grade for test number 3: 52
Enter grade for test number 4: 63
Student #2
-----------
Enter grade for test number 1: 65
Enter grade for test number 2: 21
Enter grade for test number 3: 45
Enter grade for test number 4: 25
Student #3
-----------
Enter grade for test number 1: 21
Enter grade for test number 2: 66
Enter grade for test number 3: 54
Enter grade for test number 4: 58
Total from all tests is a 524%.
Press enter to continue.
Average of all tests is a 43.6667%.
Press enter to continue.
The class average for test 1 is a 42.6667%.
The class average for test 2 is a 33%.
The class average for test 3 is a 50.3333%.
The class average for test 4 is a 48.6667%.
Press enter to continue.
The average for student 1 is a 42.25%.
The average for student 2 is a 39%.
The average for student 3 is a 49.75%.
Press enter to continue.
The highest test score is a 66%.
Press enter to continue.
The highest grade from test 1 is a 65%.
The highest grade from test 2 is a 66%.
The highest grade from test 3 is a 66%.
The highest grade from test 4 is a 66%.
Press enter to continue. -
In Topic: Question about finding largest number in 2d array (column)
Posted 26 Apr 2012
So, here's my code and an example output. The code is working for the 1st 3 tests, but the 4th one is not being calculated right. Thanks for your help!
void getHighestofEachTest (double st [s] [t]) { double highest = 0; for ( int test = 0; test < t ; test ++) { for (int student = 0; student < s; student ++) { if ( highest < st [student] [test] ) { highest = st [student] [test]; } } cout << "The highest grade from test " << test + 1 << " is a " << highest << "%. \n"; } cout << "Press enter to continue. \n"; cin.get(); }
Enter 4 test scores for each student. Student #1 ----------- Enter grade for test number 1: 78 Enter grade for test number 2: 89 Enter grade for test number 3: 54 Enter grade for test number 4: 38 Student #2 ----------- Enter grade for test number 1: 65 Enter grade for test number 2: 78 Enter grade for test number 3: 85 Enter grade for test number 4: 66 Student #3 ----------- Enter grade for test number 1: 33 Enter grade for test number 2: 35 Enter grade for test number 3: 99 Enter grade for test number 4: 56 Total from all tests is a 776%. Press enter to continue. Average of all tests is a 64.6667%. Press enter to continue. The class average for test 1 is a 58.6667%. The class average for test 2 is a 67.3333%. The class average for test 3 is a 79.3333%. The class average for test 4 is a 53.3333%. Press enter to continue. The average for student 1 is a 64.75%. The average for student 2 is a 73.5%. The average for student 3 is a 55.75%. Press enter to continue. The highest test score is a 99%. Press enter to continue. The highest grade from test 1 is a 78%. The highest grade from test 2 is a 89%. The highest grade from test 3 is a 99%. The highest grade from test 4 is a 99%. Press enter to continue.
-
In Topic: Question about finding largest number in 2d array (column)
Posted 25 Apr 2012
So something like this?
void getHighestofEachTest (double st [s] [t]) { double highest; for ( int test = 0; test < t ; test ++) { highest = 0; int student = 0; if ( st [student] [test] > highest ) { highest = st [student] [test]; } cout << "The highest grade from test " << test + 1 << " is a " << highest << "%. \n"; } cout << "Press enter to continue. \n"; cin.get(); }
It's still not calculating right, though.
I know it's probably something really simple.
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
sunny801 hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
sunny801 has no profile comments yet. Why not say hello?