I can get everything to run perfectly, it is just when I print out the final grade, it will just give me a blank for it. Maybe I'm doing something wrong in my finalgrade function, but i don't know....I need help!

#include <iostream>
#include <iomanip>

using namespace std;

 const int numtest = 3; // number of tests
 const int numlab = 3; // number of labs
 const int numproject = 3; // number of projects
 const int numfinalexam = 1; // number of projects

void testgrades(int testscores[]);
void labgrades(int labscores[]);
void projectgrades(int projectscores[]);
void finalexamgrades (int finalexamscores[]);
char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[]);
void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade);


int main ()
{
    
    cout<<fixed<<showpoint;
    cout.precision(2);
    
    
    int testscores[numtest];
    int labscores[numlab];
    int projectscores[numproject];
    int finalexamscores[numfinalexam];
    char finalgradescore;
    
    
    testgrades(testscores);
    labgrades(labscores);
    projectgrades(projectscores);
    finalexamgrades(finalexamscores);
    finalgradescore = finalgrade(testscores,labscores,projectscores,finalexamscores);
    printresults(testscores,labscores,projectscores,finalexamscores,finalgradescore);
    
    
    system ("PAUSE");
    return 0;
}
    
    void testgrades (int testscores[])
    {
              
           cout<<"Test grades ";  
             
           for (int i=1; i<=numtest; i++)   
           {
               cin>>testscores[i]; 
           }  

    }
    
    void labgrades (int labscores[])
    {  
            
           cout<<"Lab grades ";  
            
           for (int i=1; i<=numlab; i++)
           {
               cin>>labscores[i];               
           }
         
    }

    void projectgrades (int projectscores[])
    {
           
           cout<<"Project grades "; 
           
           for (int i=1; i<=numproject; i++)
           {
               cin>>projectscores[i];
           }
           
    }
    
    void finalexamgrades (int finalexamscores[])
    {
           
           cout<<"Final exam grade "; 
           
           for (int i=1; i<=numfinalexam; i++)
           {
               cin>>finalexamscores[i];           
           }
           
           
    }
    
    char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[])
{
    
         double totalpoints;
         
         for (int i =0;i<3;i++)
         {
           totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);
    
           if (totalpoints >= 90 && totalpoints <=100)
           
           return 'A';
          
           else if (totalpoints >= 80 && totalpoints < 90)
           return 'B';
           
           else if (totalpoints >= 70 && totalpoints < 80)
           return 'C';
           
           else if (totalpoints >= 60 && totalpoints < 70)
           return 'D';
           
           else if (totalpoints < 60 && totalpoints >= 0)
           return 'E';
          }
            

}
    
    void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade)
{
    
         cout<<""<<endl;
         
         int totalscores;
         
         
         
         cout<<"Test grades"<<endl;
         for (int i=1; i<=numtest; i++)
         {
         cout<<testscores[i]<<endl; // prints out all scores for Tests
         }
         cout<<""<<endl;
         
         
         cout<<"Lab grades"<<endl;
         for (int i=1; i<=numlab;i++)
         {
         cout<<labscores[i]<<endl; // prints out all scores for Labs
         }
         cout<<""<<endl;
         
         
         cout<<"Project grades"<<endl;
         for (int i=1; i<=numproject; i++)
         {
         cout<<projectscores[i]<<endl; // prints out all scores for Projects
         }
         cout<<""<<endl;
         
         
         cout<<"Final Exam grade"<<endl;
         for (int i=1; i<=numfinalexam;i++)
         {
         cout<<finalexamscores[i]<<endl; // prints out all scores for Final
         }
         cout<<""<<endl;
         
         cout<<"Final grade"<<endl;
         for (int i=1;i<3;i++)
         {
         cout<<finalgrade<<endl;
         }
     
}

Well you need to place some debugging statements in your code or use a debugger and add some breakpoints, or both. You need to decide exactly what each function is SUPPOSED to do, then decide whether it is actually doing it. You can add a bunch of cout statements (which you will remove later) to different parts of your code to find out exactly what your code is doing under certain circumstances. For one thing, you need to decide whether the problem is in your printresults function or your finalgrade function, or both. Easy way to tell this. Add this line before your call to printresults:

cout << "final grade before printresults call = " << finalgradescore << endl;

Look at it. Is it correct? If not, at least one problem lies outside your printresults function. At that point, focus on your finalgrade function. Add a breakpoint and/or cout statement to find out exactly which return statement is executed. Make sure it's the correct one for the data passed to it. Make sure the date that the function receives is the data you think you sent it. Etcetera, etcetera. Each step gets you closer to nailing down the exact cause of the problem. Don't be afraid to put in debugging lines of code that you know you will delete later. It's all part of the programming process (just remember to eventually take them out!).

