int main() { using std::cin; using std::printf; using std::putchar; char *str[4] = {"Enter the base: ", "Enter the exponent: ", "%d to the %d power equals %.0lf.", "The square root of %d equals %1.2lf"}; int b,ex; double p,r; printf(str[0]); cin >> b; printf(str[1]); cin >> ex; printf(str[2],b,ex,pow(static_cast<double>(b),ex)); putchar('\n'); printf(str[3],b,sqrt(static_cast<double>(b))); putchar('\n');
return 0; } The square root of 3 equals 1.41はおかしすぎる