C/C++の宿題を片付け ..
185:デフォルトの名無しさん
07/09/24 15:04:33
>>163
#include <iostream>
#include <cstdio>
#include <cmath>
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はおかしすぎる
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5282日前に更新/230 KB
担当:undef