How to have decimals in calculator?

So I just wrote my first project (been coding for 2 days now and constantly wanting to learn) which was a calculator and it's working great now but when i use division and the quotient isn't an integer it just rounds down. for example 5/3 was 1. Please tell me if there is a way to have decimals. Here is my division section of my calculator:

1
2
3
4
5
6
7
8
9
  else if (operation == "div")
{
        cout << "Please enter a number \n";
        cin >> g;
        cout << "Please enter another number \n";
        cin >> z;
        quot = g / z;
        cout << quot << endl;
}
Integer division truncates toward 0. It will retain no portion of the decimal remainder.

If you wish to have decimals, use either double or float.
Topic archived. No new replies allowed.