Last active
December 16, 2015 05:09
-
-
Save ernado/5382467 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
const int BUFF = 256; | |
using namespace std; | |
string read(const string& message) { | |
string s; | |
cout << message; | |
getline(cin, s); | |
return s; | |
} | |
void main() { | |
system("chcp 1251 > nul"); | |
string name; | |
name = read("Введите имя пользователя: "); | |
cout << "Введено: " << name << endl; | |
system("pause"); | |
} | |
/* Выведет: | |
Введите имя пользователя: Машка Котович | |
Введено: Машка Котович | |
Для продолжения нажмите любую клавишу . . . | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Функция чтения строки вместе с пробелами