-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhelloWorld.cpp
46 lines (33 loc) · 1.15 KB
/
helloWorld.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Hello world program in C++
*/
#include <iostream>
// using is a preprocessor directive
// compiler will prepend 'name_of_namespace::' (std:: here)
// to every function of that namespace used here
using namespace std;
// namespace is kind of a scope of names declared in that namespace
// you can have same named functions, variables, classes, ...
// in different namespaces
// and use a particular one amongst those by using the appropriate namespace
int main () {
// console output, print your output to stdout
// since we are using namespace std,
// we can skip writing "std::" before the function
// in the namespace std
// std::cout << "Hello world";
// "<<" is stream insertion operator
// it inserts whatever follows into into a stream (sequence of bytes)
// and that stream is then display on the output (stdout => standard output stream)
cout << "Hello world\n";
/*
// multiple cout statements can be clubbed by having multiple
// stream insertion operators in between
cout << "Hello ";
cout << "world";
cout << "\n";
// the three lines above and the line below are equivalent
cout << "Hello" << " world" << "\n";
*/
return 0;
}