double mass;
cout << "Enter mass:";
cin >> mass;
int tonn = (int)mass;
double kg = (mass - tonn) * 1000;
int g = (kg-(int)kg)*1000+0.5;
cout << tonn << " t " << (int)kg << " kg " << g << " g" << endl;
system("pause");
cout << "Enter mass:";
cin >> mass;
int tonn = (int)mass;
double kg = (mass - tonn) * 1000;
int g = (kg-(int)kg)*1000+0.5;
cout << tonn << " t " << (int)kg << " kg " << g << " g" << endl;
system("pause");
Комментариев нет:
Отправить комментарий