Logic Gates Calculator Program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Logic Gates Calculator Program

Code not working, don't know why. It says I have to change it from string to bool but when I change it it says me to change from bool to string, like a loop. Please help, just starting, need it for some practice, I have made other projects, but less complex. For some context, the program is made to calculate the result of different types of logic gates. You have to enter the type name and the binary number and with a algorithm it gets a result. That's what I want to make. The texts and the calculations aren't finished. Here's the code: https://code.sololearn.com/cP0Lv8d8JUAj/?ref=app

28th Mar 2022, 7:36 PM
Wiki
3 Answers
+ 1
Still not working Jayakrishna🇮🇳
28th Mar 2022, 9:05 PM
Wiki
+ 1
What is your update code? First apply for a single operation.. what you are trying exactly for a sample..? edit: Wiki ReadLine() reads a line of string... if you are need int value then convert to int. you case is a string value, and your input number is a int value then why don't you use a separate variable? how can you store different type values in a single type variable.. Take two variables and use == opearator instead of = in comparison..
28th Mar 2022, 9:19 PM
Jayakrishna 🇮🇳
0
case "not": type = Convert.ToBoolean(Console.ReadLine()); here type is string variable. You can't store bool value in it. if(type = 0) // here you are using = assignment operator , for comparison use quality comparison opearator == ie type==0 again comparing string with integer, invalid. { All the same changes needed.. hope now you can make corrections... edit: actually, you have same logic for any input.. what's your input and expected output..? rethink about logic..
28th Mar 2022, 7:51 PM
Jayakrishna 🇮🇳