Okay, its been a while since my last visit here..and yes I need your help with C++ Programming...
My grades were fine so that's all thanks to you guys....so here's my next question....
What is wrong with my code? My exponent displays a wrong number...
I used a for loop to calculate the power of a certain number cause using pow() is prohibited....I experimented on my loop and finally was able to arrive at this answer...So, whats wrong with it?
#include<iostream.h>
#include<conio.h>
int b, e, result=1;
void bande()
{
cout<< "Enter Base number:";
cin>>b;
cout<< "Enter Exponent:";
cin>>e;
clrscr();
}
void compt()
{
for(;e--;result*=b);
}
void display()
{
cout<< "Base "<<b<<"\n";
cout<< "Exponent "<<e<<"\n";
cout<< "Power: "<<result<<"\n";
}
void main()
{
bande();
compt();
display();
}