I tried it, but it shows the blank space for it. I just have no clue why it is doing it. I tried everything, but I can't seem to print the letter grade for my program. It looks like I returned the grades fine in the "finalgrade" function. I don't know =/

I tried it, but it shows the blank space for it. I just have no clue why it is doing it. I tried everything, but I can't seem to print the letter grade for my program. It looks like I returned the grades fine in the "finalgrade" function. I don't know =/

That's my point. If it's returning a blank, then it's not going to print because the problem is before then.

It looks like I returned the grades fine in the "finalgrade" function.

Well is it returning the grades fine or is it returning a blank?

It's funny that you program prints anything: the only purpose of this code now is the program stack corruption. The 1st index in C and C++ arrays is 0 (not 1!). All for loops in your input routines are wrong.
See also finalgrade function: not all control paths return a value.
Make obvious corrections then try again...

I'm still getting a blank. I think my for loop is wrong, but i tried a lot of different ways, but i couldn't get it to work. Can someone lead me to the right direction. This is confusing. All I'm trying to do is add up the points from "labs, projects, tests, finalexam" to get a letter grade. I did the same program before and got it to work, i'm just doing the same one with one dimensional arrays now, and for some reason, i can't get this last part to work.


Here is the updated code:

#include <iostream>
#include <iomanip>

using namespace std;

 const int numtest = 3; // number of tests
 const int numlab = 3; // number of labs
 const int numproject = 3; // number of projects
 const int numfinalexam = 1; // number of projects

void testgrades(int testscores[]);
void labgrades(int labscores[]);
void projectgrades(int projectscores[]);
void finalexamgrades (int finalexamscores[]);
char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[]);
void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade);


int main ()
{
    
    cout<<fixed<<showpoint;
    cout.precision(2);
    
    
    int testscores[numtest];
    int labscores[numlab];
    int projectscores[numproject];
    int finalexamscores[numfinalexam];
    char finalgradescore;
    
    
    testgrades(testscores);
    labgrades(labscores);
    projectgrades(projectscores);
    finalexamgrades(finalexamscores);
    finalgrade(testscores,labscores,finalexamscores,projectscores);
    printresults(testscores,labscores,projectscores,finalexamscores,finalgradescore);
    
    
    
    system ("PAUSE");
    return 0;
}
    



    void testgrades (int testscores[])
    {
              
           cout<<"Test grades ";  
             
           for (int i=1; i<=numtest; i++)   
           {
               cin>>testscores[i]; 
           }  

    }
    



    void labgrades (int labscores[])
    {  
            
           cout<<"Lab grades ";  
            
           for (int i=1; i<=numlab; i++)
           {
               cin>>labscores[i];               
           }
        
    }




    void projectgrades (int projectscores[])
    {
           
           cout<<"Project grades "; 
           
           for (int i=1; i<=numproject; i++)
           {
               cin>>projectscores[i];
           }
         
    }
    



    void finalexamgrades (int finalexamscores[])
    {
           
           cout<<"Final exam grade "; 
           
           for (int i=1; i<=numfinalexam; i++)
           {
               cin>>finalexamscores[i];           
           }
           
           
    }



    
    char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[])
    {
    
    char finalgradescore;   
      double totalpoints;
   
   for (int i = 0; i < 4; i++)
   {
    totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);  
         
         
   if (totalpoints >= 90 && totalpoints <=100)     
   cout<<"A"<<endl; 
           
   else if (totalpoints >= 80 && totalpoints < 90)   
     return 'B';       
         
   else if (totalpoints >= 70 && totalpoints < 80)      
      return 'C';
       
   else if (totalpoints >= 60 && totalpoints < 70)     
     return 'D';               
           
   else if (totalpoints < 60 && totalpoints >= 0) 
     return 'E';       
     } 
         
       cout << "final grade before printresults call = " << finalgradescore<< endl;  
         
    }
    



    void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade)
{
    
         cout<<""<<endl;
         
         
         cout<<"Test grades"<<endl;
         for (int i=1; i<=numtest; i++)
         {
         cout<<testscores[i]<<endl; // prints out all scores for Tests
         }
         cout<<""<<endl;
         
         
         cout<<"Lab grades"<<endl;
         for (int i=1; i<=numlab;i++)
         {
         cout<<labscores[i]<<endl; // prints out all scores for Labs
         }
         cout<<""<<endl;
         
         
         cout<<"Project grades"<<endl;
         for (int i=1; i<=numproject; i++)
         {
         cout<<projectscores[i]<<endl; // prints out all scores for Projects
         }
         cout<<""<<endl;
         
         
         cout<<"Final Exam grade"<<endl;
         for (int i=1; i<=numfinalexam;i++)
         {
         cout<<finalexamscores[i]<<endl; // prints out all scores for Final
         }
         cout<<""<<endl;
}

