Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string name, winner = "";
- getline(cin , name);
- int num, points = 0;
- while (name != "Stop") {
- int sum = 0;
- for (int i = 0; i < name.length(); i++) {
- cin >> num;
- int z = name[i];
- if (num == z) {
- sum += 10;
- }
- else {
- sum += 2;
- }
- }
- if (sum >= points) {
- winner = name;
- points = sum;
- }
- cin.ignore();
- getline(cin, name);
- }
- cout << "The winner is " << winner << " with " << points << " points!\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement