Is it possible to code in regular C++?

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.



Answer this question

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

    Yes, use the Console Application project
  • Jonathan Kehayias

    I'm not sure about code worrior, in VC the std headers no longer use the ".h" for their include files.
  • Nichole

    Use MinGW (minimalistic GNU for Windows). It's a gcc compiler which contains all the posix stuff as well as native windows API gear. It's free and it's good and you don't have to suffer a bloated GUI and you even get to automate things properly with make files. You can grab a copy at http://mingw.org/


  • Is it possible to code in regular C++?