#include <iostream>
using namespace std;
double average(int x);
int main()
{
int a,b,c;
cout <<"average is:"<<average(a,b,c);
cin >>a>>b>>c;
return 0;
}
double average(int x)
{
return (x+x+x)/3;
}
xfreebornx
-23
Light Poster
Recommended Answers
Jump to Postint a,b,c; cout <<"average is:"<<average(a,b,c); cin >>a>>b>>c;
I always wonder how it makes sense to do the work before getting the values when the work depends on the values. Try this:
int a,b,c; cin >>a>>b>>c; cout <<"average is:"<<average(a,b,c);
Also, the function is not defined …
All 4 Replies
Tom Gunn
1,164
Practically a Master Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
dennis.wu
0
Newbie Poster
thug line
-8
Newbie Poster
Ancient Dragon
commented:
Learn to use code tags.
-7
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.