c# - Logical Proposition -
hello , first of sorry bad english...i ask here cause last chance homework done.my homework must : have prove inside ( parentheses must match ) true , if 1 word inside () small letter wrong example
(!a) - true (its proposition)
(a&b) - true
or
(! ( a-> b ) v (! (a | b) ) ) - true
i manage make few example work in particular case let me show i'v done :
console.writeline("enter proposition: "); string userinput = console.readline(); switch (userinput.length) { case 1: checkbigandsmallletters(userinput); break; case 5: check5(userinput); break; case 8: check8(userinput); break; case 9: check9(userinput); break; case 11: check11(userinput); break; case 13: check13(userinput); break;
and on until 19 length of strings made...here of methods :
static void checkbigandsmallletters(string input) { int valor = input[0]; switch (valor) { case 60 90 because big letters in ascii(binary) console.writeline(input + " proposition) static void check5(string input) { try { int valor = input[0] + input[1] + input[2] + input[3] + input[4]; if(input[0] == 40 && letters(input[1]) == 1 && signs(input[2]) == 1 && letters(input[3]) == 1 && input[4] == 41) { console.writeline(input + " proposition"); } else { console.foregroundcolor = consolecolor.red; console.writeline(input + " not proposition"); } } catch(exception) { console.foregroundcolor = consolecolor.red; console.writeline(input + " not proposition"); } }
and on goes methods strings length 19.
so made works teacher said said hard coded want me make more logical because works particular cases, wants works everything.can guys give me ideas homework or exemples tried @ regex , stack examples don't know how use them well. , wish day.
i think best stop programming immediately. on blocking track here. should grab bunch of post-its , split problem in pieces , start thinking , how can combine these pieces program.
start thinking 'for' loops. start first letter check take next , on.
then can start programming again....
Comments
Post a Comment