How to Write Standard Code in C++
Download a C++ IDE (integrated development environment) such as Eclipse, Netbeans, and CodeBlocks, or you can use a plain text editor such as Notepad++ or VIM., Create a main program file., Begin writing your program., Insert comments in your code...
Step-by-Step Guide
-
Step 1: Download a C++ IDE (integrated development environment) such as Eclipse
You can also run programs from the command line, in that case any text-editor will suffice.
It might be handy to choose an editor which supports syntax highlighting and line-numbers.
Most programmers find that unix-like systems (linux, OS X, BSD) are the best environments for development. -
Step 2: Netbeans
The main file must include a function called main().
This is where execution of the program begins.
From here, you should be calling functions, instantiating classes, etc.
Other files of your application as well as libraries can be included into this file. , Insert your code or the program that you need to build (see below for a few examples).
Learn the syntax, semantics, Object-Oriented Programming paradigms, data striations, algorithm designs such as linked lists, priority queues, etc.
C++ is not an easy language to program in, but doing so teaches you the fundamentals that extend to all programming languages. , Explain what your functions do and what variables are for.
Choose clear names for variables and functions.
Capitalize the names of global variables.
In general: make sure that anyone reading your code can understand it. , Again, see the examples below. ,, -
Step 3: and CodeBlocks
-
Step 4: or you can use a plain text editor such as Notepad++ or VIM.
-
Step 5: Create a main program file.
-
Step 6: Begin writing your program.
-
Step 7: Insert comments in your code.
-
Step 8: Use proper indenting in your code.
-
Step 9: Compile your code with g++ main.cpp
-
Step 10: Run your program by typing: ./a.out
Detailed Guide
You can also run programs from the command line, in that case any text-editor will suffice.
It might be handy to choose an editor which supports syntax highlighting and line-numbers.
Most programmers find that unix-like systems (linux, OS X, BSD) are the best environments for development.
The main file must include a function called main().
This is where execution of the program begins.
From here, you should be calling functions, instantiating classes, etc.
Other files of your application as well as libraries can be included into this file. , Insert your code or the program that you need to build (see below for a few examples).
Learn the syntax, semantics, Object-Oriented Programming paradigms, data striations, algorithm designs such as linked lists, priority queues, etc.
C++ is not an easy language to program in, but doing so teaches you the fundamentals that extend to all programming languages. , Explain what your functions do and what variables are for.
Choose clear names for variables and functions.
Capitalize the names of global variables.
In general: make sure that anyone reading your code can understand it. , Again, see the examples below. ,,
About the Author
Nicholas James
Professional writer focused on creating easy-to-follow practical skills tutorials.
Rate This Guide
How helpful was this guide? Click to rate: