I need to solve this
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,
The highest and lowest variable is always giving me 0. I don't know why ? Can you please tell me how to fix this problem? http://pastebin.com/LjGUyLXe
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!
Not the answer you are looking for? Search for more explanations.
on what exactly ? that's the point
by comment you mean //comment ??
yes, for every group of statements, especially vague variable names
also, the indentation of your code is incorrect. Check line 34. I'm having trouble just reading your code because of the indentation
I understand that your code makes sense to you probably, but if you're going to ask for help it won't really be effective unless you do minimal documentation of your code and utilize whitespace correctly.
anyways, it's more than likely that I won't provide any more help until you decide to clean up the formatting and update the pastebin. And if you do this - it's more than likely you'll find what went wrong yourself.
Like I said before, because the teacher is having you find out about arrays, the best thing to do is to separate loops. Before the firs loop, find out how many students there are. Loop that many times. The first loop will go through and let the person enter grades. The second loop will go through and evaluate things, sum up the number of each, and find the highest/lowest.
Lets try this... just gonna write code, so not 100% sure this will run...
int low = 200;
int high = -200;
for (int i = 0; i<5;i++);
if (a[i]high) high = a;
cout << "The high is: " << high << "\nThe low is: " << low << endl ;
Oops... I meant low=a[i]...
Thanks man! I solved it anyways but I really appreciate it !!