Problem!! can anyone solve it?

Am making a program that calculates the fourth root of a number, it should ask wether user wants to continue. if yes then asks for another number.An error at cin.get. I cant tell why!


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

int findFourthRoot( int);

int main( )
{
int number , choice;
cout << "This program is used to calculate the fourth root of a number \n";
cout << "Enter a number to calculate its fourth root! ";

cin >> number;
cout << "\n";
cout << "The fourth root of " << number << " is : "
<< findFourthRoot(number);
cout << endl;
cout << "-------------------------------------------------";
cout << endl;
cout << "Find fourth root of another number? Y/N ";
cout << endl;
cin.get(choice);
if (choice == 'Y' || choice = 'y')
{
cout << "Enter a number to calculate its fourth root! ";
cin >> number;
cout << findFourthRoot(number);
}
else cout << "Thank you !!"
cout << endl;
cout << endl;
cout << endl;
system("pause");
return 0;
}

// function definition
int findFourthRoot(int a)
{
return (sqrt(sqrt(a))) ;
}
What error is it?
Is it because you declared 'choice' as an int? also a little further down you'll want to type: if (choice == 'Y' || choice == 'y')

And you are missing a few ';'s.
Topic archived. No new replies allowed.