Solved

Scanf function in C#

Posted on 2003-11-27
4
5,418 Views
Last Modified: 2007-12-19
Hi,
i want to write a user interactive program in C#.
How can   i get the program to accept values from user.
What should we use in C# in place of  "Scanf in case of C" or "Cin in case of C++"

rgds
0
Comment
Question by:ajaykothidar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 25 total points
ID: 9830735
0
 
LVL 1

Expert Comment

by:Skytzo
ID: 9830737
I assume that you are making a console program to be able to read in input like this.

The function you are looking for are the console commands.

Example, Console.read(), Console.readline(), and Console.write() .......

Below is an example of Console.Read.  You can search msdn at http://msdn.microsoft.com
for the usage of Console.readline and the other Console commands.

The Console.Readline() returns a string object.  The Console.Read() returns an integer (ordinal) value representative of the ascii value typed in.

int i;
char c;
while (true)
{
 i = Console.Read ();
 if (i == -1) break;
 c = (char) i;
 Console.WriteLine ("Echo: {0}", c);
}
Console.WriteLine ("Done");
return 0;
0
 
LVL 10

Expert Comment

by:dkloeck
ID: 9830776
0
 

Author Comment

by:ajaykothidar
ID: 9857055
thanks a lot..
both the url's have lot of info..
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question