Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 5:82076030b7ce, committed 2019-03-01
- Comitter:
- LithiumSR
- Date:
- Fri Mar 01 15:21:53 2019 +0000
- Parent:
- 4:979929c6d0b7
- Commit message:
- Add support for the ASCII format when the users responds
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Mar 01 00:42:06 2019 +0000 +++ b/main.cpp Fri Mar 01 15:21:53 2019 +0000 @@ -56,7 +56,8 @@ while(1){ if (pc.readable()){ timeout_triggered = false; - return pc.getc(); + char got = pc.getc(); + return atoi(&got); } else if (timeout_triggered) { timeout_triggered = false; return 0; @@ -113,7 +114,7 @@ printf("No questions avaialable!\n"); print_score(map); break; - } + } game_progress = true; vector<string> ret = get_answers_vector(domanda); printf("%s\n",ret.at(0).c_str()); @@ -131,14 +132,14 @@ if (answer!=0 && ret.at(--answer)==correct_answer) { printf("CORRECT!\n"); map[user]++; - } + } else printf("WRONG!\n"); game_progress = false; user++; if (user == users) { user=0; round++; - } + } } // Check if game has ended