Advertisement
Guest User

03. Online Education

a guest
May 3rd, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main() {
  5. string s;
  6. int site=0,line=0,people;
  7. for(int i=0;i<3;i++) {
  8.   cin>>s>>people;
  9.   if(s=="online") line+=people;
  10.   else site+=people;
  11. }
  12. if(site>600) { line+=(site-600); site=600; }
  13. cout<<"Online students: "<<line;
  14. cout<<endl<<"Onsite students: "<<site;
  15. cout<<endl<<"Total students: "<<line+site<<endl;
  16.   return false;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement