c++ syntax error...HELP!!
red% g++ assignment2a.cpp
assignment2a.cpp: In function 'int main()':
assignment2a.cpp:33: syntax error before '{' token
assignment2a.cpp: At global scope:
assignment2a.cpp:37: syntax error before '<<' token
assignment2a.cpp:44: syntax error before '<<' token
my code is
#include <iostream>
using namespace std;
int main(void)
{ int i1, i2, small, big;
cout << "Input the 1st integer: ";
cin >> i1;
if (i1 < 0)
{ cout << "Input must be non-negative. Try again!\n";
return 1;
}
cout << "Input the 2nd integer: ";
cin >> i2;
if (i2 < 0)
{ cout << "Input must be non-negative. Try again!\n";
return 1;
}
if (i1 == i2)
{ cout << "The two numbers are the same!\n";
big = i1;
small = i2;
}
else
{ if (i1 > i2)
{ big = i1;
small = i2;
}
else (i1 < i2)
{ big = i2;
small = i1;
}
}
cout << "The bigger number is" << big << ", the smaller number is" << small << "\n";
if (small == 0)
{ cout << "The smaller number is 0, so no ratio is calculated,";
}
else
{ cout << "The ratio is" << big/small << ", ";
}
cout << "the quadrature sum is" << big*big + small*small << "\n";
if (big%small == 1)
{ cout << small << "is not a perfect divisor of" << big << "\n";
}
else
{ cout << small << "is a perfect divisor of" << big << "\n";
}
return 0;
}
what am i doing wrong??
|