Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #2235 > unrolled thread
| Started by | gdotone@gmail.com |
|---|---|
| First post | 2015-02-11 06:13 -0800 |
| Last post | 2015-02-11 19:28 -0800 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.basic.visual.misc
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
| From | gdotone@gmail.com |
|---|---|
| Date | 2015-02-11 06:13 -0800 |
| Subject | how do you read in an integer in a console application? |
| Message-ID | <b7f784f4-00a0-47ce-8874-72e236ec1735@googlegroups.com> |
i don't know the syntax for visual basic:
prompt user to enter number1
read in number1
prompt user to enter number2
read in number2
so.
Dim number1 As Integer
Dim number2 As Integer
Dim Sum As Integer
Console.WriteLine("Enter first number: ")
'what is the command to read in a number for console application
Console.WriteLine("Enter second number: ")
'what is the command to read in a number for console application
sum = number1 + number2
'what is the command to display the sum for console application
Console.WriteLine( sum )
thanks, i trying to learn vb
g.
[toc] | [next] | [standalone]
| From | G G <gdotone@gmail.com> |
|---|---|
| Date | 2015-02-11 07:13 -0800 |
| Message-ID | <7960a131-8fc6-4c90-994a-8e7d9e352d26@googlegroups.com> |
| In reply to | #2235 |
On Wednesday, February 11, 2015 at 9:13:18 AM UTC-5, G G wrote:
> i don't know the syntax for visual basic:
>
> prompt user to enter number1
> read in number1
> prompt user to enter number2
> read in number2
>
> so.
>
> Dim number1 As Integer
> Dim number2 As Integer
>
> Dim Sum As Integer
>
> Console.WriteLine("Enter first number: ")
> 'what is the command to read in a number for a console application
>
> Console.WriteLine("Enter second number: ")
> 'what is the command to read in a number for a console application
>
> sum = number1 + number2
>
> 'what is the command to display the sum for a console application
> Console.WriteLine( sum )
>
> thanks, i'm trying to learn vb
>
> g.
thanks.
g.
[toc] | [prev] | [next] | [standalone]
| From | Deanna Earley <dee@earlsoft.co.uk> |
|---|---|
| Date | 2015-02-11 15:24 +0000 |
| Message-ID | <mbfsbo$jh8$1@speranza.aioe.org> |
| In reply to | #2235 |
On 11/02/2015 14:13, gdotone@gmail.com wrote:
> i don't know the syntax for visual basic:
>
> prompt user to enter number1
> read in number1
> prompt user to enter number2
> read in number2
>
> so.
>
> Dim number1 As Integer
> Dim number2 As Integer
>
> Dim Sum As Integer
>
> Console.WriteLine("Enter first number: ")
> 'what is the command to read in a number for console application
>
> Console.WriteLine("Enter second number: ")
> 'what is the command to read in a number for console application
>
> sum = number1 + number2
>
> 'what is the command to display the sum for console application
> Console.WriteLine( sum )
>
> thanks, i trying to learn vb
Assuming you mean VB.NET, try Console.ReadLine() and Integer.Parse()
--
Deanna Earley (dee@earlsoft.co.uk, dee@doesnotcompute.co.uk)
(Replies direct to my email address will be printed, shredded then fed
to the rats. Please reply to the group.)
[toc] | [prev] | [next] | [standalone]
| From | G G <gdotone@gmail.com> |
|---|---|
| Date | 2015-02-11 19:23 -0800 |
| Message-ID | <a53f442d-3f65-4bbc-a523-2d87a71ea6d2@googlegroups.com> |
| In reply to | #2237 |
> 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.
[toc] | [prev] | [next] | [standalone]
| From | G G <gdotone@gmail.com> |
|---|---|
| Date | 2015-02-11 19:28 -0800 |
| Message-ID | <6de73730-027a-4682-a705-28a2849b7f95@googlegroups.com> |
| In reply to | #2238 |
On Wednesday, February 11, 2015 at 10:23:39 PM UTC-5, G G wrote:
> 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 second 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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.basic.visual.misc
csiph-web