0

How can i run this code?

Using System; Namespace Studio1 { Class ageLogin { Public static void Main(string[] args) { String data; Console.Writeline("birthdate"); data = Console.ReadLine(); If (data = 18) { Console.WriteLine(" you must be 18+ for log in"); } Else { Console.WriteLine("access granted"); } } }

17th May 2017, 12:04 PM
daniele di marino
6 Respuestas
+ 2
Then you have to cast the type, like luka wrote. But the code structure isn't set functional. I would prefer to use a template of Visual Studio as the Console App...So you wouldn't have problems in forms of dependencies in the beginning.
17th May 2017, 4:35 PM
Ernst Belar
Ernst Belar - avatar
+ 1
Ok taken the point. Some thoughts about: The differences between win and lin version of c# is the layer to the system. On linux i think they are using gtk+ as example. But the .net classes should be the same and so the dependencies as the namespaces. I would take the hull you find here everywhere. And then using it without a template. Worst case: using a text editor and then the csh compiler per console. If you won‘t find the hull of an empty program, just say it. And no, you don‘t have to make the whole course first. A programmer isn‘t ready anywhere in things of learning. Learning is living.
18th May 2017, 11:31 AM
Ernst Belar
Ernst Belar - avatar
0
Sorry actually this is the real "if" string If (data < 18)
17th May 2017, 12:06 PM
daniele di marino
0
@ernst the thing is that i started just last week to learn c#... i have to finish the course to know everything, and i'm using a macbook to program with xamarin, and don't know how to use properly all the templates :)
17th May 2017, 8:30 PM
daniele di marino