Functions

Hey all,

I'm a student using c++ in jGrasp.
My program is suppose to take the average of a group of test scores, where the lowest score in the group is dropped. It has the following functions:
-void getScore()
-void calcAverage
-int findLowest()

I really have no clue what I'm doing, I pretty much just copy stuff out of my book. Needless to say, I JUST WANT TO MAKE MY PROGRAM CALL THE FIRST TWO FUNCTIONS. I compile and get the error:

" ----jGRASP exec: g++ -g C:\Users\Dippnsidways\Desktop\1.2

C:\Users\Dippnsidways\Desktop\1.2: file not recognized: File format not recognized
collect2: ld returned 1 exit status

----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete."

Heres my program

#include <iostream>
using namespace std;


// Function Prototypes
int getScore ();
int calcAverage ();

int main ()
{
int score1;
int score2;
int score3;
int score4;
int score5;
int average;

// Getting the Test Scores
cout << "This Program will take the Take the Average of 5 Test Scores, dropping the Lowest Grade.\n";
getScore ();
calcAverage ();

return 0;
}

//***************************************************
// getScore function *
//***************************************************

int getScore ()
{
cout << "Please Enter the 5 Test Scores: \n";
cin >> score1, score2, score3 score4 score5;

return 0;
}

//***************************************************
// calcAverage function *
//***************************************************

int calcAverage (int score1, int score2, int score3, int score4, int score5)
{
cout << ( score1 + score2 + score3 + score4 + score5 / 5 ) << endl;

return 0;
}

Any clues, help?
Please use code tags for your code, it helps us read the post better and help faster. From the error it seems like you have the wrong file extension, make sure your file is
FileName.cpp
thank you Need4Sleep. I'm not sure what code tags are... Is this what you mean?

1
2
 
my code
Topic archived. No new replies allowed.