Mercurial > repo
comparison interps/sadol/Console.cpp @ 996:859f9b4339e6
<Gregor> tar xf egobot.tar.xz
author | HackBot |
---|---|
date | Sun, 09 Dec 2012 19:30:08 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
995:6883f5911eb7 | 996:859f9b4339e6 |
---|---|
1 /* | |
2 * BDSM2 | |
3 * Author: Adam Sawicki | |
4 * http://www.regedit.risp.pl | |
5 * mailto:regedit@risp.pl | |
6 */ | |
7 #include "pch.hpp" | |
8 #include <iostream> | |
9 #include "Console.hpp" | |
10 | |
11 using std::cin; | |
12 using std::cout; | |
13 | |
14 char Console::InChar() | |
15 { | |
16 return (char)(unsigned char)cin.get(); | |
17 } | |
18 | |
19 void Console::InString(string *s) | |
20 { | |
21 std::getline(cin, *s); | |
22 } | |
23 | |
24 int Console::InInteger() | |
25 { | |
26 string s; | |
27 InString(&s); | |
28 return atoi(s.c_str()); | |
29 } | |
30 | |
31 double Console::InDouble() | |
32 { | |
33 string s; | |
34 InString(&s); | |
35 return atof(s.c_str()); | |
36 } | |
37 | |
38 void Console::OutInteger(int x) | |
39 { | |
40 cout << x; | |
41 } | |
42 | |
43 void Console::OutDouble(double x) | |
44 { | |
45 cout << x; | |
46 } | |
47 | |
48 void Console::OutString(const string &s) | |
49 { | |
50 cout << s; | |
51 } | |
52 | |
53 Console g_Console; |