-
Notifications
You must be signed in to change notification settings - Fork 0
/
C++Syntax.cpp
24 lines (13 loc) · 1.49 KB
/
C++Syntax.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream> //header file library
using namespace std; // using standard library
int main() { // main function
cout << "Hello World \n"; // first object
cout << "Learn C++ \n\n"; // second object with blank line
cout << "Educative Team"; // third object
return 0; // no other output or return
} // end of code
// #include <iostream> is a header file library. A header file imports features into your program. We’re basically asking that the program copy the content from a file called <iostream>. This stands for input and output stream, and it defines the standards for the objects in our code.
// using namespace std means that we are using object and variable names from the standard library (std). This statement is often abbreviated with the keyword std and the operator ::. The int main ( ) is used to specify the main function.
// It is a very important part of C++ programs. A function essentially defines an action for your code. Anything within the curly brackets { } will be executed.
// cout is an object (pronounced see - out). In this example, it defines our outputs: the strings of words. We write a new object using cout on the second line. The character \n makes the text execute on a different line.
// Including two \n\n creates a blank space. By writing return 0, we are telling the program that nothing will return. We are only outputting strings of text. Note that we use the << operator to name our objects. The semi colon ; functions like a period.