2 Replies - 341 Views - Last Post: 06 October 2012 - 12:43 PM Rate Topic: -----

#1 harry4696  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-October 12

User input

Posted 06 October 2012 - 12:33 PM

Hey guys

is there any way you can get a users input from a console based application in c#, so instead of the typing in:
1
+
2

can you do it so it does this:
1 + 2

i know this is easy to do in objective C as it is just scanf and then input the variables but how do you do it in c#
i have looked on the web and cant seem to find it,
any idea's ?

thanks

Harry

Is This A Good Question/Topic? 0
  • +

Replies To: User input

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6062
  • View blog
  • Posts: 23,513
  • Joined: 23-August 08

Re: User input

Posted 06 October 2012 - 12:42 PM

Console.ReadLine()? Then Split on the whitespace?
Was This Post Helpful? 0
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5505
  • View blog
  • Posts: 11,808
  • Joined: 02-June 10

Re: User input

Posted 06 October 2012 - 12:43 PM

Same method, but different commands for C#.
For a console app it would be Console.LineIn

You might want to read up on C#. You can't expect Objective-C and C# to use all the same commands.


My standard beginner resources post

First learn the language by working 2-5 "Learn C# in 30 days" type books cover to cover. Do a couple hundred on-line tutorial projects where you build what you're told to build, the way you are told to build it WITH AN EXPLANATION OF WHY so you can learn.

Then later you can start architecting your own simple stuff. Build a calculator. Build a DVD library program. Etc. Stuff that doesn't involve the complexity of a game. Then move up to games.



There are three routes people seem to take when learning programming.
  • Just start trying to create programs
  • Start taking apart other programs and try to figure out the language by reverse engineering
  • Follow a guided learning course (school or self-teaching books)


For the life of me I can't figure out why people try 1 & 2. I strongly suggest taking the guided learning approach. Those book authors go in a certain order for a reason: They know what they're doing and they know the best order to learn the materials.

Quote

Where do I start?


You start by learning a coding language FIRST.
Learn to plan before you type.
THEN you start designing software with a purpose.


If this sounds like you

Newbie/Rookie said:

I have a little programming experience but I need to write ...
read this section
Spoiler


Otherwise, you can just jump to the resources here:
Some of the tutorials below are for C# or Java not C, C++, VB.NET [...]. But the conceptual stuff of classes, object oriented design, events etc. are not language specific and should give you enough guidance in theory of program development for you to be able to look-up specific code example in your chosen coding language.



Resources, references and suggestions for new programmers. - Updated Mar 2012
Spoiler

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1