hy

the function cin.getline() is used with following parameters...

cin.getline(char string[], int size , terminating character);

by default if u dont enter the third argument.. the terminating character will 
b taken as enter key..

the major difference b/w cin.get(); and cin.getline(); is that second one will 
remove the terminating characer from input stream..

e.g the enter key..(terminating character) will not be stored in input stream.. 
while using cin.getline();

eg.

    char name[256], title[256];
    cout << "Enter your name: ";
    cin.getline (name,256);  // enter will be taken as terminating character
    
    cout << "Enter your favourite movie: ";
    cin.getline (title,256, 'x'); // x will taken as terminating character
    cout << name << "'s favourite movie is " << title;


---
we can also remove the terminating character from stream by using..
cin.get(char string[],int size).get();



From: abraham_q01 <[email protected]>
To: [email protected]
Sent: Wed, December 9, 2009 11:28:55 PM
Subject: [c-prog] c++, cin.getline

  
[mod-- Why not start with...
<http://www.lmgtfy. com/?q=cin. getlin+string+ sample> --mod PN]

hi every one,
can any body kindly send me some examples for use of cin.getlin in strings.
i'll be greatfull,.

 




      

[Non-text portions of this message have been removed]

Reply via email to