i need puzzle of c#: fill in blanks game , answers can 1 of following 7 spaces
blanks _ , highlighted & there 7 of them
the next part of puzzle c# function can call replace loop , insert satisfy ‘result == ?’ in code below:
var answer = "please me puzzle please"; var words = new[] { "please", "help", "me", "with", "this", "puzzle", "please" }; var result = ? if ( result == answer ) console.writeline(“correct!”);
im guessing need somekind of linq query fit in, how ?
i'm mind blown since im not fan of c#
solved. try out few things, other things pretty logical (e.g. while(wordcount < 4)
due wordcount
incrementing). other things modulo arithmetic stuff make challenge little bit harder. (like x % 1
true
).
using system; class programm { static void main() { var answer = "please me puzzle please"; var words = new[] { "please", "help", "me", "with", "this", "puzzle", "please" }; var result = ""; var wordcount = 0; (var icount = 12; icount > 0; icount--) { while (wordcount < 4) //less because word count get's incremented { if (icount % 1 == 0) { result += words[wordcount]; result += " "; wordcount++; } if ((icount * 6) == 24) { result += words[wordcount]; result += " "; wordcount++; } icount--; } if (icount % 3 != 1) continue; result += words[wordcount]; if (wordcount != 6) result += " "; wordcount += 1; } console.writeline("result: " + result); if ( result == answer ) console.writeline("correct!"); else console.writeline("fail!"); } }
Comments
Post a Comment