473,396 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Adding variables to variables

Hi,

I wonder if anyone can help me. I am creating a program in Borland C++
Builder. I want to do the following...

A variable, TotalTax, calculates the tax for an employee. I need to
also keep a running total for "n" employees. So i need a piece of code
to add the next value of TotalTax to the current value.

I have tried the following code;

TotalTax = TotalTax + TotalTax1 (where totaltax1 is the new value )

but it just keeps doubling the value in the original.

Does anyone know an easier way to do this, bearing in mind I have four
IF statements to determine what tax the employee has to pay!

thanks in advance

Aug 3 '05 #1
1 1318
lmo863 wrote:
I wonder if anyone can help me. I am creating a program in Borland C++
Builder. I want to do the following...

A variable, TotalTax, calculates the tax for an employee. I need to
also keep a running total for "n" employees. So i need a piece of code
to add the next value of TotalTax to the current value.

I have tried the following code;

TotalTax = TotalTax + TotalTax1 (where totaltax1 is the new value )

but it just keeps doubling the value in the original.

Does anyone know an easier way to do this, bearing in mind I have four
IF statements to determine what tax the employee has to pay!


The "easier" way to do what you have above is

TotalTax += TotalTax1

but it will probably not fix your doubling issue because it is reasonable
to assume that it's not due to this addition, but due to calculation of
'TotalTax1'.

Since you're the one who's in charge of making your code work, you will
have to put some more effort to it. You have what is known as "a bug" in
your code. So, you have to de-bug your program. Use a "debugger" or do
a manual trace of your program with a pencil and a piece of paper, just
do it. We cannot do it for you because we don't have your code.

V
Aug 3 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: marco | last post by:
hi I've got a class "myClass" ... and i CAN'T EXTENDS this class! But i can add NEW methods to "myClass", like that : method = new.instancemethod( myNewMethod , None, myClass)...
3
by: Bill | last post by:
I have a page that contains processed variables that I'd like to forward using the response.redirect method. However, because the response.redirect contains the page within "pagename.asp", I have...
5
by: surrealtrauma | last post by:
the requirement is : Create a class called Rational (rational.h) for performing arithmetic with fractions. Write a program to test your class. Use Integer variables to represent the private data...
0
by: Cybermedia Marketing | last post by:
I'm trying to convert an ISAPI filter to an httpmodule. The ISAPI filter added custom headers to the response which could later be accessed by the asp page. ISAPI Filter: ...
3
by: Robin Thomas | last post by:
I am fairly new to ASP.NET so I think I am missing something fundamental. Anyway, quite often I am pulling data from a database, but then I need to use that data to produce more data. A simple...
4
by: Saurabh Aggrawal | last post by:
Hi, I have made a dll and it is working fine in the debug build (as expected) but when I run it in the release build it is working strangely. For example, the dll saves the 10 properties on the...
5
by: matt | last post by:
i have a VB.net application that connects to the internet to download an xml file and parse it. It works correctly, but "locks up" until that function returns. i want to add asynchronous support,...
2
by: silversurfer | last post by:
Hello, I am a little unsure whether this method really makes sense. The goal is to add an element to a vector. This is the struct and method I am using: std::vector<Entry> models; struct...
3
by: iwl | last post by:
Hello, I would like to add Variables to my embedded python which represents variables from my C++-Programm. I found C-Api-funcs for adding my C-Funcs to python but none to add variables. I...
2
by: Sbrannan | last post by:
Hi all, I have created an array that stores the mean for a set of variables. Then, I want to reference the position in that array for a second function that is supposed to calculate the standard...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.