I'm still getting a blank. I think my for loop is wrong,

You're right. A lot (if not all) of your loops are wrong. ArkM already told you so, but I'll try to clarify:

If you have an array with say 5 elements: int a[5]; This means that you can now acces element 0 to 4:

1    2    3    4    5      elements
------------------------------
a[0] a[1] a[2] a[3] a[4]

But in your code you say something like: for (int i=1; i<=5; i++) Which means you start at index 1 which is the second element! This will also run out of the bounds of the array because you're trying to acces index 5, but this is the sixth element in the array and so it doesn't exist.

I hope this clears things up a bit and I'll conclude with a tutorial on arrays

Is that the main reason I can't get the letter grade to appear? When I print out the points for all assignments, it comes out correctly even when I start at int i=1. The reason I did that is because when I start at 0 for this assignment, it was giving me trouble. My main goal is to print out the letter grade, that is why i have the if statements in the finalgrade function. I have a constant for all of my assignments, so I'm unsure what to set my for loop to for the finalgrade function. I know my main problem is the finalgrade function, but I don't know how to correct this problem.

Is that the main reason I can't get the letter grade to appear?

It could very well be, I didn't check your entire code.
If you want to use arrays and loops, this is the way to do it:

const int numtest = 3;
for (int i = 0; i < numtest; i++)
{
    // no chance of array running out of bounds now

So change every loop in your program to loop like above and that will probably take care of half your problem :)

Thanks for the reply.

I'm going to go ahead and try that and then I will reply back with results.

I made the adjustments and set int i=0 for my for-loop, but the results appeared the same. Everything else prints out except that the final letter grade. The final letter grade still appears blank for some reason. Please help..

Here is the updated code:

#include <iostream>
#include <iomanip>

using namespace std;

 const int numtest = 3; // number of tests
 const int numlab = 3; // number of labs
 const int numproject = 3; // number of projects
 const int numfinalexam = 1; // number of projects

void testgrades(int testscores[]);
void labgrades(int labscores[]);
void projectgrades(int projectscores[]);
void finalexamgrades (int finalexamscores[]);
char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[]);
void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade);


int main ()
{
    
    cout<<fixed<<showpoint;
    cout.precision(2);
    
    
    int testscores[numtest];
    int labscores[numlab];
    int projectscores[numproject];
    int finalexamscores[numfinalexam];
    char finalgradescore;
    
    
    testgrades(testscores);
    labgrades(labscores);
    projectgrades(projectscores);
    finalexamgrades(finalexamscores);
    finalgradescore = finalgrade(testscores,labscores,finalexamscores,projectscores);
    printresults(testscores,labscores,projectscores,finalexamscores,finalgradescore);
    
    
    
    system ("PAUSE");
    return 0;
}
    
    void testgrades (int testscores[])
    {
              
           cout<<"Test grades ";  
             
           for (int i=0; i<numtest; i++)   
           {
               cin>>testscores[i]; 
           }  

    }
    
    void labgrades (int labscores[])
    {  
            
           cout<<"Lab grades ";  
            
           for (int i=0; i<numlab; i++)
           {
               cin>>labscores[i];               
           }
        
    }

    void projectgrades (int projectscores[])
    {
           
           cout<<"Project grades "; 
           
           for (int i=0; i<numproject; i++)
           {
               cin>>projectscores[i];
           }
         
    }
    
    void finalexamgrades (int finalexamscores[])
    {
           
           cout<<"Final exam grade "; 
           
           for (int i=0; i<numfinalexam; i++)
           {
               cin>>finalexamscores[i];           
           }
           
           
    }
    
    char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[])
    {
    
    char finalgradescore;   
    double totalpoints;
   
   for (int i = 0;i<4; i++)
   {
    totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);  
         
         
   if (totalpoints >= 90 && totalpoints <=100)     
   cout<<"A"<<endl; 
           
   else if (totalpoints >= 80 && totalpoints < 90)   
     return 'B';       
         
   else if (totalpoints >= 70 && totalpoints < 80)      
      return 'C';
       
   else if (totalpoints >= 60 && totalpoints < 70)     
     return 'D';               
           
   else if (totalpoints < 60 && totalpoints >= 0) 
     return 'E';       
     } 
         
       cout << "final grade before printresults call = " << finalgradescore<< endl;  
         
    }
    
    void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade)
{
    
         cout<<""<<endl;
         
         
         cout<<"Test grades"<<endl;
         for (int i=0; i<numtest; i++)
         {
         cout<<testscores[i]<<endl; // prints out all scores for Tests
         }
         cout<<""<<endl;
         
         
         cout<<"Lab grades"<<endl;
         for (int i=0; i<numlab;i++)
         {
         cout<<labscores[i]<<endl; // prints out all scores for Labs
         }
         cout<<""<<endl;
         
         
         cout<<"Project grades"<<endl;
         for (int i=0; i<numproject; i++)
         {
         cout<<projectscores[i]<<endl; // prints out all scores for Projects
         }
         cout<<""<<endl;
         
         
         cout<<"Final Exam grade"<<endl;
         for (int i=0; i<numfinalexam;i++)
         {
         cout<<finalexamscores[i]<<endl; // prints out all scores for Final
         }
         cout<<""<<endl;
}

