1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

String Problem

Discussion in 'C++' started by Carlos, Mar 6, 2009.

  1. Carlos

    Carlos New Member

    Joined:
    Dec 5, 2008
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    none
    Hello! everyone , Can anyone tell me how take input of string, so that data after the space don't lose.

    whenever i input a string it take the first word and neglect the whole sentence.

    string str1;
    cin>>str1;
    cout <<str1;

    Thanx
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    use cin.getline();
     

Share This Page