小编Dan*_*ise的帖子

为什么*=运算符没有按照我期望的方式运行?

#include <iostream>
using namespace std;

int main ()
{
    //If a triangle has a perimeter of 9 units, how many iterations(each iteration is 4/3 as much) would it take to obtain a perimeter of 100 units? (or as close to 100 as you can get?)
    double p = 9; int it = 0;
    for(p; p < 100; p = p * 4/3){
        cout << p << endl;
        it++;
    }
    cout << p << endl;
    cout << it << endl;
    system …
Run Code Online (Sandbox Code Playgroud)

c++ operators

13
推荐指数
1
解决办法
502
查看次数

标签 统计

c++ ×1

operators ×1