Difference between MS C++ and "normal" C++?
-
I noticed that there are some differences between MS C++ and C++ that is used elsewhere, for example most tutorials available on the internet are in "normal" C++. Are the commands so differnt that you need to learn one or the other or are they similar enough that if you leanr one, you know both? I'm currently stuck in a class about MS C++ nad I don't have any poosibility to learn the "normal" C++. When I'm done (3 months) will I also be able to programm with the "normal" C++ or would I have to learn that again? If so, how long would it take (realistically) to switch from MS C++ to the "normal" one? Thanks in advance.
Thanks. Though I noticed in MS C++ you cannot use
cin
/cout
, the syntax for#include
is different and strings are also handled differenty. -
Thanks. Though I noticed in MS C++ you cannot use
cin
/cout
, the syntax for#include
is different and strings are also handled differenty.Megidolaon wrote:
Though I noticed in MS C++ you cannot use cin/cout,
That's not true.
Megidolaon wrote:
the syntax for #include is different and strings are also handled differenty.
That is, as well, not true. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Thanks. Though I noticed in MS C++ you cannot use
cin
/cout
, the syntax for#include
is different and strings are also handled differenty. -
I noticed that there are some differences between MS C++ and C++ that is used elsewhere, for example most tutorials available on the internet are in "normal" C++. Are the commands so differnt that you need to learn one or the other or are they similar enough that if you leanr one, you know both? I'm currently stuck in a class about MS C++ nad I don't have any poosibility to learn the "normal" C++. When I'm done (3 months) will I also be able to programm with the "normal" C++ or would I have to learn that again? If so, how long would it take (realistically) to switch from MS C++ to the "normal" one? Thanks in advance.
When you say "MS" you are potentially targeting windows. It's totally different from standard C++. Though you get the standard C++ from MS compilers, MS C++ (in your terms) or VC++ (the right term) would mean more eg: Win32APIs, MFC etc all platform oriented. All these libraries/Frameworks make things on top of MS C++ compiler.If you develop apps using plain, Standard C++, you will be able to run it on any OS. Just a recompilation would do.
-
i think cin/cout can be used in ms c++,once i tried.Maybe you didn't include the right head files.or some thing wrong with the name spaces
You can certainly use any cin/cout in ms c++, .. u have to include iostream.
kamalesh
-
Thanks. Though I noticed in MS C++ you cannot use
cin
/cout
, the syntax for#include
is different and strings are also handled differenty.Megidolaon wrote:
Though I noticed in MS C++ you cannot use cin/cout, the syntax for #include is different and strings are also handled differenty.
It's not that. In pre-standard C++, it would be like
#include <iostream.h>
After standardization its,
#include <iostream>
Moreover I can say you forgot to include
"using namespace std".
-
I noticed that there are some differences between MS C++ and C++ that is used elsewhere, for example most tutorials available on the internet are in "normal" C++. Are the commands so differnt that you need to learn one or the other or are they similar enough that if you leanr one, you know both? I'm currently stuck in a class about MS C++ nad I don't have any poosibility to learn the "normal" C++. When I'm done (3 months) will I also be able to programm with the "normal" C++ or would I have to learn that again? If so, how long would it take (realistically) to switch from MS C++ to the "normal" one? Thanks in advance.
you are obviously totally confused. recent Microsoft C++ Compiler (above version 2003) are significantly closer to the standard C++ than previous ones. so you can write a totally standard C++ Application (say, under vi or notepad, why not), and compile it with any compiler. gcc would handle it, and VC++ as well. what makes you becoming non-standard C++ is by using compiler-specific commands, or non-portable libraries (such as Win32, MFC)... but remember that VC++ only provides extensions to the standard, so anything standard should work with a Visual C++ compiler. If it doesn't, you're probably doing it wrong (show your code about
cin
/cout
/#include
)...! However, as an example, the following is 100% standard C++:#include <iostream>
#include <string>void main(void) {
std::string strName = "";// Getting the User Name std::cout << "your name: "; std::cin >> strName; // Saying Hi std::cout << "Hello " << strName << " !" << endl;
}
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
modified on Monday, February 23, 2009 8:00 AM
-
Megidolaon wrote:
Though I noticed in MS C++ you cannot use cin/cout, the syntax for #include is different and strings are also handled differenty.
It's not that. In pre-standard C++, it would be like
#include <iostream.h>
After standardization its,
#include <iostream>
Moreover I can say you forgot to include
"using namespace std".
grassrootkit wrote:
Moreover I can say you forgot to include "using namespace std".
yeah, but using prepending
std::
is generally prefered (the using namespace command can lead to unresovled names and should be used with care...[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
I noticed that there are some differences between MS C++ and C++ that is used elsewhere, for example most tutorials available on the internet are in "normal" C++. Are the commands so differnt that you need to learn one or the other or are they similar enough that if you leanr one, you know both? I'm currently stuck in a class about MS C++ nad I don't have any poosibility to learn the "normal" C++. When I'm done (3 months) will I also be able to programm with the "normal" C++ or would I have to learn that again? If so, how long would it take (realistically) to switch from MS C++ to the "normal" one? Thanks in advance.
Thanks.
you are obviously totally confused.
Yes, I was, but now I'm not anymore. :laugh: Almost all online tutorials I found were in standard C++ and never mentioned anything about VC++, so I assumed there'd be sigificant differences. Thus I never found that you need
#include
to make it work in VC++, I just tried it out and it works fine. Without that, I always got an error withusing std;
. As for other OS, it should be fine if I don't get too much into the MS specific libraries? -
Thanks.
you are obviously totally confused.
Yes, I was, but now I'm not anymore. :laugh: Almost all online tutorials I found were in standard C++ and never mentioned anything about VC++, so I assumed there'd be sigificant differences. Thus I never found that you need
#include
to make it work in VC++, I just tried it out and it works fine. Without that, I always got an error withusing std;
. As for other OS, it should be fine if I don't get too much into the MS specific libraries?Megidolaon wrote:
Thus I never found that you need #include to make it work in VC++, I just tried it out and it works fine. Without that, I always got an error with using std;.
becasue you probably used it badly. can you post a code sample of a "not compiling" code, and the associated error ? We'll tell you what's wrong then...
Megidolaon wrote:
As for other OS, it should be fine if I don't get too much into the MS specific libraries?
As far as you do command line applications, everything will be ok. unfortunately, as soon as you start a windowed application, you'll have to choose a graphical library, which is most of the time OS-specific... But you know, it's not a bad choice sometimes to move a little from the standard C++ paths, especially for things that are anyway specifics to the OS. But for the logical layers, all depends on what systems you target, but I personnally prefer staying standard as much as I can...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]