Quote:
For some reason it shows 5 and not 5.5, I used float for that purpose. Why?
The reason is very simple: in with C/C++, a division of integers is an'integer division' with integer result, thus 5 in your case, because 11 is 5*2+1.
The solution is to divide floats or cast to floats.
in your code, declaring va as float does not change the division.
#include <iostream>
using namespace std;
int main()
{
float va = 11.0 / 2.0;
cout << va << endl;
return 0;
}