ajaykothidar
asked on
Scanf function in C#
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks a lot..
both the url's have lot of info..
both the url's have lot of info..
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;