How to read in multiple values from Console
-
.NET VC++ the user will type three floats in the Console window, and the application will read in those three values and assign each to one variable. i.e. Console::WriteLine("Enter three values: "); Console::Readline() gets whole text line......how to extract the three values from a String*?? Is there other way to read values in???
-
.NET VC++ the user will type three floats in the Console window, and the application will read in those three values and assign each to one variable. i.e. Console::WriteLine("Enter three values: "); Console::Readline() gets whole text line......how to extract the three values from a String*?? Is there other way to read values in???
mmhu wrote:
Console::Readline() gets whole text line......how to extract the three values from a String*??
Parse the
string
into the component values. I assume there is some sort of delimiter between the values. For example, do you type them in like this?1.1 2.2 3.3
If so, then you can
Split
the string on the space character.
Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog
-
mmhu wrote:
Console::Readline() gets whole text line......how to extract the three values from a String*??
Parse the
string
into the component values. I assume there is some sort of delimiter between the values. For example, do you type them in like this?1.1 2.2 3.3
If so, then you can
Split
the string on the space character.
Scottish Developers events: * .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog