Commit 4da5dfb7 authored by mary.zaqaryan's avatar mary.zaqaryan

Mary Zaqaryan Exercise_05_14 Version3

parent f46bfc8f
......@@ -8,17 +8,12 @@ main()
int productNumber;
std::cin >> productNumber;
if (productNumber < 0 && productNumber > 5) {
std::cerr << "Error 1: Invalid product number";
return 1;
}
int productAmount;
std::cin >> productAmount;
if (productAmount < 0) {
std::cerr << "Error 2: Amount can't be negative.";
return 2;
std::cerr << "Error 1: Amount can't be negative.";
return 1;
}
switch (productNumber) {
......@@ -27,6 +22,7 @@ main()
case 3: sum += productAmount * 9.98; break;
case 4: sum += productAmount * 4.49; break;
case 5: sum += productAmount * 6.87; break;
default: std::cerr << "Error 2: Invalid product number"; return 2;
}
}
std::cout << "Sum: " << sum << std::endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment