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?
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
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.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
hard to help if the pastebin is removed.
Sorry I re-added it !!
use Exam not Exam(100) Exam(100) means you are inputting argument 100 to function Exam() while int Exam; means you are declaring an array of type int with size 100
Not the answer you are looking for? Search for more explanations.
ooh I see
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.
And from a programming standpoint, globals are a bad idea.
using namespace std;
Those are globals.
using namespace std;
That changes them to local.