It seems a loop control is your weak point now...
Look at the finalgrade function again:

...
    for (int i = 0;i<4; i++)   {
        totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);  
   ...

So i = 0, 1, 2, 3. But your arrays have index range 0..2 (for the 1st, 2nd and 3rd) and 0 (only one element) for the 4th! You get unexistent array element values for i = 1, 2 and 3. I don't know why you assign so strange values for your arrays, but your finalgrade function does not know it too. It produces wrong results for totalpoints.

Now about totalpoints to char translation. No the last else clause in if cascade so if your have totalpoints value out of range the function does not return any valid value. It's your case: you get wrong totalpoints value then return garbage char value. If the function returns 0 (for example), output statement prints nothing (0 is non-printable char).

Terminate if cascade with else return '\?'; to explicitly designate wrong situation.

Here is your program with some revised debugging statements. See if this helps you narrow down where the problem is. Make sure you delete them later.

#include <iostream>
#include <iomanip>

using namespace std;

 const int numtest = 3; // number of tests
 const int numlab = 3; // number of labs
 const int numproject = 3; // number of projects
 const int numfinalexam = 1; // number of projects

void testgrades(int testscores[]);
void labgrades(int labscores[]);
void projectgrades(int projectscores[]);
void finalexamgrades (int finalexamscores[]);
char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[]);
void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade);


int main ()
{
    
    cout<<fixed<<showpoint;
    cout.precision(2);
    
    
    int testscores[numtest];
    int labscores[numlab];
    int projectscores[numproject];
    int finalexamscores[numfinalexam];
    char finalgradescore;
    
    
    testgrades(testscores);
    labgrades(labscores);
    projectgrades(projectscores);
    finalexamgrades(finalexamscores);
             
    finalgradescore = 'X';  // dummy value.  Should be overwritten          
    cout << "final grade before finalgrade call = " << finalgradescore<< endl;  
    finalgradescore = finalgrade(testscores,labscores,finalexamscores,projectscores);        
    cout << "final grade after finalgrade call = " << finalgradescore<< endl;  
    printresults(testscores,labscores,projectscores,finalexamscores,finalgradescore);
        
    system ("PAUSE");
    return 0;
}
    
    void testgrades (int testscores[])
    {
              
           cout<<"Test grades ";  
             
           for (int i=0; i<numtest; i++)   
           {
               cin>>testscores[i]; 
           }  

    }
    
    void labgrades (int labscores[])
    {  
            
           cout<<"Lab grades ";  
            
           for (int i=0; i<numlab; i++)
           {
               cin>>labscores[i];               
           }
        
    }

    void projectgrades (int projectscores[])
    {
           
           cout<<"Project grades "; 
           
           for (int i=0; i<numproject; i++)
           {
               cin>>projectscores[i];
           }
         
    }
    
    void finalexamgrades (int finalexamscores[])
    {
           
           cout<<"Final exam grade "; 
           
           for (int i=0; i<numfinalexam; i++)
           {
               cin>>finalexamscores[i];           
           }
           
           
    }
    
    char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[])
    {
    
    char finalgradescore;   
    double totalpoints;
   
   for (int i = 0;i<4; i++)
   {
    totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);  
         
         
   if (totalpoints >= 90 && totalpoints <=100)     
   cout<<"A"<<endl; 
           
   else if (totalpoints >= 80 && totalpoints < 90)   
     return 'B';       
         
   else if (totalpoints >= 70 && totalpoints < 80)      
      return 'C';
       
   else if (totalpoints >= 60 && totalpoints < 70)     
     return 'D';               
           
   else if (totalpoints < 60 && totalpoints >= 0) 
     return 'E';       
     } 
         
    }
    
    void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade)
{
         cout << "In printresults.  I was passed " << finalgrade
              << " as the finalgrade parameter\n";
   
         cout<<""<<endl;
                  
         cout<<"Test grades"<<endl;
         
         for (int i=0; i<numtest; i++)
         {
         cout<<testscores[i]<<endl; // prints out all scores for Tests
         }
         cout<<""<<endl;
         
         
         cout<<"Lab grades"<<endl;
         for (int i=0; i<numlab;i++)
         {
         cout<<labscores[i]<<endl; // prints out all scores for Labs
         }
         cout<<""<<endl;
         

         
         cout<<"Project grades"<<endl;
         for (int i=0; i<numproject; i++)
         {
         cout<<projectscores[i]<<endl; // prints out all scores for Projects
         }
         cout<<""<<endl;
         
         
         cout<<"Final Exam grade"<<endl;
         for (int i=0; i<numfinalexam;i++)
         {
         cout<<finalexamscores[i]<<endl; // prints out all scores for Final
         }
         cout<<""<<endl;
}

