C++ Program Structure
Before going into the C++ program language, you need to learn C++ program structure.
C++ Program Structure
C++ program primarily divided into 5 parts
- Preprocessor
- Functions
- Variables
- Statements & Expressions.
- Comments
Simple C++ Program
#include <iostream> using namespace std; int main() { cout << "Welcome to Onlinetpoint"; return 0; }
- #include <iostream> is preprocessor command. It is standard input output library functions.
- int main() is main function where the program start execution.
- /* ... */ is comment line which ignored by the compiler.
- cout << "Welcome to Programtpoint"; is display the message "welcome to programtpoint" on the screen.
- using namespace std; This line help the compiler to use the std namespace.
- return 0; statement is terminates the main() function. 0 and 1 value are successful and unsucessful execution.
Additional Information
- #include<conio.h> is used for performing console input and output functions.
- getch() - It is used to hold the screen in simple language if you don’t write this screen will just flash and go away. By using this function we can read a character directly from the keyboard.
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.