+ 1
Could i create a calculator with all these apps tutorials?
hi, so as i can see ( im in chapter 2) that all of c++ coding is simple maths, so if i will finish all chapters and repeat them daily, would it be enough to create a calculator program? Thank you.
7 Answers
+ 2
yes u can I made a simple calculator that can just add
+ 2
mine is french maybe the translation from french to english to lithuanian isn't without causing damages. In resume, you must read about precision of float and double to understand why some calculs are giving answers that are bad.
By the way, this app doesn't talk about GUI but lot of tutorials can be found ob the web.
+ 1
but, does this app teach how to make like buttons for a program. for example:
123
456
789
+-*/
like on real calculator?
Thank you btw.
+ 1
I woulf say yes but you have to be careful while using floats and doubles. They store numbers with a floating coma expressed in binary. Each number is converted into a mantisse and an exponent which can introduce errors on approximations. While giving an answer on a calcul you should always be able to tell if it's still in the admissible precision or not if you don't want abberations like 10^10+0.000001 = 10^10
more info here : https://en.m.wikipedia.org/wiki/Single-precision_floating-point_format
+ 1
Thank you very much, Dorian. I totally didnt understand half of these words cause english is not my main language, but i will try to translate to lithuanian. Thank you again. :)
+ 1
Its c++ u talking about
this language is the base of android OS development
yes, for sure u can easily make a calculator program and with graphics mode as well
though i ll say java is a better option for designing
but c++ is easy in user interface and handling
wrapping up, yes u can make one calc!!
+ 1
I am running this code and something is.wrong. But I can't find any mistakes could you please help me?
print("Welcome to Gcalculator!")
print("If you want addition press a If you want substraction press s if you want multipication press m")
type = input("Enter type of calculation")
If type = "a":
x = int(input("Enter first number"))
y = int(input("Enter second number")) sum = x+y
print (sum)
If type = "s":
x = int(input("Enter first number"))
y = int(input("Enter second number"))
sub = x-y
print (sub)
If type = "m":
x = int(input("Enter first number"))
y = int(input("Enter second number"))
multi = x*y
print (multi)