WiiLoaded.com - Wii Forum and News

Full Version: Help With C++
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, could anyone who knows what they are doing tell me why the following C++ isn't working?

Quote:
#include<iostream>
using namespace std;

int main(void)
{
double dnumber1 " 0.0;
double dnumber2 " 0.0;
double dnumber3 " 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;

system("PAUSE");
return 0;
}



I'm getting quite a few errors, thanks.

hm.. *presses the "Call D4rk" button*
Hmmm, why is it "int main"? Should it not be just "main"? What are you trying to use the operator "main" as?
Or Cosmic? Any will do.

Snake Wrote:
Or Cosmic? Any will do.


TheCosmicFrog Wrote:
Hmmm, why is it "int main"? Should it not be just "main"? What are you trying to use the operator "main" as?

TheCosmicFrog Wrote:

Snake Wrote:
Or Cosmic? Any will do.


TheCosmicFrog Wrote:
Hmmm, why is it "int main"? Should it not be just "main"? What are you trying to use the operator "main" as?


This is straight from a youtube video tutorial I was following...

I'm still learning from C++ for dummies remember. Wink

I will change and see.

EDIT:

Still broken. Sad

Hahaha awesome.
I tweaked it a bit for fun. This works:

Code:
#include<iostream>

using namespace std;

main(void)
{
double dnumber1;
dnumber1 = 0.0;

double dnumber2;
dnumber2 = 0.0;

double dnumber3;
dnumber3 = 0.0;

cout << "Please enter 3 numbers! " << endl;
cin >> dnumber1;
cin >> dnumber2;
cin >> dnumber3;
double daverage;
daverage = (dnumber1 + dnumber2 + dnumber3) / 3;
cout << "The average of the numbers are: " << daverage << endl;

system("PAUSE");
return 0;
}

Code:
#include <iostream>
using namespace std;

int main(void)
{
double dnumber1 = 0.0;
double dnumber2 = 0.0;
double dnumber3 = 0.0;
cout << "please  enter 3 numbers! " << endl;
cin >> dnumber1;
cin >> dnumber2;
cin >> dnumber3;
double daverage = (dnumber1 + dnumber2 + dnumber3) / 3;
cout << "the average of the numbers are: " << daverage << endl;

system("PAUSE");
return 0;
}

Cosmic, that works thanks.

Edit: Thanks D4rk. I know what my mistake was now. Smile
No worries man
*Goes back to reading*

Snake Wrote:
*Goes back to reading*


I'll join you *grabs favorite yellow book*

*reads favorite geekier book*
*"reads" porn*
Maybe watching it might be a little better? Reading it would be slightly boring...

Wait how did we get from Programming to porn? GTFO! Toungue

Wenis Wrote:
*"reads" porn*


There are so many good free videos.......... I mean, programming tutorials

Snake Wrote:
daverage " (dnumber1 + dnumber2 + dnumber3) / 3;


I know it's already been answered, but my C++ is rusty and I wanted to see if I got this right. Is this what they corrected?

yeah, there were double-quotes where there were supposed to be equals operators.
Pages: 1 2
Reference URL's