CPPForSchool.com: Flow of Control Set 2: Assignment 4

4. Two numbers are entered through the keyboard. Write a program to find the value of one number raised to the power of another.


Perhaps it is a cultural or language barrier, but I cannot help but find a bit of confusion here.  Needless to say, I believe the assignment is to build a program that takes user input and calculates the exponential value of the number.  The program will prompt the user for a number, followed by the exponent value.  From there, it will calculate both inputs into a product.  For example, the user inputs 3 followed by 2.  This equates to 3 to the power of 2 or simply "three squared".  The expected output would be 9, specifically 3 * 3 = 9.


With all that said, below is my source.  It is important to note that I had to include the math.h library in order to use the pow function.  Comparatively, my code is a bit more direct as opposed to the looping ordeal seen in the sample source and output.


















Comments

Popular posts from this blog

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 9

CPPForSchool.com: Array - Single Dimension Set 1 Assignment 6

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 8