I am new to C ++ and I have tried this simple code:
#include<iostream>
#include<math.h>
using namespace std;
int main(){
double a;
a=1/6;
cout<<a;
}
But the result is 0. As I understand it, double should work with real numbers, so the result should not be 1/6 or 0.1666666? Thank!
source
share