C++ examples for File Stream:cin
Inputting characters using cin member function getline
#include <iostream> int main(int argc, const char *argv[]) { const int SIZE = 80; char buffer[SIZE]; // input characters in buffer via cin function getline std::cout << "Enter a sentence:" << std::endl; std::cin.getline(buffer, SIZE);/*from w ww .j a v a2 s . co m*/ // display buffer contents std::cout << "\nThe sentence entered is:" << std::endl << buffer << std::endl; return 0; }