but when i changed 'void' with 'int' I got the same result..! sorry I have two questions:
1) what is the difference between 'void main()' and' int main()' ?
2) if I become professional in c++ in the future, is it enough and I will not need java and c#?
Great! I'm glad you got it working.
For the answer to #1, see http://www.eskimo.com/~scs/readings/voidmain.960823.html. When the operating system (or other code) that's calling your program expects to get an integer value back from your program and you don't give it one, it can cause problems.
At times these return values are codes to let the calling program know whether your code has exited successfully (which is represented by return 0;
)or if another error has occurred.
If you declare main as an int, even if you don't put a return 0 (or other return value at the end) it will implicitly return 0 to the OS anyway.
You may not have experienced any change or error in switching from void to int, but you've prevented the possibility of things getting fouled up when running the code under different conditions.
I'm probably leaving off some bits and pieces of the details here but if you google void main versus int main lots of stuff comes up.
As for #2 I'm not really sure, but I am sure that the requirements for programmers vary greatly from workplace to workplace and region to …