It seems a loop control is your weak point now...
Look at the finalgrade function again:

...
    for (int i = 0;i<4; i++)   {
        totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);  
   ...

So i = 0, 1, 2, 3. But your arrays have index range 0..2 (for the 1st, 2nd and 3rd) and 0 (only one element) for the 4th! You get unexistent array element values for i = 1, 2 and 3. I don't know why you assign so strange values for your arrays, but your finalgrade function does not know it too. It produces wrong results for totalpoints.

Now about totalpoints to char translation. No the last else clause in if cascade so if your have totalpoints value out of range the function does not return any valid value. It's your case: you get wrong totalpoints value then return garbage char value. If the function returns 0 (for example), output statement prints nothing (0 is non-printable char).

Terminate if cascade with else return '\?'; to explicitly designate wrong situation.

I'm not that good in C++, so I'm unsure on what you want me to do with the for-loop. I know my for-loop is wrong, but i don't know how to make it read the points that I have passed in for the arrays. Can you help me?

Here is your program with some revised debugging statements. See if this helps you narrow down where the problem is. Make sure you delete them later.

#include <iostream>
#include <iomanip>

using namespace std;

 const int numtest = 3; // number of tests
 const int numlab = 3; // number of labs
 const int numproject = 3; // number of projects
 const int numfinalexam = 1; // number of projects

void testgrades(int testscores[]);
void labgrades(int labscores[]);
void projectgrades(int projectscores[]);
void finalexamgrades (int finalexamscores[]);
char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[]);
void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade);


int main ()
{
    
    cout<<fixed<<showpoint;
    cout.precision(2);
    
    
    int testscores[numtest];
    int labscores[numlab];
    int projectscores[numproject];
    int finalexamscores[numfinalexam];
    char finalgradescore;
    
    
    testgrades(testscores);
    labgrades(labscores);
    projectgrades(projectscores);
    finalexamgrades(finalexamscores);
             
    finalgradescore = 'X';  // dummy value.  Should be overwritten          
    cout << "final grade before finalgrade call = " << finalgradescore<< endl;  
    finalgradescore = finalgrade(testscores,labscores,finalexamscores,projectscores);        
    cout << "final grade after finalgrade call = " << finalgradescore<< endl;  
    printresults(testscores,labscores,projectscores,finalexamscores,finalgradescore);
        
    system ("PAUSE");
    return 0;
}
    
    void testgrades (int testscores[])
    {
              
           cout<<"Test grades ";  
             
           for (int i=0; i<numtest; i++)   
           {
               cin>>testscores[i]; 
           }  

    }
    
    void labgrades (int labscores[])
    {  
            
           cout<<"Lab grades ";  
            
           for (int i=0; i<numlab; i++)
           {
               cin>>labscores[i];               
           }
        
    }

    void projectgrades (int projectscores[])
    {
           
           cout<<"Project grades "; 
           
           for (int i=0; i<numproject; i++)
           {
               cin>>projectscores[i];
           }
         
    }
    
    void finalexamgrades (int finalexamscores[])
    {
           
           cout<<"Final exam grade "; 
           
           for (int i=0; i<numfinalexam; i++)
           {
               cin>>finalexamscores[i];           
           }
           
           
    }
    
    char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[])
    {
    
    char finalgradescore;   
    double totalpoints;
   
   for (int i = 0;i<4; i++)
   {
    totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);  
         
         
   if (totalpoints >= 90 && totalpoints <=100)     
   cout<<"A"<<endl; 
           
   else if (totalpoints >= 80 && totalpoints < 90)   
     return 'B';       
         
   else if (totalpoints >= 70 && totalpoints < 80)      
      return 'C';
       
   else if (totalpoints >= 60 && totalpoints < 70)     
     return 'D';               
           
   else if (totalpoints < 60 && totalpoints >= 0) 
     return 'E';       
     } 
         
    }
    
    void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade)
{
         cout << "In printresults.  I was passed " << finalgrade
              << " as the finalgrade parameter\n";
   
         cout<<""<<endl;
                  
         cout<<"Test grades"<<endl;
         
         for (int i=0; i<numtest; i++)
         {
         cout<<testscores[i]<<endl; // prints out all scores for Tests
         }
         cout<<""<<endl;
         
         
         cout<<"Lab grades"<<endl;
         for (int i=0; i<numlab;i++)
         {
         cout<<labscores[i]<<endl; // prints out all scores for Labs
         }
         cout<<""<<endl;
         

         
         cout<<"Project grades"<<endl;
         for (int i=0; i<numproject; i++)
         {
         cout<<projectscores[i]<<endl; // prints out all scores for Projects
         }
         cout<<""<<endl;
         
         
         cout<<"Final Exam grade"<<endl;
         for (int i=0; i<numfinalexam;i++)
         {
         cout<<finalexamscores[i]<<endl; // prints out all scores for Final
         }
         cout<<""<<endl;
}

