Hi all , i'm totally new to c++ ... i tried to make a program that have a correct Divide function ... my code was :
#include <iostream>
using namespace std;
double x,y,z,a ;
double divide (x,y)
{
if (x >= y){
x=z ;
z=y ;
y=x ;
return(x/y);
else
return(y/x);
}
}
int main()
{
double x,y,z ;
cout << "Enter x " <<endl;
cin >> x ;
cout << "Enter y " <<endl;
cin >> y ;
a = divide (x,y);
cout << a <<endl;
system("pause");
return 0;
}
and i got 2 errors :
expected `,' or `;' before '{' token
on the { line .. right under the double divide (x,y) line
and another error
`divide' cannot be used as a function
on the "a = divide (x,y); " line... and using Code::Blocks
help me plz i'm totally new to this :D note : if there're any programming errors beside those two plz tell me :)
thx