SORRY FOR THE DOUBLE POST IN THE FORUM, PLEASE ADMIN REMOVE ONE OF THEM, THANKS
Hello Folks,
I made a little simple program to practice C++, My goals was too see how the two different methods of incrementation (example: x++ and ++x) would be handled in a for-loop.
this is the program:
Code:
#include <iostream>
using namespace std;
void ForIncrementFront()
{
for(int x = 0; x < 10; ++x)
{
cout << x << "\t";
}
}
void ForIncrementBehind()
{
for(int x = 0; x < 10; x++)
{
cout << x << "\t";
}
}
int main()
{
cout << "Function: ForIncrementFront (++x)\n";
ForIncrementFront();
cout << "Function: ForIncrementBehind (x++)\n";
ForIncrementBehind();
return 0;
}
this was my output:
Code:
Function: ForIncrementFront (++x):
0 1 2 3 4 5 6 7 8 9 F
Function: ForIncrementBehind (x++):
0 1 2 3 4 5 6 7 8 9
The output of function ForIncrementFont surprised me a little bit because 10 is printed as F and not as 10. what I would like to know is why F instead of 10?, is this a proof of the fact that the PC "speaks" only Hexadecimal and binary? if this is true, why is the output of the code below: 10.
I hope you understand my question. Sorry if my English grammar is bad, IŽam dutch.