M
mahesh
Hi all,
I have following code that is supposed to increase the power by
specified value.
int main()
{
system("cls");
int i, exponent;
double base;
double new_base=0.0;
ofstream powerfile("power.txt",ios::app);
cout <<"Enter the base:\n";
cin >> base;
cout <<"Enter the exponent:\n";
cin >> exponent;
//cout << base;
for (i=0; i< exponent ; i++)
{
new_base = new_base + base;
}
cout <<"The final powered output is :\n" << new_base;
system("PAUSE");
return 0;
}
but the output that shows up in the screen is:
The final powered output is :
3.32222e-31204 (some weird value).
for every input.
What could be the reason for that??
Thanks in advance
I have following code that is supposed to increase the power by
specified value.
int main()
{
system("cls");
int i, exponent;
double base;
double new_base=0.0;
ofstream powerfile("power.txt",ios::app);
cout <<"Enter the base:\n";
cin >> base;
cout <<"Enter the exponent:\n";
cin >> exponent;
//cout << base;
for (i=0; i< exponent ; i++)
{
new_base = new_base + base;
}
cout <<"The final powered output is :\n" << new_base;
system("PAUSE");
return 0;
}
but the output that shows up in the screen is:
The final powered output is :
3.32222e-31204 (some weird value).
for every input.
What could be the reason for that??
Thanks in advance