the only thing that shows is the "finalgrade before the finalgrade call = X" Other than that, all the other ones appear blank. I'm trying to figure it out, but i need another hint on how to fix this problem. I'm trying to figure it out because I have a test on it tomorrow morning.

Format your code so things line up. It will make these things much easier to spot. You need to be extremely diligent and patient when debugging. Learn to use a debugger and put breakpoints in, and in the meantime, flood your code with statements and read the statements very carefully. Stick this function in your code and look dcarefully at the output. It'll tell you a lot about what is going on.

char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[])
    {   
       char finalgradescore;   
       double totalpoints;
   
       for (int i = 0;i<4; i++)
       {
            cout << "Top of the loop.  i = " << i << endl;
            
            totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);  
         
            if (totalpoints >= 90 && totalpoints <=100)     
                 cout<<"A"<<endl; 
           
            else if (totalpoints >= 80 && totalpoints < 90) 
            {
                 cout << "Returning B\n";  
                 return 'B';
            }       
         
            else if (totalpoints >= 70 && totalpoints < 80) 
            {
                 cout << "Returning C\n";  
                 return 'C';
            }       
         
            else if (totalpoints >= 60 && totalpoints < 70) 
            {
                 cout << "Returning D\n";  
                 return 'D';
            }       
         
            else if (totalpoints < 60 && totalpoints >= 0) 
            {
                 cout << "Returning E\n";  
                 return 'E';
            }                
       } 
         
       cout << "Function is done.  I am returning nothing.\n";  
    }

Thanks for your reply.

I still got a blank screen for the final grade. I think the values that I put in for the scores are not being passed through in the finalgrade function, but i dont know how to connect the functions so i can gather the points to get the finalgrade. Anymore ideas?


Here is the updated code:

#include <iostream>
#include <iomanip>

using namespace std;

 const int numtest = 3; // number of tests
 const int numlab = 3; // number of labs
 const int numproject = 3; // number of projects
 const int numfinalexam = 1; // number of projects




void testgrades(int testscores[]);
void labgrades(int labscores[]);
void projectgrades(int projectscores[]);
void finalexamgrades (int finalexamscores[]);
char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[]);
void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade);


