#ifndef interface_h
#define interface_h
#include <iostream>
#include <string>
bool interface(const std::string command, const std::string text, int &number1, double &number2);
bool interface(const std::string command, const std::string text, int &number1);
bool interface(const std::string command, const std::string text);
bool is_number(const std::string text);
double to_double(const std::string text);
bool interface(const std::string command, const std::string text, int &number1, double &number2) {
bool result = false;
if (command == text) {
std::string param1, param2;
std::cin >> param1 >> param2;
if (is_number(param1) && is_number(param2)) {
number1 = to_double(param1);
number2 = to_double(param2);
result = true;
}
}
return result;
}
bool interface(const std::string command, const std::string text, int &number1) {
bool result = false;
if (command == text) {
std::string param1;
std::cin >> param1;
if(is_number(param1)) {
number1 = to_double(param1);
result = true;
}
}
return result;
}
bool interface(const std::string command, const std::string text) {
bool result = false;
if (command == text) {
result = true;
}
return result;
}
bool is_number(const std::string text) {
char *num;
std::strtod(text.c_str(), &num);
return *num == 0;
}
double to_double(const std::string text) {
char *tmp;
return strtod(text.c_str(), &tmp);
}
#endif /* interface_h */
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}