Files
42_INT_09_piscine_cpp/d06/ex00/srcs/convert.cpp
2022-03-07 22:30:41 +01:00

29 lines
525 B
C++

#include <iostream>
#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";
int size = sizeof(checkFunc) / sizeof(checkFunc[0]);
for (int it = 0; it < size; it++)
if ((*checkFunc[it])(str))
break;
std::cout << "\n";
}