int main ()
{
    
    cout<<fixed<<showpoint;
    cout.precision(2);
    


    
    int testscores[numtest];
    int labscores[numlab];
    int projectscores[numproject];
    int finalexamscores[numfinalexam];
    char finalgradescore;
    


    
    testgrades(testscores);
    labgrades(labscores);
    projectgrades(projectscores);
    finalexamgrades(finalexamscores);
    finalgradescore = finalgrade(testscores,labscores,finalexamscores,projectscores);
    printresults(testscores,labscores,projectscores,finalexamscores,finalgradescore);
    
    
    
    system ("PAUSE");
    return 0;
}
    



    void testgrades (int testscores[])
    {
              
           cout<<"Test grades ";  
             
           for (int i=1; i<=numtest; i++)   
           {
               cin>>testscores[i]; 
           }  

    }
    


    void labgrades (int labscores[])
    {  
            
           cout<<"Lab grades ";  
            
           for (int i=1; i<=numlab; i++)
           {
               cin>>labscores[i];               
           }
        
    }



    void projectgrades (int projectscores[])
    {
           
           cout<<"Project grades "; 
           
           for (int i=1; i<=numproject; i++)
           {
               cin>>projectscores[i];
           }
         
    }
    

    void finalexamgrades (int finalexamscores[])
    {
           
           cout<<"Final exam grade "; 
           
           for (int i=1; i<=numfinalexam; i++)
           {
               cin>>finalexamscores[i];           
           }
           
           
    }
    


    char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[])
    {
    
    char finalgradescore;   
      double totalpoints;
   
   for (int i = 0; i < 4; i++)
{
       
    totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);  
         
         
   if (totalpoints >= 90 && totalpoints <=100)     
    {
    cout<<"A"; 
    }      
   else if (totalpoints >= 80 && totalpoints < 90)   
     {
     cout << "B";
          
     }   
   else if (totalpoints >= 70 && totalpoints < 80)      
      {
      cout << "C";     
    
      }
   else if (totalpoints >= 60 && totalpoints < 70)     
     {
     cout << "D";
                 
     }     
   else if (totalpoints < 60 && totalpoints >= 0) 
     {
     cout<< "E";      
     } 
         
    
}         
}
    


    void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char finalgrade)
{
   
         cout <<"Final grade: "<<finalgradescore;
    
         cout<<""<<endl;
         
         
         cout<<"Test grades"<<endl;
         for (int i=1; i<=numtest; i++)
         {
         cout<<testscores[i]<<endl; // prints out all scores for Tests
         }
         cout<<""<<endl;
         
         
         cout<<"Lab grades"<<endl;
         for (int i=1; i<=numlab;i++)
         {
         cout<<labscores[i]<<endl; // prints out all scores for Labs
         }
         cout<<""<<endl;
         
         
         cout<<"Project grades"<<endl;
         for (int i=1; i<=numproject; i++)
         {
         cout<<projectscores[i]<<endl; // prints out all scores for Projects
         }
         cout<<""<<endl;
         
         
         cout<<"Final Exam grade"<<endl;
         for (int i=1; i<=numfinalexam;i++)
         {
         cout<<finalexamscores[i]<<endl; // prints out all scores for Final
         }
         cout<<""<<endl;
}

Look at your code:

char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[])
    {
    
    char finalgradescore;   
      double totalpoints;
   
   for (int i = 0; i < 4; i++)
{
       
    totalpoints = (testscores[i] + labscores[i] + projectscores[i] + finalexamscores[i]);  
         
         
   if (totalpoints >= 90 && totalpoints <=100)     
    {
    cout<<"A"; 
    }      
   else if (totalpoints >= 80 && totalpoints < 90)   
     {
     cout << "B";
          
     }   
   else if (totalpoints >= 70 && totalpoints < 80)      
      {
      cout << "C";     
    
      }
   else if (totalpoints >= 60 && totalpoints < 70)     
     {
     cout << "D";
                 
     }     
   else if (totalpoints < 60 && totalpoints >= 0) 
     {
     cout<< "E";      
     } 
         
    
}         
}

There is not a single return statement in this function now, but you say you are returning a char (see red). That was the idea of the debugging statements I put in. If you saw this line:

cout << "Function is done.  I am returning nothing.\n";

that's supposed to get your antenna up. On the other hand, if you saw this line:

cout << "Top of the loop.  i = " << i << endl;

display only once, that was also supposed to get your antenna up since you're going through a "loop" only once.

And again, it's essential that you start spacing your code in a way that makes the brackets line up and you indent inner blocks. These problems will pop out to your eye much easier if you format your code.

Now, instead of a blank, i'm getting a symbol that looks like an hour glass lol.

I thought when you meant "I am returning nothing" that I had to take out the return 'A', return 'B' etc.

I thought when you meant "I am returning nothing" that I had to take out the return 'A', return 'B' etc.

No, those debugging comments weren't intended to make your program do anything different. All they were were printouts to display WHAT was happening. I was not suggesting that you change your code so that the function didn't return anything. Quite the opposite. It needs to return something. Any function that is not a void function needs to return a value. If you saw that message that the function is not returning anything, that tells you there is an error.

One of your errors was this. You had these lines:

if (totalpoints >= 90 && totalpoints <=100)     
   cout<<"A"<<endl; 
           
   else if (totalpoints >= 80 && totalpoints < 90)   
     return 'B';

For some reason you changed your original return 'A' to cout << a , but kept the others the same. Put them all back to return statements. You don't need or want to be displaying anything (except for debugging statements which you'll delete later) in that function.

You should also, when posting here, when you describe what happens, tell us what your input was. Different input yields different output and you won't always get a blank when you run your program (well you will now because of the lack of return statements, but before you didn't always).

I got the program to work...I have no clue how I did it, but I just kept messing around with it til I got it right. Took me several hours to figure out something simple. Oh well. Thanks for helping me guys!

#include <iostream>
#include <iomanip>

using namespace std;

