Jump to content

My code doesn't work - Barnacules video tutorial.

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;// HelloWorldnamespace JerrysCoolApp{    //Class (contains functionality)    class Program    {        // Function (entry point)        static void Main(string[] args)        {            Console.WriteLine("Type a number, any number?");            ConsoleKeyInfo keyInfo = Console.ReadKey();                        if( keyInfo.KeyChar == 'a');            (                Console.WriteLine("That is not a number! KNOCK IT OFF NOW!");            )            Console.WriteLine("Did you type {0}", keyInfo.KeyChar.ToString());        }    }}

This is supposed to give me a command prompt, but it isn't. 

Ryzen 7600X | MSI Trio X 3080 | 3440x1440p asus vg34vql1b | Antec HCG 850 | 1TB WD Blue SSD | 500GB Aorus Elite | Asus B650 Strix A

Link to post
Share on other sites

Did you select command prompt ?

Have you launched it ?

CPUIntel 4670k  Motherboard - Gigabyte GA-Z87X-D3H  RAMKingston HyperX 8GB  GPU - EVGA 780  Case - Fractal Design Define R4    Storage - 2TB WD Black, Samsung 840 Evo 128GB     PSU - Corsair RM650  Display -  Benq XL2430T and Acer S235HL  Cooling - CM Hyper 212 Evo  Keyboard - Corsair K95  Mouse - Razer Deathadder  Sound - Sennheiser HD 558                                 Mic - Blue Snowball  Phone- OnePlus One  Tablet - Nvidia Shield

Link to post
Share on other sites

 

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;// HelloWorldnamespace JerrysCoolApp{    //Class (contains functionality)    class Program    {        // Function (entry point)        static void Main(string[] args)        {            Console.WriteLine("Type a number, any number?");            ConsoleKeyInfo keyInfo = Console.ReadKey();                        if( keyInfo.KeyChar == 'a');            (                Console.WriteLine("That is not a number! KNOCK IT OFF NOW!");            )            Console.WriteLine("Did you type {0}", keyInfo.KeyChar.ToString());        }    }}

This is supposed to give me a command prompt, but it isn't. 

 

 

What happens when you run it?

Link to post
Share on other sites

 

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;// HelloWorldnamespace JerrysCoolApp{    //Class (contains functionality)    class Program    {        // Function (entry point)        static void Main(string[] args)        {            Console.WriteLine("Type a number, any number?");            ConsoleKeyInfo keyInfo = Console.ReadKey();                        if( keyInfo.KeyChar == 'a');            (                Console.WriteLine("That is not a number! KNOCK IT OFF NOW!");            )            Console.WriteLine("Did you type {0}", keyInfo.KeyChar.ToString());        }    }}

This is supposed to give me a command prompt, but it isn't. 

 

mine didnt work either, it said cannot find output directory or something or other

My Setup :P

Spoiler

Skylake: I7-6700|MSI B150 GAMING M3|16GB GSKILL RIPJAWS V|R9 280X (WILL BE 1070)|CRUCIAL MX300 + WD BLACK 1TB

 

 

Link to post
Share on other sites

if( keyInfo.KeyChar == 'a');            (                Console.WriteLine("That is not a number! KNOCK IT OFF NOW!");            )

needs to be

if( keyInfo.KeyChar == 'a');            {                Console.WriteLine("That is not a number! KNOCK IT OFF NOW!");            }

then it should work

 

 

Those two are the same thing... did you mean to remove the semi-colon after the if condition?

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×