Thread: need some help

  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
    Nice, France
    Posts
    2,694
    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
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    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