【发布时间】:2017-04-03 03:25:51
【问题描述】:
我正在参加在线比赛。我的代码在我的编译器 Visual Studio 2013 中工作。但在线判断给我编译错误。 这是我的代码。
#include<iostream>
#include<string>
#include<cmath>
#include<fstream>
using namespace std;
void main() {
int first_number;
int second_number;
string str;
char ch;
int count = 0;
ifstream yfile("q4.txt");
while (!yfile.eof())
{
yfile >>first_number;
if (first_number < 0)
first_number = abs(first_number);
yfile >> ch;
yfile >> second_number;
if (second_number < 0)
second_number = abs(second_number);
int gcd;
for (int i = 1; i <= first_number&&i <= second_number; i++){
if (first_number%i == 0 && second_number%i == 0){
gcd = i;
}
}
cout << "Output: " << gcd << endl;
}
谁能告诉我解决方案?我会感谢你的。 }
【问题讨论】:
-
在线评委遇到什么编译错误?
-
他们只是响应“无编译错误”
-
void main() {这是未定义的行为。请使用程序的有效入口点之一。例如int main() {. -
你的
{比}多 -
好的..我正在检查
标签: c++ compiler-errors