programming

Create the logic for a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to a method that squares the number and to a method that cubes the number. The program displays the results before reprompting the user. Create the two methods that square and cube a number passed to them, and then return the calculated value.

  1. 👍 0
  2. 👎 0
  3. 👁 291
  1. #include <iostream.h>
    #include <conio.h>

    void main()
    {
    clrscr();
    int x = 10;
    int y = 2;
    int sum, difference, product, quotient;
    sum = x + y;
    difference = x - y;
    product = x * y;
    quotient = x / y;
    cout << "The sum of " << x << " & " << y << " is " << sum << "." << endl;
    cout << "The difference of " << x << " & " << "y << is " << difference << "." << endl;
    cout << "The product of " << x << " & " << y << " is " << product << "." << endl;
    cout << "The quotient of " << x << " & " << y << " is " << quotient << "." << endl;
    getch();
    }

    1. 👍 0
    2. 👎 0

Respond to this Question

First Name

Your Response

Similar Questions

  1. Programming

    Write a pseudocode to represent the logic of a program that allows a user to enter an hourly pay rate and hours worked. The program outputs the user's gross pay

  2. Programming

    Draw a flowchart or write pseudo code to represent the logic of a program that allows the user to enter values for the current year and the user’s birth year. The program outputs the age of the user this year. Preferably a

  3. Ic

    Write an application that prompts the user for two integers and then prompts the user to enter an option as follows: 1 to add the two integers, 2 to subtract the second integer from the first, 3 to multiply the integers, and 4 to

  4. java programming

    1. Time Calculator Write a program that asks the user to enter a number of seconds. • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the

  1. intro to computer programming

    Write a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount. Your program should use a

  2. C++

    // Program: name of program // Author: your name // Date Written: date you began writing the program /* Abstract: Brief description of the program */ Include in-line comments in the body of your program. You can convert

  3. CIS

    Draw a flowchart or write pseudocode to represent the logic of a program that allows the user to enter a value. The program multiplies the value by 10 and outputs the result.

  4. Programming and Design

    Draw the hierarchy chart and design the logic for a program that calculates the projected cost of an automobile trip. Assume that the user's car travels 20 miles per gallon of gas. Design a program that prompts the user for a

  1. writting a program

    Speed of Sound. Sound travels through air as a result of collisions between the molecules in the air. The temperature of the air affects the speed of the molecules, which in turn affects the speed of sound. The velocity of sound

  2. programming

    create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. create a separate method to do the calculation and return the result

  3. programming

    Write a program which allows user to enter 10 student names and scores for Java programming 1 and Java programming 2. Allow user to choose which course they want to enter the record for. Use the loop to ask input from user. The

  4. programming

    Write a program that plays a simple dice game between the computer and the user. It uses an unusual dice that has 12 sides, with numbers that start from 10. When the program runs, a loop should repeat 5 times. Each iteration of

You can view more similar questions or ask a new question.