0
I’m having the mistake:
* stack Smashing Detected *: terminated in my program
Use the compiler g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, here is the code:
#include <iostream>
using namespace std;
int main()<br>
{
int C[3], F[3];<br>
int Ct,Ft;<br>
cin >> C[3] >> F[3];
Ct = (C[1] * 3)+C[2];
Ft = (F[1] * 3)+F[2];
if ((Ct > Ft) || (Ct == Ft && C[3] > F[3]))
{
/* code */
cout << "C" << endl;
}else if ((Ft > Ct) || (Ft == Ct && F[3] > C[3]))
{
/* code */
cout << "F" << endl;
}else
{
cout << "=" << endl;
}
return 0;
}
The input I put is: 10 5 18 11 1 18, should return C, but it returns F.
Poxa thanks, I had forgotten that the arrays start at 0, I made the corrections and I got.
– user185489