Â
In this, we are going to see Functions, the program is based on function which Calculates, Profit or Loss.
The code given below can be used for TURBO C++ Compiler:-
#include<iostream.h>
#include <math.h>
// this is necessary for power, sqrt etc...
#include<conio.h>
int power()
{
int a = 13;
int b = 2;
int c = pow(a, b); // a^b <== pow(a,b)
cout<<"a ^ b = "<<c<<endl;
float d = 13.2;
float e = 2.5;
float f = pow(d, e);
cout<<"d ^ e = "<<f<<endl;
return 0;
}
void main()
{
clrscr();
power();
getch();
}
The code given below can be used for g++/gcc Compiler:-
#include<iostream>
#include <math.h>
// this is necessary for power, sqrt etc...
using namespace std;
int power()
{
int a = 13;
int b = 2;
int c = pow(a, b); // a^b <== pow(a,b)
cout<<"a ^ b = "<<c<<endl;
float d = 13.2;
float e = 2.5;
float f = pow(d, e);
cout<<"d ^ e = "<<f<<endl;
return 0;
}
int main()
{
power();
return 0;
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP