Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- void calculate(char E, char G, char F, char S, char EG, char EF, char GS) {
- int workers = 0;
- workers += (E - '0' + G - '0' + F - '0' + S - '0') - (EG - '0' + EF - '0' + GS - '0');
- cout << "Total amount of government workers is " << workers;
- }
- int main() {
- char E, G, F, S, EG, EF, GS;
- cout << "How many people speak English?: ";
- cin >> E;
- cout << "How many people speak German?: ";
- cin >> G;
- cout << "How many people speak French?: ";
- cin >> F;
- cout << "How many people speak Spanish?: ";
- cin >> S;
- cout << "How many people speak English and German?: ";
- cin >> EG;
- cout << "How many people speak English and French?: ";
- cin >> EF;
- cout << "How many people speak German and Spanish?: ";
- cin >> GS;
- calculate(E, G, F, S, EG, EF, GS);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement