今天困扰着我的C ++

问题描述

正确的解决方案是什么? 什么是正确的解决方案? 正确的解决方法是什么?

我的代码(显然是错误的):

<iostream><fstream>库包括在内。

int main() {

    int num = 0;
    int totalCount = 0;
    std::ifstream inFile;
    double average = 0.0;
    int totalTwo = 0;
    double total = 0.0;
    const double VALUE_ONE = 858.5;

    std::cout << "What is the number?  ";
    std::cin >> num;
    std::cout << std::endl;

    inFile.open("numbers.txt");
    while (inFile >> num) {

        totalCount += num;
    }

    total =  num * VALUE_ONE;
    average = total/totalCount;
    totalTwo = total * num;

   

    inFile.close();

    return 0;
}

numbers.txt

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)