I Have Problem Making This Program .Anybody please make this program for me.THANKS

Write a program to calculate a^b without using any built in function. The values of a and b are to be taken from the user.

We do not do your homework for you. What have you done so far? If you are having a problem with something that is one thing. To ask for us to do it for you is completly different.

I ve done it so far i am not able to understand the logic??

Post the code you have so far, so we can see what you have done. Then Daniweb members can try to help you.

A suggestion for NewinC++, it would be a good idea to start with an algorithm prior implementation, then you can understand how your code works.

-ikel

# include<iostream>

Using namespace std;
Void main()

int a,b,ans;
cout<<"Enter The Number a="<<a<<endl;
cin>>a;
cout<<"Enter The Number b="<<b<<endl;
cin>>b;
ans=a^b;

But i want that my program takes input till user want to input?

NewInC++,

That's what I suggested earlier, do the algorithm, then do the coding. You said

you want program to takes input till user want to input?

``````Begin MyUserInputProgram

Compute based on first and second input
While user want to enter in again,
Compute the results again

End MyUserInputProgram
``````

Well, I can see a solution here. Maybe not the best, but by looking at this super simple algorithm, it helps a lot.
-ikel

OK thanx .but how to use While?

Oh, actually, I was expecting you to say "wait... why do you use while if other alternatives exist?" I can do something like this too

``````Begin MyUserInputProgram

Say hello to user
Compute based on first and second input
Ask user if he/she want to continue
If user want to enter in again,
Compute the results again
Does the user want to repeat operation?
Else
Say bye-bye

End MyUserInputProgram
``````

To use while is simple.

``````while(a_condition == true) {
//...do something
}
``````

Getting the idea to use it often is not simple.