First program in C++ || hello world in C++
{tocify} $title={Table of Contents}
In the below program we are not using (using namespace std;)
// C++ program to display "Hello World" // Header file for input output functions #include <iostream.h> #include <conio.h> // Main() function: where the execution of // program begins void main() { // Prints hello world cout<<”Hello world”; getch(); } |
Output:- Hello world |
<iostream.h>
The
header file <iostream.h> is input output stream, it is use to control the
input output operation in C++ language.
<conio.h>
Another
header file <conio.h> is console input output, it is used in an old DOS
compilers to create text user interfaces.
Void main()
Void: is a
keyword in c++ language, void means nothing, whenever we use void as a function
return type then that function nothing return. here main() function no return
value.
There must
be a main() function in every program. The execution of all C++ programs begins
at the main function. There are two circular brackets after the word main. This
is due to the fact that it is a function declaration (a subsequent blog will go
into more depth about functions). Within the round brackets, you can
encapsulate a list of parameters.
{}
The
beginning and end of the function main are denoted by the two curly brackets
(one at the beginning and one at the end). Also known as the function's body.
When the function is called and performed, it executes everything that is
written between these curly brackets.
cout << “Hello World”;
In C++, the
standard output stream is represented by cout.
(There is
also a standard input stream Read more). A series of characters (Hello World)
will be sent to the standard output stream (in most situations, your screen).
The words
Hello World must be placed between " ", however the " "
will not be printed on the screen. They indicate where the sentence begins and
where it will stop.
getch();
It
is a function that use to hold the output screen until the user passes a key
from the keyboard to exit the screen.
Data science & data analyst
- Data Cleaning and Preprocessing in Data Science
- Advanced Data Analysis Techniques: Unlocking Insights from Data
- Data Visualization Techniques in Data Science
- Descriptive Statistics in Data Sci
- Data Science Tools and Techniques
- Scope of Data Science
- Why learn Data Science? | Why Data Science?
- Impact of Data Science
- The Importance of Data in Science | Introduction to Data Science
- What is Data Analysis | Data Analyst for Beginners
C++
- Introduction of C++ || Definition of C++
- Brief history of C++ || history of C++
- Features of C++ || why we use C++ || concept of C++
- Concept of OOP || What is OOP || Object oriented programming language
- Difference Between OOP And POP || Different Between C and C++
- Characteristics of C++
- Interesting fact about C++ || Top 10 interesting fact about C++
- C++ Program Structure
- Writing first program in C++ || how to write hello world in C++
- Basic Data Type And Variable In C++
- Identifier in C++
- Keywords in C++
- Token in C++
- Comment in C++
- Constant in C++
- Modifier in C++
- Taking User Input in C++ | User input in C++
- Input Output Operator In C++
- C++ Operators | Operator in programming language
- How to Add two number in C++
- Polymorphism in C++
- Compile Time Polymorphism in C++
- Function overloading in C++
- Operator Overloading in C++
- What are Control Structures in C++ || Understanding Control Structures in C++ | How to use if, else, switch
- What are Functions and Recursion in C++ | How to Defining and Calling Functions
- Class in C++
- Object in C++