#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
int main()
{
double num = 0;
double highest = 0;
std::string unit = "";
std::vector<double> v;
std::cout << "Please, input number and a unit (m, cm, in, ft): ";
while (std::cin >> num, std::cin >> unit)
{
std::cout << num << "\t" << unit << std::endl;
if (unit != "m" || unit != "cm" || unit != "in" || unit != "ft")
{
std::cout << "Please, input correct unit: m, cm, in, ft." << std::endl;
break;
}
if (unit == "m")
{
num = num * 100;
}
else if (unit == "in")
{
num = num * 2.54;
}
else if (unit == "ft")
{
num = num * 12 * 2.54;
}
v.push_back(num);
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++)
{
highest = v[i];
}
std::cout << "The lowest number is: " << v[0] << std::endl
<< "The highest number is: " << highest << std::endl
<< "The vector size is: " << v.size() << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxzdHJpbmc+CgppbnQgbWFpbigpCnsKCWRvdWJsZSBudW0gPSAwOwoJZG91YmxlIGhpZ2hlc3QgPSAwOwoJc3RkOjpzdHJpbmcgdW5pdCA9ICIiOwoJc3RkOjp2ZWN0b3I8ZG91YmxlPiB2OwoJc3RkOjpjb3V0IDw8ICJQbGVhc2UsIGlucHV0IG51bWJlciBhbmQgYSB1bml0IChtLCBjbSwgaW4sIGZ0KTogIjsKCXdoaWxlIChzdGQ6OmNpbiA+PiBudW0sIHN0ZDo6Y2luID4+IHVuaXQpCgl7CgkJc3RkOjpjb3V0IDw8IG51bSA8PCAiXHQiIDw8IHVuaXQgPDwgc3RkOjplbmRsOwoKCQlpZiAodW5pdCAhPSAibSIgfHwgdW5pdCAhPSAiY20iIHx8IHVuaXQgIT0gImluIiB8fCB1bml0ICE9ICJmdCIpCgkJewoJCQlzdGQ6OmNvdXQgPDwgIlBsZWFzZSwgaW5wdXQgY29ycm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