how do I declare a whole program "int" from the begining

so I'm supposed to write a function for all of these but the last part will not compile. Any help would be appreciated

//notes
// void hello();
// void hello (string);
// double srqIt (double);
// double bigger (double, double);
// int power (int, int);
// bool isEven (int);
// int sqrIt(int);

#include<iostream>
#include<string>
using namespace std;

void hello();
void hello(string);
double sqrIt(double);
double bigger (double, double);
double power(double, double);
bool isEven(int);
int sqrIt(int);

void deeper()
{
cout<<"in deeper"<<endl;
}
void deep(int num=0)
{
while(num<=10)
{


cout<<"please enter a number larger than 10"<<endl;
cin>>num;
cout<<"in deepdeepsh*t"<<num<<endl;
num++;

}
deeper();


}
double power( double val, double Pow=0 )
{
if ( Pow <= 0 )
return 1;
return val * power( val, Pow-1 );
}
int main()
{
int input=0;
double Pow, value;
cout<<"enter a number"<<endl;
cin>>input;
deep(input);

cout << "Enter a value: ";
cin >> value;
cout << "Enter a power: ";
cin >> Pow;
cout << power( value, Pow ) << endl;

system("pause");
return 0;
}

void odd (double x);
void even (double x);

int main ()
{
int i;
do {
cout << "Please, enter number (0 to exit): ";
cin >> i;
odd (i);
} while (i!=0);
return 0;
}

void odd (int x)
{
if ((x%2)!=0) cout << "It is odd.\n";
else even (x);
}

void even (int x)
{
if ((x%2)==0) cout << "It is even.\n";
else odd (x);
}
Last edited on
You have
void odd (double x);
and then:
1
2
3
4
5
void odd (int x)
{
if ((x%2)!=0) cout << "It is odd.\n";
else even (x);
}


Is x and int or double? That discrepancy is the reason for your error.
ahh,i posted the wrong part. I corrected it to void odd( int x) but it still won't compile
I also see that you have int main() twice. That's certainly an issue.
Last edited on
Topic archived. No new replies allowed.