Customer Service Chat
Get quote & make Payment
Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION, Basic Computer Science
Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTIONS -- TO SEPARATE COMMA SEPARATE NUMBER VALUES AND THEN SUM TO TOTAL? I.E., USING SUBSTRING AND INDEXOF.
I''ve been trying to get this to work but am having problems with the loops and counters. Basically -- NOT using arrays or split functions -- I need to write a function that takes one string made of numbers separated by comma and then have the function return the total of all the separate numbers (number of entered comma separated values is fungible depending on how many values the user enters into the textbox). E.g., textbox1 string is: 10,11,12 --> Total =33. Or, 1,33,121,3,55 ---> Total = 213.
Below is my code so far. Thanks in advance!
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s, showVal As String
Dim Total, x, length As Integer
Dim comma1Position As Integer ''this is used to get the index of the first comma position
Dim oldcomma1Position As Integer ''dummy register variable
Dim commaCount As Integer = 0
s = TextBox1.Text
length = s.Length
x = 0
comma1Position = 0
oldcomma1Position = 0
commaCount = 0
Dim number As String
Total = 0
Do While x <> -1
oldcomma1Position = comma1Position
x = s.IndexOf(",")
comma1Position = s.IndexOf(",", (oldcomma1Position + 1))
number = s.Substring(oldcomma1Position, x)
Total = Total + CInt(number)
commaCount = commaCount + 1
showVal = " The Sum Total of the Comma Separated Values You Entered Is: " & Total
Posted Date: 11/15/2012 8:32:21 PM | Location : United States
Ask an Expert
Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION, Assignment Help, Ask Question on Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION, Get Answer, Expert's Help, Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION Discussions
Write discussion on Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION
Your posts are moderated
Write your message here..
Computer storage, Computer Storage: Computer systems include two types...
Computer Storage: Computer systems include two types of digital information storage: internal storage, within the CPU, and the backing (back up) storage on external devices su
Digital design system, Manipulate the following Boolean expression in such ...
Manipulate the following Boolean expression in such a way so that it can be implemented using exclusive-OR and AND gates only. AB''CD'' + A ''BCD'' + AB''C''D + A''BC''D
Third generation of computers, THE THIRD GENERATION (1966-1975) ...
THE THIRD GENERATION (1966-1975) The introduction of IBM-360 series of computers in 1965 marked the beginning of this generation. The transistors were replaced by solid
Factors and criteria for computer, what are the factors and criteria for co...
what are the factors and criteria for computer (from business point of view)?
Product of first n natural numbers-algorithm, Product of first n natural nu...
Product of first n natural numbers - Algorithm Working Procedure : 1. Take n = 8 2. Take I = 1 3. Take PROD = 1 4. Compute PROD = PROD * 1 5. add 1 to 1 6. If I≤ n, complete
Depth first search-artificial intelligence, Depth First Search-Artificial i...
Depth First Search-Artificial intelligence: Depth first search is similar to breadth first, except that things are added to the top of the plan rather than the bottom. In our
Explain the tcp/ip reference model with diagram, Question 1 Define the fol...
Question 1 Define the following terms 1) Analog Signals and Digital Signals 2) Composite signals Question 2 Define the following terms
Digitalelectronics, what duality principle and huntington postulates
what duality principle and huntington postulates
One dimensional array, One dimensional array: A one-dimensional arra...
One dimensional array: A one-dimensional array is a structured collection of elements that can be accessed individually by specifying the position of a component with ind
Assembly, Design and develop a program to calculate the sum of an integer n...
Design and develop a program to calculate the sum of an integer number using MIPS assembly language.
Accounting Assignment Help
Economics Assignment Help
Finance Assignment Help
Statistics Assignment Help
Physics Assignment Help
Chemistry Assignment Help
Math Assignment Help
Biology Assignment Help
English Assignment Help
Management Assignment Help
Engineering Assignment Help
Programming Assignment Help
Computer Science Assignment Help
Why Us ?
~24x7 hrs Support
~Quality of Work
~Time on Delivery
~Privacy of Work
Human Resource Management
Literature Review Writing Help
Terms & Conditions
Copyright by ExpertsMind IT Educational Pvt. Ltd.