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..
Networking operating systems, Networking Operating Systems, Networking OS ...
Networking Operating Systems, Networking OS provides file sharing, Networking OS provides communication scheme, NT Server Security added Multi user capability added RAI
What is vpn? explain the vpn protocols, Question 1 What is IT auditing? Di...
Question 1 What is IT auditing? Discuss the three phases involved in the IT auditing Question 2 List and explain the two types of load balancing methods Question 3
Concept of instruction, Concept of instruction: The CPU is a semicondu...
Concept of instruction: The CPU is a semiconductor integrated circuit chip consisting of a large number of transistors. In personal computers, the CPU is also referred by the
Why learning of Assembly language is beneficial?, The first reason to work ...
The first reason to work with assembler is that it offers the opportunity of knowing more the operation of your PC, which permits the development of software in a more constant man
Data processing, Data Processing In any computer-based system, d...
Data Processing In any computer-based system, data storage and retrieval plays an important role. Data storage involves decision about the encoding of data, assignment o
Classification of computers, Classification of Computers DIGITAL, ANAL...
Classification of Computers DIGITAL, ANALOG AND HYBRID Computers are of three basic types – Digital, Analog, and Hybrid. Current use of the word “computer” almost a
Describe four types of abstracts, QUESTION 1 Write short notes on cont...
QUESTION 1 Write short notes on controlled vocabulary indexing. QUESTION 2 (a) List five types of abstracts. (b) Describe four types of abstracts. QUESTION 3
Briefly explain html and xml, Question 1 Briefly explain principles of eff...
Question 1 Briefly explain principles of effective navigation Question 2 Explain the terms URI and URL. Why should you use Relative URI? Question 3 What are the di
Write a program to swap two names between two variables, QUESTION (a) W...
QUESTION (a) Write a program to swap two names between two variables for examples: N1 = "Mary Anne" N2 = "Queen Mary". The program should make use of an appropriate Fu
What is multi-protocol label switching (mpls), QUESTION (a) What is Mul...
QUESTION (a) What is Multi-Protocol Label Switching (MPLS)? List the main advantage of running MPLS in a service provider network (b) What is a label? Explain the structure
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.