Guest User

03. Online Education

a guest
May 3rd, 2018
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data