I'm a student and i got a trial edition of Visual Studio, My class is about C++ and my professor wants it coded that way, so i was wondering if there was a way to code regular C++ in this program.
I'm a student and i got a trial edition of Visual Studio, My class is about C++ and my professor wants it coded that way, so i was wondering if there was a way to code regular C++ in this program.
Is it possible to code in regular C++?
Cindy_li
That's what i've been trying, but when i use cout, and cin, and stuff like that, it doesn't work. I'm used to the C++ used in Codewarrior
mikael sandberg
You'll find in well formed C++ libraries that a lot of the classes are in namespaces, think of it as an area. cout and cin are part of STL so to access them you have to be able to get to that area using "std". There's a few ways you can do this:
//Declare the whole namespace after the include files like #include <iostream> using namespace std; void func() { cout << "Output something" << endl; } //Access them directly in the code void func() { std::cout << "Output something" << std::endl; } //or you can declare that you'll be using certain things in your code void func() { using std::cout; using std::endl; cout << "Output something" << endl; }The "::" is called the scope resolution operator, basically all the namespace stuff is there to help with name clashes. You'll find that out when your projects get bigger and you start running out of names to use.
MmeBovary
Jonathan Kehayias
Nichole