i am attending a online competition. my code is working in my compilier visual studio 2013. but the online judges giving me compilation error. here is my code.
#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;
}
can anyone please tell me solution? I will be thankful to you. }