d06 ex00 fini

This commit is contained in:
hugogogo
2022-03-08 16:51:12 +01:00
parent 4ee3ae3e7d
commit 315f62eb96
8 changed files with 158 additions and 90 deletions

View File

@@ -13,10 +13,6 @@ void fromChar(char c) {
std::cout << std::setw(7) << std::left << "double" << B_CYAN << d << RESET "\n";
}
char toChar(std::string str) {
return str[0];
}
bool isChar(std::string str) {
if (str.length() != 1 || isdigit(str[0]))
return false;
@@ -25,15 +21,12 @@ bool isChar(std::string str) {
bool checkChar(std::string str) {
char c;
std::cout << "char\n";
if (str.length() != 1 || isdigit(str[0]))
return false;
c = str[0];
c = toChar(str);
std::cout << B_YELLOW << str << RESET " is a char"
<< " of value "
<< B_CYAN << c << RESET << "\n";
std::cout << B_CYAN << c << B_YELLOW " char" RESET "\n";
fromChar(c);
return true;