-
Newed Help
Here is my code and i have some errors like main not valid can someone tell me whats wrong...
I have been programming in OpenGL and WinAPI I forgot the Very Basics of why this could be wrong...
Let me know plz!
#include <iostream.h>
#include <math.h>
//////////////////////////
// Constants //
// AKA //
// Global Var's //
//////////////////////////
#define PI 3.1415926535f
//////////////////////////
// Functions //
//////////////////////////
basicinit(double a)
{
cout<<a<<endl;
return 0;
};
squareinit(double a)
{
if (a < 0)
{
cout<<"Complex Number detected";
return 0;
}
cout<< sqrt(a);
return 0;
};
exponentsinit(double a, double b)
{
if (b == 0)
{
cout<<"1"<<endl;
return 0;
}
if (b == 1)
{
cout<<a<<endl;
return 0;
}
if (b < 0)
{
if (b == -1)
{
cout<<"0"<<endl;
}
for( b = b + 1; b >= 0; b++)
{
cout<<a / a<<endl;
}
for ( b = b - 1; b <= 0; b--)
{
cout<<a * a<<endl;
}
return 0;
};
//////////////////////////
// Main Function //
//////////////////////////
int main()
{
//////////////////////////
// Variablles //
//////////////////////////
const i = sqrt(-1.0f);
double x;
double y;
double z;
int choose;
//////////////////////////
// To Do //
//////////////////////////
cout<<"Choose from menu"<<endl;
cout<<"1. Basic Arithmatic\n"
<<"2. Square roots\n"
<<"3. Exponents"<<endl;
cin>>choose;
if (choose == 1)
{
cout<<"Please input expression\n"
<<"Make Sure that there is only one variable and it is on the lone side of the equal\n"
<<"EXAMPLE: 1*2+3-2"<<endl;
cin>>x;
basicinit(x, NULL, NULL);
}
if (choose == 2)
{
cout<<"INsert the number you want to squeare root\n";
cin>>x;
squareinit(x);
}
if ( choose == 3)
{
cout<<"Enter the number you want to raise exponent then write the number you want to raise it to\n"
<<"Example First: 2 Second: 2 answer is 4 because 2 squared is 4"
<<"First: ";
cin>>x;
cout<<"\nSecond: ";
cin>>y;
exponentsinit(x,y);
}
return 0;
}
-
oops
Oops, I accidently Ctrl-V'ed Twice
-
I Registered
-
Umm... You might want to go back and study C++ again before continuing on with OpenGL and WinAPI.
Here are a few of the problems:
- None of your functions have a return type specified. In this case, they should all be 'int' since you are attempting to return 0.
- You have a semicolon after the last brace of one of your functions.
- You have no 'main'.
-
R U KDDING?
Umm, I have been programming OpenGL and Windows for at least 9 Months and I am very Excellent at it... I am currently working on a game called Dark Scape...
Read about it earlier in the Forum...............
-
I am not commenting on your knowledge of OpenGL or WinAPI. I was just suggesting that you may have an easier time with your projects if you are better at avoiding (and detecting) simple errors such as these.