const int numtest = 3; // number of tests
const int numlab = 3; // number of labs
const int numproject = 3; // number of projects
const int numfinalexam = 1; // number of projects
const double test_percent = 0.45; // test percent
const double lab_percent = 0.10; // lab percent
const double project_percent = 0.20; // project percent
const double finalexam_percent = 0.25; // final exam percent

void testgrades(int testscores[]);
void labgrades(int labscores[]);
void projectgrades(int projectscores[]);
void finalexamgrades (int finalexamscores[]);
char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[]);
void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char& finalgrade);


int main ()
{
    
    cout<<fixed<<showpoint;
    cout.precision(2);
    
    
    int testscores[numtest];
    int labscores[numlab];
    int projectscores[numproject];
    int finalexamscores[numfinalexam];
    char finalgradescore;
    
    
    testgrades(testscores);
    labgrades(labscores);
    projectgrades(projectscores);
    finalexamgrades(finalexamscores);
    finalgradescore = finalgrade(testscores,labscores,finalexamscores,projectscores);
    printresults(testscores,labscores,projectscores,finalexamscores,finalgradescore);
    


    system ("PAUSE");
    return 0;
}
    
    void testgrades (int testscores[])
    {
           
           cout<<"Test grades ";  
             
           for (int i=0; i<numtest; i++)   
           {
               cin>>testscores[i]; 
           
           }  
    }
    
    void labgrades (int labscores[])
    {  
            
           cout<<"Lab grades ";  
            
           for (int i=0; i<numlab; i++)
           {
               cin>>labscores[i];               
           }
        
    }

    void projectgrades (int projectscores[])
    {
           
           cout<<"Project grades "; 
           
           for (int i=0; i<numproject; i++)
           {
               cin>>projectscores[i];
           }
         
    }
    
    void finalexamgrades (int finalexamscores[])
    {

           
           cout<<"Final exam grade "; 
           
           for (int i=0; i<numfinalexam; i++)
           {
               cin>>finalexamscores[i];          
           }
           
    }
    
    char finalgrade(int testscores[], int labscores[], int finalexamscores[], int projectscores[])
    {
    
         double totalpoints;
         double testpoints;
         double labpoints;
         double projectpoints;
         double finalexampoints;
         double average;
         int sum = 0;
        

         for (int i=0; i<numtest; i++)
         {
         sum+=testscores[i];
         testpoints = ((sum/numtest)*test_percent); // test points
         }
         sum = 0;
         
          for (int i=0; i<numlab; i++)
         {
         sum+=labscores[i];
         labpoints = (sum/numlab)* lab_percent; // lab points
         }
         sum = 0;
         
          for (int i=0; i<numproject; i++)
           {  
         sum+=projectscores[i];
         projectpoints = ((sum/numproject)*project_percent); // project points
         } 
           sum = 0;
                   
          for (int i=0; i<numfinalexam; i++)
         {
         sum+=testscores[i];
         finalexampoints = ((sum/numfinalexam)*finalexam_percent); // finalexam points
         }

      totalpoints = (testpoints + labpoints + projectpoints + finalexampoints);
         
         
   if (totalpoints >= 90 && totalpoints <=100)     
    
    return 'A';
         
   else if (totalpoints >= 80 && totalpoints < 90)   
     {
    return 'B';
    }    
        
   else if (totalpoints >= 70 && totalpoints < 80)      
    {    
    return 'C';   
    }
      
   else if (totalpoints >= 60 && totalpoints < 70)     
    { 
     return 'D';
     }            
          
   else if (totalpoints < 60 && totalpoints >= 0) 
      {   
     return 'E';  
     }

} 
    
    void printresults(int testscores[],int labscores[],int projectscores[],int finalexamscores[],char& finalgrade)
{
         cout<<endl;
         cout<<"Test grades"<<endl;
         for (int i=0; i<numtest; i++)
         {
         cout<<testscores[i]<<endl; // prints out all scores for Tests
         }
         cout<<""<<endl;
         
         
         cout<<"Lab grades"<<endl;
         for (int i=0; i<numlab;i++)
         {
         cout<<labscores[i]<<endl; // prints out all scores for Labs

         }
         cout<<""<<endl;
         
         
         cout<<"Project grades"<<endl;
         for (int i=0; i<numproject; i++)
         {
         cout<<projectscores[i]<<endl; // prints out all scores for Projects
        
         }
         cout<<""<<endl;
         
         
         cout<<"Final Exam grade"<<endl;
         for (int i=0; i<numfinalexam;i++)
         {
         cout<<finalexamscores[i]<<endl; // prints out all scores for Final
        
         }
         cout<<""<<endl;

         
         cout<<"Final grade: "<<finalgrade<<endl; // final grade
         cout<<endl;
         
}
This question has already been answered. Start a new discussion instead.