Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. void calculate(char E, char G, char F, char S, char EG, char EF, char GS) {
  6. int workers = 0;
  7. workers += (E - '0' + G - '0' + F - '0' + S - '0') - (EG - '0' + EF - '0' + GS - '0');
  8. cout << "Total amount of government workers is " << workers;
  9. }
  10.  
  11. int main() {
  12. char E, G, F, S, EG, EF, GS;
  13. cout << "How many people speak English?: ";
  14. cin >> E;
  15. cout << "How many people speak German?: ";
  16. cin >> G;
  17. cout << "How many people speak French?: ";
  18. cin >> F;
  19. cout << "How many people speak Spanish?: ";
  20. cin >> S;
  21. cout << "How many people speak English and German?: ";
  22. cin >> EG;
  23. cout << "How many people speak English and French?: ";
  24. cin >> EF;
  25. cout << "How many people speak German and Spanish?: ";
  26. cin >> GS;
  27.  
  28. calculate(E, G, F, S, EG, EF, GS);
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement