Thread: Newbie Question-While/If?

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    2

    Question Newbie Question-While/If?

    Hi. I'm brand new and have a question on a program to convert temperature scales. The user is prompted to enter temperatures and the scale (F or C). The program converts, displays, and prompts the user if another conversion is needed. How are these decisions made in the program? With while or if statements? do these work with letters like F, C, Y, and N. Program also needs to recognize upper or lower case letters in the input by the user. Thanks, Dime

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    3
    you can write a do while statement

    do
    {
    your conversion code
    cout << "Would you like to try again? (Y or N)"<< endl;
    cin >> UserContinue;
    }
    while (toupper (UserContinue) == 'Y');


    the toupper makes the y or n capital when entered by the user
    the do/ while will loop the program till the user enters n

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    2

    Smile dime

    Thanks Tina!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 04:43 AM
  2. C prog newbie question
    By Draginzuzu in forum C Programming
    Replies: 1
    Last Post: 02-03-2003, 06:45 PM
  3. a stupid question from a newbie
    By newcomer in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2003, 04:38 PM
  4. confusion with integers (newbie question)
    By imortal in forum C Programming
    Replies: 7
    Last Post: 12-06-2002, 04:09 PM
  5. newbie class templates question
    By daysleeper in forum C++ Programming
    Replies: 2
    Last Post: 09-18-2001, 09:50 AM