Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int onlineStudents = 0, onsiteStudents = 0, studentCount;
- string educationForm;
- for (int i = 0; i < 3; i++) {
- cin >> educationForm;
- cin >> studentCount;
- if (educationForm == "online") {
- onlineStudents += studentCount;
- }
- else {
- onsiteStudents += studentCount;
- }
- }
- if (onsiteStudents > 600) {
- onlineStudents += onsiteStudents - 600;
- onsiteStudents = 600;
- }
- cout << "Online students: " << onlineStudents << endl
- << "Onsite students: " << onsiteStudents << endl
- << "Total students: " << onlineStudents + onsiteStudents << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement