Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #2238
| X-Received | by 10.236.216.69 with SMTP id f65mr1924458yhp.58.1423711418503; Wed, 11 Feb 2015 19:23:38 -0800 (PST) |
|---|---|
| X-Received | by 10.140.97.5 with SMTP id l5mr27834qge.4.1423711418463; Wed, 11 Feb 2015 19:23:38 -0800 (PST) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!j7no12006qaq.1!news-out.google.com!c1ni3qar.1!nntp.google.com!i13no685972qae.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.basic.visual.misc |
| Date | Wed, 11 Feb 2015 19:23:38 -0800 (PST) |
| In-Reply-To | <mbfsbo$jh8$1@speranza.aioe.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=75.178.36.13; posting-account=bDZo8goAAADwRO71ouDFRMCIZ96XBCK3 |
| NNTP-Posting-Host | 75.178.36.13 |
| References | <b7f784f4-00a0-47ce-8874-72e236ec1735@googlegroups.com> <mbfsbo$jh8$1@speranza.aioe.org> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <a53f442d-3f65-4bbc-a523-2d87a71ea6d2@googlegroups.com> (permalink) |
| Subject | Re: how do you read in an integer in a console application? |
| From | G G <gdotone@gmail.com> |
| Injection-Date | Thu, 12 Feb 2015 03:23:38 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Lines | 40 |
| Xref | csiph.com comp.lang.basic.visual.misc:2238 |
Show key headers only | View raw
> Assuming you mean VB.NET, try Console.ReadLine() and Integer.Parse()
********************************************************************************
' ----------- declare variable -----------
Dim stringToBeA_Number As String
Dim number1 As Integer
Dim number2 As Integer
Dim sum As Integer
'---------prompt user for input and read in first value --------
Console.WriteLine("Enter first value: ")
stringToBeA_Number = Console.ReadLine()
'-------- convert string to an integer and store in number1 -------
number1 = Integer.Parse( stringToBeA_Number )
'--------- convert string to an integer and store in number2 ------
Console.WriteLine("Enter first value: ")
stringToBeA_Number = Console.ReadLine()
'-------- convert string to number and store in number2 -------
number2 = Integer.Parse( stringToBeA_Number )
'------------- calculate sum -------------
sum = number1 + number2
'-------------- display sum ---------------
Console.WriteLine( "The sum is " + sum )
********************************************************************************
thanks Deanna, i hope that's right.
Back to comp.lang.basic.visual.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how do you read in an integer in a console application? gdotone@gmail.com - 2015-02-11 06:13 -0800
Re: how do you read in an integer in a console application? G G <gdotone@gmail.com> - 2015-02-11 07:13 -0800
Re: how do you read in an integer in a console application? Deanna Earley <dee@earlsoft.co.uk> - 2015-02-11 15:24 +0000
Re: how do you read in an integer in a console application? G G <gdotone@gmail.com> - 2015-02-11 19:23 -0800
Re: how do you read in an integer in a console application? G G <gdotone@gmail.com> - 2015-02-11 19:28 -0800
csiph-web