One More Brian boggler

Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.

Comments

  • : Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.
    :
    [green]
    Trust me this isn't a brain teaser. This is very easy to do but no one here is going to do your homework.
    [/green]

  • i did not ask anyone to do my homework, i asked for help


    : : Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.
    : :
    : [green]
    : Trust me this isn't a brain teaser. This is very easy to do but no one here is going to do your homework.
    : [/green]
    :
    :

  • : i did not ask anyone to do my homework, i asked for help
    :
    :
    : : : Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.
    : : :
    : : [green]
    : : Trust me this isn't a brain teaser. This is very easy to do but no one here is going to do your homework.
    : : [/green]
    : :
    : :
    :
    [green]
    Ok, what is powers then? Powers are just repeated multiplication of the same number. 2^0=1...2^1=2...2^2 power is the same as 2x2 and 2^3 power is 2x2x2, so what is the difficulty here?
    [/green]


  • : : i did not ask anyone to do my homework, i asked for help
    : :
    : :
    : : : : Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.
    : : : :
    : : : [green]
    : : : Trust me this isn't a brain teaser. This is very easy to do but no one here is going to do your homework.
    : : : [/green]
    : : :
    : : :
    : :
    : [green]
    : Ok, what is powers then? Powers are just repeated multiplication of the same number. 2^0=1...2^1=2...2^2 power is the same as 2x2 and 2^3 power is 2x2x2, so what is the difficulty here?
    : [/green]
    :
    :
    :
    writing the program, i am new to this stuff, i attend strayer Un. no need for you to be so smart and nast. i just needed help, u don't have to help me, it's o.k.

  • : : : i did not ask anyone to do my homework, i asked for help
    : : :
    : : :
    : : : : : Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.
    : : : : :
    : : : : [green]
    : : : : Trust me this isn't a brain teaser. This is very easy to do but no one here is going to do your homework.
    : : : : [/green]
    : : : :
    : : : :
    : : :
    : : [green]
    : : Ok, what is powers then? Powers are just repeated multiplication of the same number. 2^0=1...2^1=2...2^2 power is the same as 2x2 and 2^3 power is 2x2x2, so what is the difficulty here?
    : : [/green]
    : :
    : :
    : :
    : writing the program, i am new to this stuff, i attend strayer Un. no need for you to be so smart and nast. i just needed help, u don't have to help me, it's o.k.
    :
    :
    [green]
    I would have more sympathy for your plight but you haven't even tried coding it and posting your problems with it. Post some code and people will help.
    [/green]

  • [b][red]This message was edited by AsmGuru62 at 2006-7-16 4:58:19[/red][/b][hr]
    : : : : i did not ask anyone to do my homework, i asked for help
    : : : :
    : : : :
    : : : : : : Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.
    : : : : : :
    : : : : : [green]
    : : : : : Trust me this isn't a brain teaser. This is very easy to do but no one here is going to do your homework.
    : : : : : [/green]
    : : : : :
    : : : : :
    : : : :
    : : : [green]
    : : : Ok, what is powers then? Powers are just repeated multiplication of the same number. 2^0=1...2^1=2...2^2 power is the same as 2x2 and 2^3 power is 2x2x2, so what is the difficulty here?
    : : : [/green]
    : : :
    : : :
    : : :
    : : writing the program, i am new to this stuff, i attend strayer Un. no need for you to be so smart and nast. i just needed help, u don't have to help me, it's o.k.
    : :
    : :
    : [green]
    : I would have more sympathy for your plight but you haven't even tried coding it and posting your problems with it. Post some code and people will help.
    : [/green]
    :
    :
    [blue]Begin with breaking this into small steps:

    1. Propmt the user - print the text on console and then get user input into a variable, so you can do calculations with it. If you do that for both base and exponent, you should have the two variables filled and ready for a loop.


    2. And now the multiplication stage - it is a simple loop, but you need to be careful here. Look at the 2^3 example: 2 x 2 x 2 - how many multiplications it does? Two times. It means that the number of multiplications to do is (EXPONENT-1) times, so if user entered EXPONENT=5 - you need to perform 4 multiplications. Now, does it work in every situation? What happens, if user entered 2^0. By our logic - we need to multiply it -1 times, which does not make sense. In this case simply return a value of 1, because any value in EXP=0 will give result=1.

    3. Print the result out. I suppose it is not very hard.

    Not sure how to help more without actually writing code... can you start? ..and we will try to help. Find any C++ link on the web and find how to print to screen, take user input and make loops.[/blue]


  • : [b][red]This message was edited by AsmGuru62 at 2006-7-16 4:58:19[/red][/b][hr]
    : : : : : i did not ask anyone to do my homework, i asked for help
    : : : : :
    : : : : :
    : : : : : : : Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.
    : : : : : : :
    : : : : : : [green]
    : : : : : : Trust me this isn't a brain teaser. This is very easy to do but no one here is going to do your homework.
    : : : : : : [/green]
    : : : : : :
    : : : : : :
    : : : : :
    : : : : [green]
    : : : : Ok, what is powers then? Powers are just repeated multiplication of the same number. 2^0=1...2^1=2...2^2 power is the same as 2x2 and 2^3 power is 2x2x2, so what is the difficulty here?
    : : : : [/green]
    : : : :
    : : : :
    : : : :
    : : : writing the program, i am new to this stuff, i attend strayer Un. no need for you to be so smart and nast. i just needed help, u don't have to help me, it's o.k.
    : : :
    : : :
    : : [green]
    : : I would have more sympathy for your plight but you haven't even tried coding it and posting your problems with it. Post some code and people will help.
    : : [/green]
    : :
    : :
    : [blue]Begin with breaking this into small steps:
    :
    : 1. Propmt the user - print the text on console and then get user input into a variable, so you can do calculations with it. If you do that for both base and exponent, you should have the two variables filled and ready for a loop.
    :
    :
    : 2. And now the multiplication stage - it is a simple loop, but you need to be careful here. Look at the 2^3 example: 2 x 2 x 2 - how many multiplications it does? Two times. It means that the number of multiplications to do is (EXPONENT-1) times, so if user entered EXPONENT=5 - you need to perform 4 multiplications. Now, does it work in every situation? What happens, if user entered 2^0. By our logic - we need to multiply it -1 times, which does not make sense. In this case simply return a value of 1, because any value in EXP=0 will give result=1.
    :
    : 3. Print the result out. I suppose it is not very hard.
    :
    : Not sure how to help more without actually writing code... can you start? ..and we will try to help. Find any C++ link on the web and find how to print to screen, take user input and make loops.[/blue]
    :
    :
    :

    [green]
    A couple more things you should also keep in mind, negative powers and fractional powers. Negative powers are the same as positive powers but you are dividing 1 by it or 2^(-2)= 1/2^2. Fractional powers can be converted into roots or 4^(1/2)=sq. root(4) or 4^(2/4)=4th root(4^2). Simplify fractional powers before figuring. For instance 4^(1/2+3/6)=4^(1/2+1/2)=4^(1)=4. 4^(3+1/4)=4^(12/4+1/4)=4^(13/4)=4th root(4^13).
    [/green]

  • : : [b][red]This message was edited by AsmGuru62 at 2006-7-16 4:58:19[/red][/b][hr]
    : : : : : : i did not ask anyone to do my homework, i asked for help
    : : : : : :
    : : : : : :
    : : : : : : : : Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.
    : : : : : : : :
    : : : : : : : [green]
    : : : : : : : Trust me this isn't a brain teaser. This is very easy to do but no one here is going to do your homework.
    : : : : : : : [/green]
    : : : : : : :
    : : : : : : :
    : : : : : :
    : : : : : [green]
    : : : : : Ok, what is powers then? Powers are just repeated multiplication of the same number. 2^0=1...2^1=2...2^2 power is the same as 2x2 and 2^3 power is 2x2x2, so what is the difficulty here?
    : : : : : [/green]
    : : : : :
    : : : : :
    : : : : :
    : : : : writing the program, i am new to this stuff, i attend strayer Un. no need for you to be so smart and nast. i just needed help, u don't have to help me, it's o.k.
    : : : :
    : : : :
    : : : [green]
    : : : I would have more sympathy for your plight but you haven't even tried coding it and posting your problems with it. Post some code and people will help.
    : : : [/green]
    : : :
    : : :
    : : [blue]Begin with breaking this into small steps:
    : :
    : : 1. Propmt the user - print the text on console and then get user input into a variable, so you can do calculations with it. If you do that for both base and exponent, you should have the two variables filled and ready for a loop.
    : :
    : :
    : : 2. And now the multiplication stage - it is a simple loop, but you need to be careful here. Look at the 2^3 example: 2 x 2 x 2 - how many multiplications it does? Two times. It means that the number of multiplications to do is (EXPONENT-1) times, so if user entered EXPONENT=5 - you need to perform 4 multiplications. Now, does it work in every situation? What happens, if user entered 2^0. By our logic - we need to multiply it -1 times, which does not make sense. In this case simply return a value of 1, because any value in EXP=0 will give result=1.
    : :
    : : 3. Print the result out. I suppose it is not very hard.
    : :
    : : Not sure how to help more without actually writing code... can you start? ..and we will try to help. Find any C++ link on the web and find how to print to screen, take user input and make loops.[/blue]
    : :
    : :
    : :
    :
    : [green]
    : A couple more things you should also keep in mind, negative powers and fractional powers. Negative powers are the same as positive powers but you are dividing 1 by it or 2^(-2)= 1/2^2. Fractional powers can be converted into roots or 4^(1/2)=sq. root(4) or 4^(2/4)=4th root(4^2). Simplify fractional powers before figuring. For instance 4^(1/2+3/6)=4^(1/2+1/2)=4^(1)=4. 4^(3+1/4)=4^(12/4+1/4)=4^(13/4)=4th root(4^13).
    : [/green]
    :
    :


    I know it goes something like this.... but kinda of confused..

    #include <iostream // Header for basic
    input/output routines

    using std:: cout; //program uses cout
    using std:: ebd1; // All programs have a tope level routine called main.

  • : : : [b][red]This message was edited by AsmGuru62 at 2006-7-16 4:58:19[/red][/b][hr]
    : : : : : : : i did not ask anyone to do my homework, i asked for help
    : : : : : : :
    : : : : : : :
    : : : : : : : : : Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.
    : : : : : : : : :
    : : : : : : : : [green]
    : : : : : : : : Trust me this isn't a brain teaser. This is very easy to do but no one here is going to do your homework.
    : : : : : : : : [/green]
    : : : : : : : :
    : : : : : : : :
    : : : : : : :
    : : : : : : [green]
    : : : : : : Ok, what is powers then? Powers are just repeated multiplication of the same number. 2^0=1...2^1=2...2^2 power is the same as 2x2 and 2^3 power is 2x2x2, so what is the difficulty here?
    : : : : : : [/green]
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : writing the program, i am new to this stuff, i attend strayer Un. no need for you to be so smart and nast. i just needed help, u don't have to help me, it's o.k.
    : : : : :
    : : : : :
    : : : : [green]
    : : : : I would have more sympathy for your plight but you haven't even tried coding it and posting your problems with it. Post some code and people will help.
    : : : : [/green]
    : : : :
    : : : :
    : : : [blue]Begin with breaking this into small steps:
    : : :
    : : : 1. Propmt the user - print the text on console and then get user input into a variable, so you can do calculations with it. If you do that for both base and exponent, you should have the two variables filled and ready for a loop.
    : : :
    : : :
    : : : 2. And now the multiplication stage - it is a simple loop, but you need to be careful here. Look at the 2^3 example: 2 x 2 x 2 - how many multiplications it does? Two times. It means that the number of multiplications to do is (EXPONENT-1) times, so if user entered EXPONENT=5 - you need to perform 4 multiplications. Now, does it work in every situation? What happens, if user entered 2^0. By our logic - we need to multiply it -1 times, which does not make sense. In this case simply return a value of 1, because any value in EXP=0 will give result=1.
    : : :
    : : : 3. Print the result out. I suppose it is not very hard.
    : : :
    : : : Not sure how to help more without actually writing code... can you start? ..and we will try to help. Find any C++ link on the web and find how to print to screen, take user input and make loops.[/blue]
    : : :
    : : :
    : : :
    : :
    : : [green]
    : : A couple more things you should also keep in mind, negative powers and fractional powers. Negative powers are the same as positive powers but you are dividing 1 by it or 2^(-2)= 1/2^2. Fractional powers can be converted into roots or 4^(1/2)=sq. root(4) or 4^(2/4)=4th root(4^2). Simplify fractional powers before figuring. For instance 4^(1/2+3/6)=4^(1/2+1/2)=4^(1)=4. 4^(3+1/4)=4^(12/4+1/4)=4^(13/4)=4th root(4^13).
    : : [/green]
    : :
    : :
    :
    :
    : I know it goes something like this.... but kinda of confused..
    :
    : #include <iostream // Header for basic
    : input/output routines
    :
    : using std:: cout; //program uses cout
    : using std:: ebd1; // All programs have a tope level routine called main.
    :
    :
    [green]
    Don't worry about your input routine, that can be worked out later when your powers routine is working. Concentrate on the powers routine then incorporate input.
    [/green]

  • : : [b][red]This message was edited by AsmGuru62 at 2006-7-16 4:58:19[/red][/b][hr]
    : : : : : : i did not ask anyone to do my homework, i asked for help
    : : : : : :
    : : : : : :
    : : : : : : : : Write a progtam that raises an integer to a positive integer power. The program should prompt the user to enter the base and the exponent. the program should calulate the powe by multiplying base by itseld exponent times. Finally, the program show display the results. Test your results by making it calculate 2^5 and 5 ^4.
    : : : : : : : :
    : : : : : : : [green]
    : : : : : : : Trust me this isn't a brain teaser. This is very easy to do but no one here is going to do your homework.
    : : : : : : : [/green]
    : : : : : : :
    : : : : : : :
    : : : : : :
    : : : : : [green]
    : : : : : Ok, what is powers then? Powers are just repeated multiplication of the same number. 2^0=1...2^1=2...2^2 power is the same as 2x2 and 2^3 power is 2x2x2, so what is the difficulty here?
    : : : : : [/green]
    : : : : :
    : : : : :
    : : : : :
    : : : : writing the program, i am new to this stuff, i attend strayer Un. no need for you to be so smart and nast. i just needed help, u don't have to help me, it's o.k.
    : : : :
    : : : :
    : : : [green]
    : : : I would have more sympathy for your plight but you haven't even tried coding it and posting your problems with it. Post some code and people will help.
    : : : [/green]
    : : :
    : : :
    : : [blue]Begin with breaking this into small steps:
    : :
    : : 1. Propmt the user - print the text on console and then get user input into a variable, so you can do calculations with it. If you do that for both base and exponent, you should have the two variables filled and ready for a loop.
    : :
    : :
    : : 2. And now the multiplication stage - it is a simple loop, but you need to be careful here. Look at the 2^3 example: 2 x 2 x 2 - how many multiplications it does? Two times. It means that the number of multiplications to do is (EXPONENT-1) times, so if user entered EXPONENT=5 - you need to perform 4 multiplications. Now, does it work in every situation? What happens, if user entered 2^0. By our logic - we need to multiply it -1 times, which does not make sense. In this case simply return a value of 1, because any value in EXP=0 will give result=1.
    : :
    : : 3. Print the result out. I suppose it is not very hard.
    : :
    : : Not sure how to help more without actually writing code... can you start? ..and we will try to help. Find any C++ link on the web and find how to print to screen, take user input and make loops.[/blue]
    : :
    : :
    : :
    :
    : [green]
    : A couple more things you should also keep in mind, negative powers and fractional powers. Negative powers are the same as positive powers but you are dividing 1 by it or 2^(-2)= 1/2^2. Fractional powers can be converted into roots or 4^(1/2)=sq. root(4) or 4^(2/4)=4th root(4^2). Simplify fractional powers before figuring. For instance 4^(1/2+3/6)=4^(1/2+1/2)=4^(1)=4. 4^(3+1/4)=4^(12/4+1/4)=4^(13/4)=4th root(4^13).
    : [/green]
    :
    :


    Another usefull tip (or maybe not..., who knows):

    [code]
    ground^exponent = exp(exponent * log(ground));
    [/code]
    This works for all positive ground-values and all exponents :)

    Good luck, Pruyque
    :wq
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories