146 lines
2.3 KiB
C++
146 lines
2.3 KiB
C++
#include <iostream>
|
|
#include <string>
|
|
|
|
void convert(std::string str);
|
|
|
|
// 2^24 = 16777216;
|
|
// 2^31 = 2147483648
|
|
// first char printable "!" -> 21 (space -> 20)
|
|
|
|
#define MAX_INT "2147483647"
|
|
#define MIN_INT "-2147483648"
|
|
#define MAX_INT_1 "2147483648"
|
|
#define MIN_INT_1 "-2147483649"
|
|
#define MAX_FLOAT_INT_PRECISION "16777216"
|
|
|
|
int main(int ac, char **av) {
|
|
|
|
if (ac > 1)
|
|
{
|
|
convert(av[1]);
|
|
return 0;
|
|
}
|
|
|
|
// char
|
|
convert("!");
|
|
convert("\"");
|
|
convert("#");
|
|
convert("$");
|
|
convert("%");
|
|
convert("&");
|
|
convert("'");
|
|
convert("(");
|
|
convert(")");
|
|
convert("*");
|
|
convert("+");
|
|
convert(",");
|
|
convert("-");
|
|
convert(".");
|
|
convert("/");
|
|
convert(":");
|
|
convert(";");
|
|
convert("<");
|
|
convert("=");
|
|
convert(">");
|
|
convert("?");
|
|
convert("@");
|
|
convert("A");
|
|
convert("B");
|
|
convert("C");
|
|
convert("D");
|
|
convert("E");
|
|
convert("F");
|
|
convert("G");
|
|
convert("H");
|
|
convert("I");
|
|
convert("J");
|
|
convert("K");
|
|
convert("L");
|
|
convert("M");
|
|
convert("N");
|
|
convert("O");
|
|
convert("P");
|
|
convert("Q");
|
|
convert("R");
|
|
convert("S");
|
|
convert("T");
|
|
convert("U");
|
|
convert("V");
|
|
convert("W");
|
|
convert("X");
|
|
convert("Y");
|
|
convert("Z");
|
|
convert("[");
|
|
convert("\\");
|
|
convert("]");
|
|
convert("^");
|
|
convert("_");
|
|
convert("`");
|
|
convert("a");
|
|
convert("b");
|
|
convert("c");
|
|
convert("d");
|
|
convert("e");
|
|
convert("f");
|
|
convert("g");
|
|
convert("h");
|
|
convert("i");
|
|
convert("j");
|
|
convert("k");
|
|
convert("l");
|
|
convert("m");
|
|
convert("n");
|
|
convert("o");
|
|
convert("p");
|
|
convert("q");
|
|
convert("r");
|
|
convert("s");
|
|
convert("t");
|
|
convert("u");
|
|
convert("v");
|
|
convert("w");
|
|
convert("x");
|
|
convert("y");
|
|
convert("z");
|
|
convert("{");
|
|
convert("|");
|
|
convert("}");
|
|
convert("~");
|
|
// int
|
|
convert("0");
|
|
convert("-42");
|
|
convert("42");
|
|
convert(MAX_INT);
|
|
convert(MIN_INT);
|
|
convert(MAX_INT_1);
|
|
convert(MIN_INT_1);
|
|
convert(MAX_FLOAT_INT_PRECISION);
|
|
// float
|
|
convert("0.0f");
|
|
convert("-4.2f");
|
|
convert("4.2f");
|
|
convert("-inff");
|
|
convert("+inff");
|
|
convert("nanf");
|
|
convert(MAX_INT".0f");
|
|
convert(MIN_INT".0f");
|
|
convert(MAX_INT_1".0f");
|
|
convert(MIN_INT_1".0f");
|
|
convert(MAX_FLOAT_INT_PRECISION".0f");
|
|
//double
|
|
convert("0.0");
|
|
convert("-4.2");
|
|
convert("4.2");
|
|
convert("-inf");
|
|
convert("+inf");
|
|
convert("nan");
|
|
convert(MAX_INT".0");
|
|
convert(MIN_INT".0");
|
|
convert(MAX_INT_1".0");
|
|
convert(MIN_INT_1".0");
|
|
convert(MAX_FLOAT_INT_PRECISION".0");
|
|
|
|
return 0;
|
|
}
|
|
|