d06 ex00 fini
This commit is contained in:
@@ -2,27 +2,21 @@
|
||||
#include <string>
|
||||
#include "convert.h"
|
||||
|
||||
bool isElse(std::string str) {
|
||||
std::cout << B_RED << str << CYAN " is not valid type for this exercise" RESET "\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool (*checkFunc[])(std::string str) =
|
||||
{
|
||||
checkChar,
|
||||
checkInt,
|
||||
checkFloat,
|
||||
checkDouble,
|
||||
isElse
|
||||
};
|
||||
|
||||
void convert(std::string str) {
|
||||
|
||||
std::cout << B_BLUE << str << RESET "\n";
|
||||
std::cout << "\n" B_BLUE << str << RESET "\n";
|
||||
int size = sizeof(checkFunc) / sizeof(checkFunc[0]);
|
||||
|
||||
for (int it = 0; it < size; it++)
|
||||
if ((*checkFunc[it])(str))
|
||||
break;
|
||||
std::cout << "\n";
|
||||
return ;
|
||||
std::cout << B_RED "is not valid type for this exercise" RESET "\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user