Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Hangman
#include <iostream> #include <string.h> const int MAXLEN=256; class Model { char word[MAXLEN]; char chosen[MAXLEN]; int wrong, right; char disp[MAXLEN]; public: int restart(char* word) { strcpy(this.word,word); wrong=0; right=0; for(int i=0;word[i];i++){ disp[i]='_'; disp[i+1]=0; } *chosen=0; return 0; } int guess(char c, int from=0) { char*f; int k; if(f=strchr(word+from,c)) { k=f-word; right++; return guess(c,k+1)+1; } else return 0; } Model(int wordlen, int maxguesses) int main() { std::cout << "Hello, world!\n"; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Eight Queen
variable template not supported
rvalue lifetime
multiplie linked list numbers
du
additional layer of indirection
Regex pipe and tabs c++
Unicode_wcout
Even Odd
Thing v.2
stackse - search stackoverflow differently
Please log in to post a comment.