请问 C语言写 第八个 死活过不去。

P2433 【深基1-2】小学数学 N 合一

南道山___ @ 2021-06-13 15:38:30

printf("%.4f\n%.4f\n%.4f\n",10.0*3.141593,3.141593*25.0,(500.0/3)*3.141593);

上面是我第八道题的源代码 高手指点下!

by 所有人袛旳 @ 2021-06-13 15:41:26

建议手算答案呢!


by XYY1411 @ 2021-06-13 15:44:43

请直接使用 cout 输出答案

std::cout 有自己的保留位数机制。


by DIgnited @ 2021-06-13 15:52:08

建议手算


by chiyuye @ 2021-08-24 10:35:37

else if (T == 8)

{

const double pi=3.141593; cout<<pi10<<endl<<pi25<<endl<<4/3pi125; }


by Lucashuang @ 2021-09-26 21:17:48

#include<iostream>
#include<cstdio>
#include<math.h>
using namespace std;
int main(){
    int n;
    double pi = 3.141593;
    cin >> n;
    if(n == 1){
        cout << "I love Luogu!" << endl;
    } else if(n == 2){
        cout << "6 4" << endl;
    } else if(n == 3){
        cout << "3" << endl << "12" << endl << "2" << endl;
    } else if(n == 4){
        printf("%0.3lf" , 500.0 / 3);
    } else if(n == 5){
        cout << "15" << endl;
    } else if(n == 6){
        cout << sqrt(117) << endl;
    } else if(n == 7){
        cout << "110" << endl << "90" << endl << "0" << endl;
    } else if(n == 8){
        cout << 2 * pi * 5 << endl << pi * (5 * 5) << endl << (4.0 / 3) * pi * (5 * 5 * 5) << endl;
    } else if(n == 9){
        cout << "22" << endl;
    } else if(n == 10){
        cout << "9" << endl;
    } else if(n == 11){
        cout << 100.0 / (8 - 5) << endl;
    } else if(n == 12){
        cout << "13" << endl << "R" << endl;
    } else if(n == 13){
        cout << round(pow((4.0 / 3) * pi * (4 * 4 * 4 + 10 * 10 * 10) , 1.0 / 3)) << endl;
    } else if(n == 14){
        cout << "50" << endl;
    }
}

|