| | |
please help me fix!!
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
•
•
C++ Syntax (Toggle Plain Text)
int a,b,c; cout <<"average is:"<<average(a,b,c); cin >>a>>b>>c;
C++ Syntax (Toggle Plain Text)
int a,b,c; cin >>a>>b>>c; cout <<"average is:"<<average(a,b,c);
C++ Syntax (Toggle Plain Text)
double average(int x, int y, int z) { return (x+y+z)/3; }
Last edited by Tom Gunn; Aug 24th, 2009 at 4:19 pm.
-Tommy (For Great Justice!) Gunn
help you fix what??? The most obvious problem is that it is using uninitialized variables a, b and c. Next, function average only takes one argument, not 3. Either change that function to accept three arguments or only pass one.
[edit]^^^ what Tom said. [/edit]
[edit]^^^ what Tom said. [/edit]
Last edited by Ancient Dragon; Aug 24th, 2009 at 4:20 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Aug 2009
Posts: 12
Reputation:
Solved Threads: 0
Where you go
c++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; double average(int,int,int); int main() { int a,b,c; cin >>a>>b>>c; cout <<"average is:"<<average(a,b,c) << endl; return 0; } double average(int x,int y, int z) { return (x+y+z)/3.0; }
•
•
Join Date: Jul 2009
Posts: 9
Reputation:
Solved Threads: 0
hi.. please try this one.. im not sure if this is what you wanted but i hope this code can help you..
#include<iostream>
using namespace std;
int main()
{
float a,b,c;
double x;
// x = average of a,b,c
cout<<"Insert 3 Average: "
cin>>a;
cin>>b;
cin>>c;
x = (a+b+c)/3;
cout<<"The average is "<<x;
return 0;
}
™Thug Line™
#include<iostream>
using namespace std;
int main()
{
float a,b,c;
double x;
// x = average of a,b,c
cout<<"Insert 3 Average: "
cin>>a;
cin>>b;
cin>>c;
x = (a+b+c)/3;
cout<<"The average is "<<x;
return 0;
}
™Thug Line™
![]() |
Similar Threads
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP)
- Ad Aware will fix slow running Internet Explorer. (Web Browsers)
- Hijackthis Log: What to fix? (Viruses, Spyware and other Nasties)
- IE6 Hanging Up (on each new page) FIX! (Web Browsers)
- Fix Movie Interference in AVI Files (Windows tips 'n' tweaks)
- How can I fix an upgrade disaster? (Windows NT / 2000 / XP)
- What exactly does this error message mean and how can I fix? (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: Semicolons before a line too!???!??
- Next Thread: Cash Register / c++ / loops issue
| Thread Tools | Search this Thread |
api array arrays based binary bitmap c++ c/c++ calculator char char* class classes code coding compile console conversion convert count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






