Sign in to follow this  

[.net] How to get input of just for an integer? (C#)

Recommended Posts

Ekim_Gram    418
I'm disliking Console.Read(LINE)() function right now. I'm in the process of making a Tic Tac Toe clone just so I can remember some of the stuff I have learned using C# and it's just being a bitch about every thing. Here's the C/C++ equivilent of what I'd like to do:
void DoTurn()
  cout << Turn << "'s turn!";
  int move;
  cin >> move
  // do some error checking...
  if (GameBoard[move])...
But NOOooooooo, C# only returns a string with the ReadLine() function and boxing has no effect whatsoever.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Something like that:
int moves = int.Parse( Console.ReadLine() );

Share this post

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

Sign in to follow this