Skip to content

Instantly share code, notes, and snippets.

@ernado
Last active December 16, 2015 05:09
Show Gist options
  • Save ernado/5382467 to your computer and use it in GitHub Desktop.
Save ernado/5382467 to your computer and use it in GitHub Desktop.
#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");
}
/* Выведет:
Введите имя пользователя: Машка Котович
Введено: Машка Котович
Для продолжения нажмите любую клавишу . . .
*/
@ernado
Copy link
Author

ernado commented Apr 14, 2013

Функция чтения строки вместе с пробелами

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment