Hello, I am new the forum and I'm learning C++. I have programmed in C# for about a year. I am taking a C++ class where we are programming on Linux.
I don't want to waste any of your time so I'll make this short. Could someone point me in the direction where I can learn about the different C++ syntax’s and how the convert between the two?
The reason is on unix a sample C++ program looks like this:
1 2 3 4 5 6 7 8 9 10 11 12
#include <iostream>
usingnamespace std;
int main()
{
int myInt = 5;
cout << myInt << endl;
return 0;
}
However, when I fire up Microsoft Visual C++ (.Net 2008) - It looks like this:
There's no such thing as "Linux C++" or "Visual C++" (in relation to the language. There is something called Visual C++, but it's not a dialect of C++). There's only standard-compliant C++, and everything else. Everything else includes all stupid, non-standard extensions proprietary compilers tend to have, such as having a main() by a different name, having main take exotic parameters, having main return anything other than int, non-standard methods in standard classes (you'll pay dearly for ever making me think there was an std::stack<T>::_Get_container(), Microsoft), etc.
With a little careful project creation, you can compile the first sample in VC++.
Yeah...it's because you are using .Net....Just copy/paste the Linux code into VC++ and it should work fine. (Well, at least it does on mine...I don't remember if I had to change anything)