TechArena Community Calculators in C++

#1
08-09-2008
 Member Join Date: May 2008 Posts: 32
Calculators in C++

I placed the sources of 2 calculators made by me in C++
with each iteration while, or preconditioned, the other will continue to do (hence the postconditioned) and for.
For simplicity the first one written is better, but for quality of the code, the second is more reliable. Even if it is still Spartan, I made in 10 minutes.

This is the second calculator
Code:
`# include   void main () (float difference, division, product, the sum, i, a, b, n, choice, cont; do (/ / parenthesis do court << "Choose an action to make \ n"; court << "1-Addition 2-Stealing 3-Multiplication 4-Division 5-Exit \ n"; cin>> choice; court << "\ nChoose the number of operandi"; cin>> n; if (choice == 1) ( for (cont = sum = 0; cont   >; sum + = a;) court << "The sum and '" <   >; difference-= a;) court << "The difference and '" <   >; product *= a;) court << "The product and '" <   >; court <   > b; product *= b;) = a division / product; court << "The product and '" <`
#2
08-09-2008
 Member Join Date: Feb 2008 Posts: 1,848
It is only recently that I did java and C++. I have not ever seen (although very similar, given that the java is a derivative), but it seems to me that in the second calculator, there is lacking some line of code .. or mistake?

However with a little patience, the first you can easily transform from "Spartan" to "finished".
#3
08-09-2008
 Member Join Date: May 2008 Posts: 32
Quote:
 Originally Posted by MindSpace It is only recently that I did java and C++. I have not ever seen (although very similar, given that the java is a derivative), but it seems to me that in the second calculator, there is lacking some line of code .. or mistake?
Mmmm......is not incomplete

Quote:
 Originally Posted by MindSpace However with a little patience, the first you can easily transform from "Spartan" to "finished".
Will not happen ever. Spartan mean that lack the type operations breast, cosine, tangent, root, powers etc.... I just made to test the cycle do while associated with.
#4
08-09-2008
 Member Join Date: Apr 2008 Posts: 1,948
Eh, i have never tried this programming in C++. Certain aspects of CMQ x resembles the Pascal.

congratulations
#5
08-09-2008
 Member Join Date: May 2008 Posts: 32
Yeah, most of them are all equal. I also know the pascal. But to be more than nice is more complicated and has lot more features. But it is very easy to learn knowing C++.
#6
24-09-2008
 kelly123 Posts: n/a
I don't know for sure what kind of calculator you are using but if it is a TI version this will work in your program it should ask for your inputed numbers then save them...

Example:

1. Prompt x, y
2. x+y→e
3. disp e

disp e makes it display e to the screen. the → makes it store the answer to the variable e...it should be the same for most calculators most of these functions are under the catalog section.

Last edited by Yogesh : 24-09-2008 at 01:53 PM. Reason: External links removed.

 Tags: calculators