From 78d59b2d7dda1bc3e5eefa95ba9a5d035b87c0a5 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Fri, 19 Jun 2015 14:27:52 -0400 Subject: [PATCH] this is my hangman hw --- HangPerson/.DS_Store | Bin 0 -> 6148 bytes HangPerson/HangPerson/main.m | 42 ++++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 HangPerson/.DS_Store diff --git a/HangPerson/.DS_Store b/HangPerson/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..358988fe633090b1686f21d5d77e1143ae6781be GIT binary patch literal 6148 zcmeHKK}rNM5UkccEC{j(4<7RZVSf;o5j-yJ2b39E5oc#m7d+-Ye!*Ax8n0HTqwL@u z)Psn2L%K3achX%jNg9AGw#^)v0hqEWigrdshexOOit&Ufd5tA5af>^2*o-Xn8;3OZ zBb?!a5wEcu{|O#YGn0ln^~|cn_04*|s=KzgM3zrq@ol@RYPR<^@celAl2`cjzHQfh z+qb{kjX7E9uAKpAz!`7`{xbu-vsI=ChOV6fXTTYFXF$(~z@``rCc}JmP~{SUsL$vu z>}xHdKA~VNm<%~X5pyM)tCSK$%$?(**u{d$(A*)V_>i*mTk#@!cdj3@IV2job_Se* zAp`sNIn(?9l)ubqkw0|tFK56R_+t#nq*_%ACROg%59#S$8`#d-RMakMhr<5g5x@^U gM~?HP%?It%E*4CNx{8ixccMQ8G9j* int main(int argc, const char * argv[]) { @autoreleasepool { + // Start Code HERE + char hangManWord[8] = "zodiacs"; + char underLineWord[8] = "_______"; - // code goes here... - + int totalLife = 20; + char guess; + int numGuess; + int replace = 7; + + + for (numGuess = 0; numGuess < totalLife; numGuess++) { + printf("Please guess a Letter: "); + scanf("%c", &guess); + for (int i = 0; i < 7; i++) { + if (guess == hangManWord[i]) { + replace--; + char temp; + temp = hangManWord[i]; + hangManWord[i] = underLineWord[i]; + underLineWord[i] = temp; + printf("%s \n", underLineWord); + } + } + if (replace == 0){ + break; + } + + } + if (replace == 0) { + printf("You WON"); + } else { + printf("Sorry you LOST"); + } + + // End Code HERE } return 0; }