How to open c++ using the command prompt so that I can start programming in c++?


Recommended Answers

All 4 Replies

You don't "open" c++ in the command line. You edit your programs in a text editor like WordPad/Notepad or in an IDE (much better choice due to syntax highlighting and automatic indentation).

Try this IDE if you're just starting out: codeblocks

Just remember that you'll need to have not just the IDE, but also a compiler. You can download codeblocks with the compiler included. It's the option labelled: "codeblocks-8.02mingw-setup.exe" (where mingw is the Windows port of the gcc compiler).

You can then compile your programs right within the IDE or you can do so from the command line (so long as gcc is in your PATH) using: g++ myProgram.cpp -o myProgram.exe

Hope this helps.

Thanks necrolin, can I use this at command prompt?

C:\>cd tc

Is it possible for me to write my code from there?

You can use the editor "edit" if you like. Again, it won't be nearly as convenient as something designed specifically for programming, like Code::Blocks, but that's your choice.

As far as directories go I suppose there is nothing stopping you from using the tc directory. However, I believe that the best place for your files is to place everything in "My Documents". You can always place a directory like "Programs" or something in your documents folder and just compile everything from there.

Not sure if you have a compiler installed on your computer. If not, you'll need one to convert your code into an actual runnable program. The GCC compiler can always be downloaded from if need be.

Its not hard and i only started learning C++ in november this year! You just code it and will appear in command prompt (cmd), unless you want to create a new window, which is more complex. If we helped, click solved thread!

Hope I helped you, mate!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.