| BlazingNoob (1) | |
|
So, I'm new to this and I just watched a tutorial I have copied everything he had, except for system("pause"); because the thing wouldn't launch with that everything works fine but averaging the numbers it always equals 0. Help please? #include <iostream> using namespace 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; return 0; } | |
|
|
|
| jlillie89 (378) | |
|
Hi, I have located your problem. But first I need to tell you about code tags. They are on the right of the text box you type in to make a post. They look like <>, and are the top left box. Please use them because they will help others to read your code. :) This was your issue. daverage + (dnumber1 + dnumber2 + dnumber3) / 3;It should be daverage = (dnumber1 + dnumber2 + dnumber3) / 3; I ran it and it worked. C YA DUDE! | |
|
|
|
| Felicia123 (156) | |||
|
@Blazing. please use code tag and make your code easier
| |||
|
|
|||