Jump to content
  • Advertisement
Sign in to follow this  
ThoughtCriminal

New to C#, probly dumb problem ahead:

This topic is 4122 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here's my code: using System; using System.Collections.Generic; using System.Text; namespace ConsoleLearning { class Program { static void Main(string[] args) { Console.SetWindowSize(80, 40); Console.SetBufferSize(160, 80); enum Letters {A=65,B,C,D,E,F,H,I,J,K}; int n = 0; do { for (int i = 0; i < 10; i++) { Console.CursorLeft = i; Console.CursorTop = i; // Console.Write((char)Letters]); } } while (n == 0); } } } Everyting was working fine until I added to line with the enum. Accoring to MSDN an enum is delared like this: enum Days {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri}; I really have no idea how to fix this, any help appreciated. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Alpha_ProgDes
you should be able to declare in or outside of main() shouldn't you?

No, 'enum' is a type declaration which cannot be done inside any method.

Share this post


Link to post
Share on other sites
Thank you, what is a type and what is not is still confusing to me.

Now I have what I wanted.

for (int i = 0; i < 10; i++)
{
Console.CursorLeft = i;
Console.CursorTop = i;

Console.Write(Letters.A+i);
}


Where is the help page for how to use code tags etc?


Share this post


Link to post
Share on other sites
Quote:
Original post by ThoughtCriminal
what is a type

Everything that you can put in front of the name of a variable in a declaration is a type.

Share this post


Link to post
Share on other sites
Quote:
Original post by ThoughtCriminal
Where is the help page for how to use code tags etc?

See that little link near the top of the page titled "faq"? It includes a section describing allowed tags. In your case, just use lower case, instead of upper case. Or alternatively, use "source" instead of "code" to get a nice scrollable box.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!