Thread: Understanding the problem

  1. #1
    Registered User
    Join Date
    Nov 2015
    Posts
    1

    Understanding the problem

    Problem:If the value of the integer variable number is 2, square it. If it is 3, input a new value for number. If it is 4 or 5, multiply by 3 and display a new value. Write the appropriate C++ code using switch statement.**********question:-i don't understand the condition if it is 3, how should i input a new value for number?-if it is 4 or 5, should i display the answer when multiplied by 3?TIA.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    To me, this sounds like:

    Input number (i.e. ask user for a number)
    If number == 2, output 2^2
    If number == 3, input new number and repeat this whole sequence
    if number == 4, output 4*3
    if number == 5, output 5*3
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem in understanding the logic
    By baxy in forum C++ Programming
    Replies: 1
    Last Post: 09-09-2013, 06:41 AM
  2. Problem Understanding this
    By RA-3000 in forum C Programming
    Replies: 9
    Last Post: 06-13-2010, 04:07 AM
  3. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  4. problem understanding namespace
    By cages in forum C++ Programming
    Replies: 5
    Last Post: 06-27-2005, 05:56 AM

Tags for this Thread