Hello iam new to using c++, it is a rather fasicanting program but it is really annoying.Iam was watching a tutorial on youtube.As far as i know i typed everything right from this video
I think the void in main(void) can stay, I don't see his compiler complaining about that and I'm fairly confident it just explicitly tells the compiler that there will be no arguments to the function.
The complaint is about that missing semicolon, as MottMan said.
the program is fine..just put a ; after the declaration where you calculate the daverage..just like mahertamim did above..and one more thing..if you intend to use double you don.t need to make
1 2 3 4
double dnumber1 = 0.0; // =0 it is just fine.
double dnumber2 = 0.0; //0 or 0.0 or 0.000000 it is the same
double dnumber3 = 0.0;
double daverage = 0.0;
Looking forward to it sailor, it seems as though you are as far into C++ as I am, so maybe with us two noobs posting problems we can learn from eachother!
#include<iostream>
usingnamespace std;
int main()
{
double dnumber1 = 0.0;
double dnumber2 = 0.0;
double dnumber3 = 0.0;
double daverage = 0.0;
cout << "please enter 3 numbers: " << endl;
cin >> dnumber1;
cin >> dnumber2;
cin >> dnumber3;
daverage = (dnumber1 + dnumber2 + dnumber3) / 3;
cout << "the average of the numbers are: " << daverage << endl << endl;
cout << "Press ENTER to exit\n";
cin.get();
return 0;
}
That should work as I just ran it myself.
Oh, and try using [code] tags around any of your source. [ code ]CODE IN HERE[ /code ] Just don't put those spaces. Highlighting your source and clicking the source code button (the right of the text box, mouse over for name) will do the same.
#include <iostream>
usingnamespace std;
int main()
{
double dnumber1 = 0.0;
double dnumber2 = 0.0;
double dnumber3 = 0.0;
double daverage = 0.0;
cout << "please enter 3 numbers: " << endl;
cin >> dnumber1;
cin >> dnumber2;
cin >> dnumber3;
daverage = (dnumber1 + dnumber2 + dnumber3) / 3;
cout << "the average of the numbers are: " << daverage << endl << endl;
cout << "Press ENTER to exit\n";
cin.get();
cin.get();
return 0;
}
If that still doesn't work, you may want to reinstall your IDE. You may also want to switch to Code::Blocks which is free and much better than Dev C++.