Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <list>
- using namespace std;
- int main ()
- {
- int round;
- while (cin >> round) {
- if (round == -1){
- return 0;
- }
- char solution [2000], guess [2000];
- cin >> solution;
- cin >> guess;
- int length = strlen (solution);
- list <char> l (&solution [0], &solution [length]);
- int stroke = 0;
- length = strlen(guess);
- for (int i = 0; i < length; i++) {
- if (!l.empty()){
- int tempSize = l.size ();
- l.remove (guess [i]);
- if (tempSize == l.size ()){
- stroke++;
- }
- }
- else{
- break;
- }
- }
- cout << "Round " << round << endl;
- if (l.empty () && stroke < 7) {
- cout << "You win." << endl;
- }
- else if (!l.empty () && stroke < 7) {
- cout << "You chickened out." << endl;
- }
- else {
- cout << "You lose." << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement