Загрузить файлы в «/»
This commit is contained in:
55
task3.cpp
Normal file
55
task3.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <iostream>
|
||||
#include <clocale>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int c;
|
||||
cout << "Menu:" << endl;
|
||||
cout << "1. Income and delays -> lines of code" << endl;
|
||||
cout << "2. Lines of code and desired salary -> delay" << endl;
|
||||
cout << "3. Lines of code and delays -> salary" << endl;
|
||||
cin >> c;
|
||||
|
||||
int l;
|
||||
int t;
|
||||
int s;
|
||||
|
||||
switch (c) {
|
||||
case 1:
|
||||
cout << "Enter the desired income ($): ";
|
||||
cin >> s;
|
||||
cout << "Enter the number of tardies: ";
|
||||
cin >> t;
|
||||
s += (t / 3) * 20;
|
||||
l = (s / 50.0) * 100;
|
||||
cout << "Vasyl needs to write " << l << " lines of code." << endl;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
cout << "Enter the number of lines of code: ";
|
||||
cin >> l;
|
||||
cout << "Enter your desired salary ($): ";
|
||||
cin >> s;
|
||||
int b;
|
||||
b = (l / 100) * 50;
|
||||
cout << "Vasya can be late at most "
|
||||
<< ((b - s) / 20) * 3 << " time(s)." << endl;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
cout << "Enter the number of lines of code: ";
|
||||
cin >> l;
|
||||
cout << "Enter the number of tardies: ";
|
||||
cin >> t;
|
||||
s = (l / 100) * 50 - (t / 3) * 20;
|
||||
if (s > 0)
|
||||
cout << "Vasyl's salary: " << s << " $" << endl;
|
||||
else
|
||||
cout << "Vasya will not be paid anything." << endl;
|
||||
break;
|
||||
|
||||
default:
|
||||
cout << "Invalid choice." << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user