Whats the symbol for divide
In C++
Last edited on
closed account (3TXyhbRD)

Last edited on
If use is:
int a=10;
float b=8;


b/a = 0 integer division
b/(double a) = 0.8

I think this is your problem
b/a will return approximately 0.8 as a float because b is a float. What you said would be true if b was an integer.
Peter87 is right: The second variable is converted to the type of the first variable with built-ins.
@EssGeEich: a/b will give you `1.25'
ne555 wrote:
@EssGeEich: a/b will give you `1.25'

Oh. :/
what are guys taking about? i just needed to know whats the divide sign in C++ for my calculator.
I think they assume there must be more to your question. The symbol for divide in C++ is the forward slash /. Just like in every other language (and in first grade arithmetic). Is that really what you're asking???

EDIT: OK, technically first graders used that dash with the two dots above and below but it's too easy to confuse with the plus sign and it isn't on a computer keyboard.
Last edited on
Is this guy all right?
@Program Programmer

Because you have the correct symbol for division, try to see what is the problem :-)
Topic archived. No new replies allowed.