Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
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
Hangman
Code
defined(FOO)
C++ MSVN Compiler Type Check
5sdgts
C++ exception
constexpr internal error
Problem_onoff_3
#18
du