Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <iostream>
- using namespace std;
- #include <iomanip>
- #include <math.h>
- #include <cmath>
- #include <string>
- int main()
- {
- int badtries;
- cin >> badtries;
- int tempscore;
- string lastname;
- string name;
- int tries = 0;
- int badscore = 0;
- double sum = 0;
- while (badscore < badtries) {
- getline(cin, name);
- getline(cin, name);
- if (name == "Enough") {
- cout << "Average score: " << fixed << setprecision(2) << sum / tries << endl;
- cout << "Number of problems: " << tries << endl;
- cout << "Last problem: " << lastname << endl;
- break;
- }
- lastname = name;
- cin >> tempscore;
- if (tempscore <= 4) {
- badscore += 1;
- }
- if (badscore >= badtries) {
- cout << "You need a break, " << badscore << " poor grades." << endl;
- }
- tries++;
- sum += tempscore;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement