Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Sunday, May 6, 2012 4:11 AM
Hello guys i'm kinda new to the C# i'm working on an application based on a C++ blueprint, and i have the this obstacle the C++ blueprint has the
scanf("%f", &XXX);
&XXX
in the scanf statement we see that they called (XXX) method or variable i'm not quite sure , how can i do that in c# as well
and
printf("\n input:");
i'm just wondering what's the equivalent of the previously stated statement in c#, any help will be greatly appreciated.
thanks in advance.
forgive me for any kind of shortcomings in thread
All replies (4)
Sunday, May 6, 2012 5:03 AM âś…Answered | 1 vote
class Program
{
static void Main(string[] args)
{
float xxx = 0;
string xxxstring = Console.ReadLine();
if (float.TryParse(xxxstring, out xxx))
{
Console.WriteLine("xxx = {0}", xxx);
}
else
{
Console.WriteLine("Invalid input");
}
}
}
Regards,
Ahmed Ibrahim
SQL Server Setup Team
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
This can be beneficial to other community members reading the thread.
Sunday, May 6, 2012 4:41 AM
Check-out below link
http://stackoverflow.com/questions/472202/looking-for-c-sharp-equivalent-of-scanf
Regards,
Ahmed Ibrahim
SQL Server Setup Team
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
This can be beneficial to other community members reading the thread.
Sunday, May 6, 2012 4:49 AM
i've stumbled over the link that you posted me i don't want it to parse regexp files or anything like that at all, plus i've stated that i'm quite new to the field of programming area, and all the codes in the link and it's sub tree of links are quite nested and complicated, for now i just want to know the proper substitution for this line in c++ in c# i don't want to get lost in the details of the scanf abilities and the different approaches been made to replace it in c#
scanf("%f", &XXX);
Sunday, May 6, 2012 5:14 AM
Thanks for the ahmed you've been of great help, now the final last thing, i can consider this code as being the one of the ways to replace the scanf used in cpp into c# code right ??
thanks for having the patience to handle my primitive questions, and have nice day