where:
- _Str: A string in which to write.
- _Count: The number of characters to read from strbuf.
- _Delim: The character that should terminate the read if it is encountered before _Count.
Exercise:
#include <iostream> #include <conio.h> using std::cin; using std::cout; using std::endl; int main(){ cout << "http://dev-microsoft.blogspot.com/" << endl; cout << "Exercise cin.getline()" << endl << endl; const int MAX = 10; char CharArray[MAX]; int ch; do{ cout << "Type something: " << endl; cin.getline(&CharArray[0], 5, '\n'); cout << "CharArray: " << CharArray << endl << endl; cout << "Retry? <y/n>" << endl; ch = _getch(); ch = toupper( ch ); }while(ch == 'Y'); return 0; }
No comments:
Post a Comment