Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Scanf function in C#

Posted on 2003-11-27
4
Medium Priority
?
5,477 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 75 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
 

Author Comment

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

719 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