EvgeniyGlazirin / oop

0 stars 0 forks source link

Замечания по FlipByte #2

Closed alexey-malov closed 6 years ago

alexey-malov commented 6 years ago
bool IsInputDataCorrect(int inputNumber) 
{
    bool CheckInputDataCorrection = true;
    if ((inputNumber < 0) || (inputNumber > 255))
    {
        std::cout << "Invalid argument value. It must be beetwen 0 and 255. \n";
        CheckInputDataCorrection = false;
    }
    return CheckInputDataCorrection;
}
alexey-malov commented 6 years ago
    int outputNumber = FlipByte(inputNumber);
alexey-malov commented 6 years ago
int StringToInteger(char* input) 
{
    try
    {
        int inputNumber = std::stoi(input);
        return (inputNumber);
    }
    catch (const std::exception& e)
    {
        std::cout << e.what() << std::endl;
        return 1;
    }
}

bool ConvertToByte(int inputNumber)
{
    if ((inputNumber < 0) || (inputNumber > 255))
    {
        std::cout << "Invalid argument value. It must be beetwen 0 and 255. \n";
        return false;
    }
    return true;
}

    int inputNumber = StringToInteger(argv[1]);
    if (!ConvertToByte(inputNumber))
    {
        return 1;
    }
alexey-malov commented 6 years ago
bool ConvertToByte(int inputNumber)
{
    if ((inputNumber < 0) || (inputNumber > 255))
    {
        std::cout << "Invalid argument value. It must be beetwen 0 and 255. \n";
        return false;
    }
    return true;
}