Christos
  • Christos
C++ , 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
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.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
inkyvoyd
  • inkyvoyd
is the average working?
Christos
  • Christos
the average is working
inkyvoyd
  • inkyvoyd
you should probably comment your code

Looking for something else?

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

More answers

Christos
  • Christos
on what exactly ? that's the point
Christos
  • Christos
by comment you mean //comment ??
inkyvoyd
  • inkyvoyd
yes, for every group of statements, especially vague variable names
inkyvoyd
  • inkyvoyd
also, the indentation of your code is incorrect. Check line 34. I'm having trouble just reading your code because of the indentation
inkyvoyd
  • inkyvoyd
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.
inkyvoyd
  • inkyvoyd
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.
e.mccormick
  • e.mccormick
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.
e.mccormick
  • e.mccormick
Lets try this... just gonna write code, so not 100% sure this will run... ``` int a[]={1,9,7,2,0}; 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 ; ```
e.mccormick
  • e.mccormick
Oops... I meant low=a[i]...
Christos
  • Christos
Thanks man! I solved it anyways but I really appreciate it !!
e.mccormick
  • e.mccormick
So you done with this assignment finally?

Looking for something else?

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