what does cin.get function do??

Recommended Answers

All 4 Replies

It gets one character from the keyboard.

It gets one character from the keyboard.

Always one? This line is from the cplusplus.com example. I've never used it to get more than one myself:

cin.get (str,256);

Yes it can be used to extract more than one caracter. I always use cin.getline( ... ) for that since it has more options, you can tell it what terminating character to use.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.