void powers()
{
int base;
int exponent;
double end;
while(base>-1);
{
cout<<"please enter a integer\n\n\t\t";
cin>> base;
cout<<"please enter a power\n\n\t\t";
cin>> exponent;
for(base=base; base<=-1; base++)
{
cout<<base*base;
}
}
_getch();
}
this is the assignment
• Write a function that will raise an integer value to the nth power. The user must enter the integer, and the power. The function must display the output in the following format:
xx raised to the power x = xx
For example, if the integer is 7, and the power is 2, the output would be:
7 raised to the power 2 = 49
The function should loop repeatedly until the user enters a negative number for the integer (the negative number is called a sentinel in computerese).
can someone plz help me or at least tell me what im doing wrong?
This post has been edited by Dark_Nexus: 16 December 2006 - 01:04 AM

New Topic/Question
Reply




MultiQuote



|