小编Sky*_*xer的帖子

什么是C++编译器错误"看起来像一个函数定义,但没有参数列表;" 意思?

#include <iostream>
#include <fstream>

using namespace std;

int main
{
    int num1, num2;
    ifstream infile;
    ostream outfile;

    infile.open("input.dat");
    outfile.open("output.dat");

    infile >> num 1 >> num 2;

    outfile << "Sum = " << num1 + num2 << endl;

    infile.close()
    outfile.close()
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

这就是我所做的,当我编译它时,我得到了这个错误

error C2470: 'main' : looks like a function definition, but there is no
parameter list; skipping apparent body
Run Code Online (Sandbox Code Playgroud)

请不要恨我:(我是这个计算机科学的新手......

c++

8
推荐指数
2
解决办法
5347
查看次数

标签 统计

c++ ×1