Guys,
I could really use some direction in getting this console program working for a C++ assignment. I'm in my 8th week and although I've been doing good on past projects, this is a multiple file assignment and I'm confusing myself the more I try to understand. I feel like a complete idiot when I read about other people problems and they are WAY over my head most times and I'm stuck on this elementary project.
Background: Write a program that asks the user to input a series of five numbers. Then, average these numbers and output the results. You must have a function called average that is used in main but has a separate average.h file and an average.cpp file associated with it and included into the main program.
The instructions included in the textbook and the instructor's minimal handout on this isn't making the process very clear to me. My .h, and both .cpp aren't making a connection; 99.9% sure it's my coding. Anyway, I'm getting these 2 errors:
1. NumbersInput: undeclared identifier ( althought I believe I declared in AvgFunc.cpp file
2. average" function-style initializer appears to be a function definition. (no idea what this means)
Here are my files, (don't laugh, lol)
AvgFunc.h
#include<iostream>
using namespace std;
int average (int num);
AvgFunc.cpp
#include "AvgFunc.h"
using namespace std;
int average(numbersInput)
{
int numbersInput, avg;
cin >> numbersInput;
avg = numbersInput / 5;
return avg;
}
Main.cpp
#include "AvgFunc.h"
int main()
{
int num, avg;
cout <<"This program will average a group of 5 numbers of your choice." <<endl;
cout <<"\n\nPlease enter 5 numbers: " <<" "<<endl;
cin >> num;
cout <<"The average of the numbers you entered is: "<<avg <<endl;
cin.get();
return 0;
}
Please be gentle with me, lol, but how many things am I doing wrong?