line of programming that keeps giving a syntax error at end of input
This is the line that keeps giving me the error
else
{ ires3 = big % small;
This is the whole code
#include <iostream>
using namespace std;
int main(void)
{
int i1, i2, big, small, ires1, ires2, ires3;
cout<< "Input the 1st integer: ";
cin>>i1;
if (i1<0) // Is i1 positive?
{ cout<< "Input must be non-negative. Try again! \n";
return 1;
}
else
{ cout<< "Input 2nd integer: ";
cin>>i2;
}
if (i2<0) // Is i2 positive?
{ cout<< "Input must be non-negative. Try again! \n";
return 1;
}
else
{ if (i1==i2) // Are the two numbers equal?
{cout<<"The two numbers are the same!\n";
}
else
{ if (i1>i2) // Is i1 bigger than i2?
{ i1=big;
i2=small;
}
else
{ i2=big;
i1=small;
} // i2 is bigger than i1.
}
}
cout<<"The bigger number is: " <<big<< "\n";
cout<<"The smaller number is: " <<small<< "\n";
if (small!= 0)
{ ires1 = big/ small; //ratio
cout<<"The ratio is: "<<ires1<< "\n";
}
else
{ cout<<"The smaller number is zero, so no ratio can be calculated";
}
ires2 = i1*i1+i2*i2; // quadrature
cout<<"The quadrature sum is: "<<ires2<< "\n";
if (small==0)
{ return 0;
}
else
{ ires3 = big % small;
/* if (ires3==0)
{ cout<<small<<"is a perfect divisor of"<<big<< "\n";
}
else
{ cout<<small<<"is not a perfect divisor of"<<big<< "\n";
}
*/
return 0;
}
|