Nor
Nor
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
it works now, thanks man
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
still doesnt work
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
so convert to int?
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
whats with that
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
the code im using
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
// START HERE Console.WriteLine("Welcome to this Math Quiz!"); Console.WriteLine("This is your first question"); // RNG Random rnd = new Random(); int random1 = rnd.Next(-100, 100); int random2 = rnd.Next(-100, 100); Console.WriteLine("{0} - {1}?", random1, random2); // Checks if answer is correct float answer = random1 - random2; string answeruser = Console.ReadLine(); Convert.ToInt32(answeruser); if (answeruser.Equals(answer)) { Console.WriteLine("Correct!"); } else { Console.WriteLine("False!"); }
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
still doesnt detect it as a correct answer
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
the second point is just a mistake
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
i wrote Convert.ToBoolean due to an error thats somehow fixxed now ´without it
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
i think convert works fine for my purposes, i just cant figure out why the code doesnt seem to detect the correct answer as correct
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
itellisense doesnt display it and its not registered as a command for some reason
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
it doesnt seem to detect the correct answer, it just prints false, even though the answer is correct
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
Convert works fine, now the issue seems to be that it cant make an "answer"
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
4.8 net c# 7.8? i think
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
Tryparse isnt a command in the version i use
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
Convert.ToInt32(answeruser) should work right?
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
@SinFluxx
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
// Checks if answer is correct int answer = random1 + random2; Convert.ToBoolean(answer); int answeruser = Console.ReadLine(); if (answeruser.Equals(answer)) { Console.WriteLine("Correct!"); } else { Console.WriteLine("False!"); } so this is the improved code, the issue now is that it cant convert "string" to "int", how do i fix this?
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
Equals(String)?
39 replies
CC#
Created by Nor on 9/2/2023 in #help
CS0120 - Object refrence required for the non static field, method, or property "object.Equals(obj)"
so what would i use to detect the user input?
39 replies