since few minutes I tried practice "static_cast" to convert from short variable to int variable, I wrote this trivial program to print the variables before using static_cast and after using static_cast in console screen, but the variable not converted..!
//EGYPT population | static cast
#include <iostream>
using namespace std;
int main()
{
short shortEgyPop = 80000000;
shortEgyPop = (shortEgyPop * 10)/10;
cout << "shortEgyPop = " << shortEgyPop << endl;
shortEgyPop = 80000000;
shortEgyPop = (static_cast<int>(shortEgyPop)*10)/10;
cout << "shortEgyPop = " << shortEgyPop << endl;
return 0;
}
And the following attachment includes my output, the second answer must be 80,000,000 not -19456 ..?