Hello,
I am learning about array's. I have a program that should take in a user specified number of variables, in this case numerical grade points, assign it to a component and output its total sum. then display out each variable entered related to its place in the array.
My problem, i put in five different grade points and get out all zero's....
any suggestions are greatly appreciated.
------********----------
#include<iostream>
using namespace std;
void show_all_grades_entered(int grades, int grades_in_array[]);
int total_sum_of_grades(int grades, int grades_in_array[]);
int main()
{
int enter_grade=0;
int grades=0;
int i=0;
int total_sum=0;
int grades_in_array[50]={0};
cout<<"\nEnter maximum number of grades using arrays (No More than 50) ";
cin>>grades;
Firstly, edit your post so it uses code tags - the <> button on the right.
If you have any compile errors, post these in full as well
The first problem is that you don't store the entered values into the array.
With variable / function names - I like to use Camel Case - like this:
GradesSum
PrintGrades
Notice no underscores (name is too long), capitalise the first letter of a word. You are allowed to abbreviate a bit - put a comment at the declaration to describe what the variable is for.
Names like this total_sum_of_grades could be better IMO. Total & Sum mean the same thing, of isn't really needed because they are all "something of something".
Hope this helps a bit - I look forward to seeing your new code. :)