Christos
  • Christos
C++, I am tried to make this exercise: 2) Write a program and declare an array called “Exam” with 100 integers. Hence, ask a lecturer to enter the number of students in a class along with each student’s mark that should be stored in the array (use a variable n to know the number of students). The program should then calculate and display: a) the average (float) and the highest and lowest marks of the class, b) the number of grades A, B, C, D and F, according to the following table. There is something wrong with the code I just don't understand what it is? http://pastebin.com/14nZDb5A
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
inkyvoyd
  • inkyvoyd
hard to help if the pastebin is removed.
Christos
  • Christos
Sorry I re-added it !!
inkyvoyd
  • inkyvoyd
use Exam[100] not Exam(100) Exam(100) means you are inputting argument 100 to function Exam() while int Exam[100]; means you are declaring an array of type int with size 100

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

Christos
  • Christos
ooh I see
rsmith6559
  • rsmith6559
You may want to make sure that the user doesn't input a number bigger than the length of your student array. To gather the As, Bs, Cs, Ds and Fs, I would have an array to count them. It's also pretty simple to output. You may want to use a switch statement for collection. Don't forget that you can assign a value to a variable when you declare it. Many people recommend doing this so that they'll have known values instead or (somewhat) random garbage values.
e.mccormick
  • e.mccormick
And from a programming standpoint, globals are a bad idea. ``` #include using namespace std; int Exam[100]; int n; float average; int highest; int lowest; int Students; int Grade; int i; int GradeSum=0; int Average; bool FirstTime; bool FirstTime2; int main() { ``` Those are globals. ``` #include using namespace std; int main() { int Exam[100]; int n; float average; int highest; int lowest; int Students; int Grade; int i; int GradeSum=0; int Average; bool FirstTime; bool FirstTime2; ``` That changes them to local.

Looking for something else?

Not the answer you are looking for? Search for more explanations.