//P5.2
//Ahmad Furqan
//28-2-2013
#include <iostream>
#include <conio.h>
using namespace std;
double power(double num,int p);
double power(double num);
void main(void)
{
double num=3.154;
int p=4;
cout<<"1 "<<power(num,p)<<endl;
cout<<"2 "<<power(num)<<endl;
_getch();
}
double power(double num,int p)
{
double ans=1;
for(int i=0;i<p;i++)
{
ans*=num;
}
return ans;
}
double power(double num)
{
return num*num;
}
//Ahmad Furqan
//28-2-2013
#include <iostream>
#include <conio.h>
using namespace std;
double power(double num,int p);
double power(double num);
void main(void)
{
double num=3.154;
int p=4;
cout<<"1 "<<power(num,p)<<endl;
cout<<"2 "<<power(num)<<endl;
_getch();
}
double power(double num,int p)
{
double ans=1;
for(int i=0;i<p;i++)
{
ans*=num;
}
return ans;
}
double power(double num)
{
return num*num;
}
No comments:
Post a Comment