Solved

Scanf function in C#

Posted on 2003-11-27
4
5,394 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
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

838 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