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..
Comp 100, I have an account in my www.itlab.com and i have a test and it s...
I have an account in my www.itlab.com and i have a test and it should do tonight, so do you have any one to help me and do this test and it is about excel
Telecommunication processors, brigde
Computer architecture, Consider a CPU that implements two parallel fetch-ex...
Consider a CPU that implements two parallel fetch-execute pipelines for superscalar processing. Show the performance improvement over scalar pipeline processing and no-pipeline pro
Cryptography, Assume |s1|=|s2|=n and consider the functions defined, for an...
Assume |s1|=|s2|=n and consider the functions defined, for any s1 and s2, as: (a) G1(s1,s2)=s1 xor s2, (b) G2(s1,s2)=(s1, s2, s1 xor s2). We have that: A. G1 and G2 are pseudo-ra
Definition of procedure, A procedure is a compilation of instructions to wh...
A procedure is a compilation of instructions to which we can express the flow of our program, and once the execution of these instructions is over power is given back to the next l
Definition of resource sharing , Resource sharing is a concept which has de...
Resource sharing is a concept which has developed to contain many cooperative activities among libraries and other stakeholders. Interlibrary loan continues to be the basis of reso
What is collaboration, Question 1 What is Collaboration? Write down the ob...
Question 1 What is Collaboration? Write down the objectives of collaboration Question 2 What is proxy server? Write down the reasons for using proxy server Question
Pitfals, what is CAI
what is CAI
What is evaluating information system investments, 1. What is Evaluating In...
1. What is Evaluating Information System Investments? 2. Is IS evaluation different to evaluation of other investments? 3. What approaches are used to evaluate IS investments
Algorithms and flowcharts, write algorithm and draw flowchart to check whet...
write algorithm and draw flowchart to check whether the given number is palindrome or not
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
IT Courses and Help
Why Us ?
~24x7 hrs Support
~Quality of Work
~Time on Delivery
~Privacy of Work
Human Resource Management
Literature Review Writing Help
Follow Us |
T & C
Copyright by ExpertsMind IT Educational Pvt. Ltd.