Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ericsondraal

Visual C++ help!

This topic is 5371 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am 13 and i am very new at c++ i have been using it for a few hours... i tryed to right a program but i got 1 error Could you PLZ!!!! HELP ME!! #include <iostream> #include <stdlib.h> using namespace std; { float x = 0; float y =0; int Number = 0; cout << "Enter 2 Numbers:" << endl; cin >> x >> y; cout << "What do you want to do with them?" << endl << "(1) Add (2) Subtract (3) Multibly (4) Divide (5) Cout" << endl; cin >> Number; if(Number == 1) { cout << endl << x + t < y)) { for( ; x > y ; --x) { cout << x << endl; } return 0; } return 0; }

Share this post


Link to post
Share on other sites
Advertisement

if(Number == 1)
{
cout << endl
<< x + t
< return 0;
}



Where it says "< return 0;" is your problem. Looks like you deleted a bit of code by accident. It should read:


if(Number == 1)
{
cout << endl
<< x + t
<< endl;
return 0;
}

Share this post


Link to post
Share on other sites
You should tell the exact error, too. (I see you already did )
However, I noticed your code has no main function. After using namespace std; instead of just a '{' there should be int main () { .
To keep the code formatted correctly, use the code -tag:

[ code ]
your code here...
[ /code ]

(remove the the spaces from the tags)

To get the nice highlighting code box, use the source -tag


[edited by - nonpop on March 27, 2004 4:41:09 PM]

[edited by - nonpop on March 27, 2004 4:43:10 PM]

Share this post


Link to post
Share on other sites
You don''t seem to have a main() method which is mandatory for all C++ applications (Win32 apps use a variant called WinMain()), underneath using namespace std; add this line after it but before the opening curly brace: int main(int argc, char **argv) this should solve the error.

Share this post


Link to post
Share on other sites
here it is it done
thanks for all the help!

#include <iostream>

using namespace std;
int main()
{
float x = 0;
float y =0;
int Number = 0;

cout << "Enter 2 Numbers:"
<< endl;

cin >> x >> y;

cout << "What do you want to do with them?"
<< endl
<< "(1) Add (2) Subtract (3) Multibly (4) Divide (5) Count"
<< endl;

cin >> Number;

if(Number == 1)
{
cout << endl
<< x + y
< return 0;
}
if(Number == 2)
{
cout << endl
<< x - y
<< endl;
return 0;
}
if(Number == 3)
{
cout << endl
<< x * y
<< endl;
return 0;
}
if(Number == 4)
{
cout << endl
<< x / y
<< endl;
return 0;
}
if((Number == 5) && (x <= y))
{
for( ; x < y ; ++x)
{
cout << x << endl;
}
cout << x << endl;
return 0;
}
if((Number == 5) && (x >= y))
{

for( ; x > y ; --x)
{
cout << x << endl;
}
cout << x << endl;
return 0;
}
return 0;
}

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!