0% found this document useful (0 votes)
3 views2 pages

Welcome To C++: Curly Brackets

C++ is a versatile programming language used for creating high-performance applications, derived from C. The document introduces basic C++ syntax, including the structure of a simple program, the main() function as the entry point, and the use of cout for output. It also explains the importance of headers and semicolons in C++ programming.

Uploaded by

olktranslations
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Welcome To C++: Curly Brackets

C++ is a versatile programming language used for creating high-performance applications, derived from C. The document introduces basic C++ syntax, including the structure of a simple program, the main() function as the entry point, and the use of cout for output. It also explains the importance of headers and semicolons in C++ programming.

Uploaded by

olktranslations
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Welcome to C++

C++ is a popular cross-platform language that can be used to create high-performance applications -
operating systems, browsers, video-games, art applications and so on.

C++ was derived from C and is largely based on it.

Q: C++ is a:
A) Movie making program
B) Client-side scripting language
C) General purpose programming language

A C++ program is a collection of commands or statements. Below is a simple program template.

#include <iostream>
using namespace std;

int main()
{
return 0;
}

You will learn what each of the statements does in the upcomming lessons.
For now, remember that the entry point of every C++ program is the main() function, irrespective of
what the program does.

Curly brackets {} indicate the beginning and end of a function, which can also be called the function’s
body. The information inside the brackets indicates what the function does when executed.

Q: Which of the following is the entry point of every C++ program?


a) #include <iostream>
b) using namespace std;
c) int main()

Your First C++ Program


Let’s output „Hello world!” to the screen! To do that , we will add cout << „Hello world”; line to our
main() function body:

#include <iostream>
using namespace std;

int main()
{
cout << “Hello world”;
return 0;
}

cout is the stream object used to perform output on the standard output device which is usually the
display screen.
cout is used in combination with the insertion operator <<.

In C++, streams are used to perform input and output operations.

Ex: Write one line code to output “Hello, world!” on the screen.

cout << “Hello, world!”;


You can add multiple insertion operators ofter cout.

{
cout << “This “ << “is “ << “awesome!”;
return 0;
}

In C++, the semicolon is used to terminate a statement. Each statement must end with a semicolon. It
indicated the end of one logical expression.

Headers
C++ offers various headers, each of which contains information needed for programs to work
properly.
We have already seen the standard <iostream> header on our first C++ program:

#include <iostream>
using namespace std;

int main()

You might also like