When I run this function, It gives me a 2 warning for setw(*torPtr - *harePtr)
and setw(*harePtr - *torPtr)
It said :
Arithmetic overflow: Using operator '-' on a 4-byte value and then casting the result to an 8-byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
How can I fix this please?
void Posi(const int* const tPtr,const int* const hPtr)
{
if (*hPtr == *tPtr) {
cout <<setw(*hPtr) << "bang!" << '\a';
}
else if (*hPtr < *tPtr) {
cout << setw(*hPtr) << 'H' << setw(*tPtr - *hPtr) << 'A';
}
else {
cout << setw(*tPtr) << 'T' << setw(*hPtr - *tPtr) << 'B';
}
}