I'm about to learn the very basic of c++ with simple command line programs. I have written this programm from a tutorial:
The purpose of this programm is to see the difference between int and double.
Its output should be:
But I get:
BTW I use Visual Studio Express 2008 and Vista Home Premium. I also use . as decimal comma.
I'm sorry if this question is inappropiate for this forum since it has nothing to do with orbiter (despite of the fact that I learn c++ for orbiter). If you know a good c++ forum where this question is more appropiate, then please link me to it.
Thanks
Code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int ivar;
double dvar;
ivar = 100;
dvar = 100.0;
cout << "Original value of ivar: " << ivar << "\n";
cout << "Original value of dvar: " << dvar << "\n";
cout << "\n";
ivar = ivar / 3;
dvar = dvar / 3.0;
cout << "ivar after division: " << ivar << "\n";
cout << "dvar after division: " << ivar << "\n";
return 0;
}
Its output should be:
Code:
Original value of ivar: 100
Original value of dvar: 100
ivar after division: 33
dvar after division: 33.3333
Code:
ivar after division: 33
dvar after division: 33
I'm sorry if this question is inappropiate for this forum since it has nothing to do with orbiter (despite of the fact that I learn c++ for orbiter). If you know a good c++ forum where this question is more appropiate, then please link me to it.
Thanks