mirror of
https://github.com/pret/pokered.git
synced 2024-10-23 15:08:23 +00:00
6fe067d939
hg-commit-id: 5b445278c010
54 lines
994 B
C++
54 lines
994 B
C++
#include "Console.h"
|
|
|
|
using namespace std;
|
|
|
|
// Basic
|
|
void Console::Get(char* value)
|
|
{
|
|
cin >> value;
|
|
}
|
|
void Console::Get(string& value)
|
|
{
|
|
cin >> value;
|
|
}
|
|
void Console::Print(const char* value)
|
|
{
|
|
cout << value;
|
|
}
|
|
void Console::Error(const char* value)
|
|
{
|
|
cerr << value;
|
|
}
|
|
|
|
// Upper-Basic
|
|
void Console::PrintLn(const char* value)
|
|
{
|
|
Print(value);
|
|
cout << endl;
|
|
}
|
|
void Console::ErrorLn(const char* value)
|
|
{
|
|
Error(value);
|
|
cerr << endl;
|
|
}
|
|
|
|
// Higher
|
|
void Console::Ask(const char* question, char* answer)
|
|
{
|
|
Print(question);
|
|
Get(answer);
|
|
}
|
|
void Console::Ask(const char* question, string& answer)
|
|
{
|
|
Print(question);
|
|
Get(answer);
|
|
}
|
|
|
|
// Better Error Handling
|
|
int Console::atoi_ex(const char* input, bool supress)
|
|
{
|
|
//int convInp = atoi(input);
|
|
//if((supress == false) && (convInp == 0))
|
|
// PrintLn("Warning: the converted integer input is 0, this may not be what you intended");
|
|
// return convInp;
|
|
}
|