need some help

This is a discussion on need some help within the C++ Programming forums, part of the General Programming Boards category; Given a string variable s that has already been declared, write some code that repeatedly reads a value from standard ...

  1. #1
    Registered User
    Join Date
    Sep 2012
    Location
    Twentynine Palms, California, United States
    Posts
    1

    need some help

    Given a string variable s that has already been declared, write some code that repeatedly reads a value from standard input into s until at last a "Y" or "y"or "N" or "n" has been entered.

    i tried a bunch of things but i just cant get it to work if anyone could help i would appreciate it.thanks

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Glyfada,Athens
    Posts
    2,650
    Welcome to the forum

    Well what most people do is to post their attempt (usually a non-working one) and then everybody is trying to help

    Also learn that it is critical for the time and the chances you have to get a quick and exact (and of course correct) answer is heavily depended on how you ask the question.You say "..from stdin into s until.."
    Well,now i have to guess.You might want to say to append to the end of string.But why should i guess?Wouldn't it be nice to give a simple example just to make sure that even people like me would totally understand? In this way you avoid the case of bad guessing which leads to un-needed post and wasted time

  3. #3
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,529
    I don't think I have enough information. If I enter "Thursday" does it stop? The way you've posed the problem is deliberately confusing.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21