Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * Solution to homework assignment 1
- * Introduction to programming course
- * Faculty of Mathematics and Informatics of Sofia University
- * Winter semester 2021/2022
- *
- * @author Monika Dobrinova
- * @idnumber 8MI0600008
- * @task 3
- * @compiler VC
- *
- */
- #include <iostream>
- using namespace std;
- int main()
- {
- int Tabs;
- cin >> Tabs;
- int Salary;
- cin >> Salary;
- if (Tabs >= 1 && Tabs <= 10 && Salary >= 700 && Salary <= 1500)
- {
- for (int i = 1; i <= Tabs; i++)
- {
- char Site;
- cin >> Site;
- if (Site == 'f')
- {
- Salary -= 150;
- if (Salary > 0)
- {
- continue;
- }
- else
- {
- cout << "You have lost your salary." << " ";
- }
- }
- else if (Site == 'i')
- {
- Salary -= 100;
- if (Salary > 0)
- {
- continue;
- }
- else
- {
- cout << "You have lost your salary." << " ";
- }
- }
- else if (Site == 'r')
- {
- Salary -= 50;
- if (Salary > 0)
- {
- continue;
- }
- else
- {
- cout << "You have lost your salary." << " ";
- }
- }
- else if (Site == 'd')
- {
- int Same = Salary;
- Salary = Same;
- }
- }
- if (Salary > 0)
- {
- cout << Salary << " ";
- }
- }
- else
- {
- cout << "-1" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment