The following is a very simple c++ program, that i believe should show the value of a variable x. since x = 1/3, i believe that the out put should be 0.3333, however, the output i get is x=0.
can anybody tell me why?
can anybody tell me why?
Code:
#include <iostream>
using namespace std;
int main()
{
double x=10, dummy;
x = (1/3);
cout << "X : " << x << endl;
cout << "Exit" << endl;
cin >> dummy;
return 0;
}