0% found this document useful (0 votes)
28 views

C++ Basics: Prepared By: Ms. Marichu A. Bautista

C++ basics document outlines key elements of a basic C++ program: 1) The #include directive imports the iostream library for input/output stream functions like cout. 2) The using namespace std statement allows the program to access standard library functions without prefixing std. 3) The int main() function declaration indicates this is the starting point and returns an integer value.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

C++ Basics: Prepared By: Ms. Marichu A. Bautista

C++ basics document outlines key elements of a basic C++ program: 1) The #include directive imports the iostream library for input/output stream functions like cout. 2) The using namespace std statement allows the program to access standard library functions without prefixing std. 3) The int main() function declaration indicates this is the starting point and returns an integer value.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

C++ BASICS

Prepared by: Ms. Marichu A. Bautista


LINE 1
#include <iostream>

#include is a preprocessor
instruction <iostream> -
brackets tell the
preprocessor to look in all
the places for this file
iostream
(input-output-stream)
LINE 1
#include <iostream>

Effect:
To include the file
iostream into the
program
LINE 2
using namespace std;
- We are telling the
compiler to use a
group of functions
included in the
standard library std;
- The function that we
are using is the cout
function in line 6.
LINE 4
int main ( );
- main ( ) must state what
kind of value it will return.
- the return value type for
main is void, which means
that this function will not
return any value at all.
- If a program is executed
without this function, it
will not run at all.
LINE 5
{ } opening and closing
braces
- everything between the
opening and closing
braces is considered a part
of the function.
LINE 6
cout<<
- the object cout is used to
print a message to the
screen.
- cout (console output)
- << output redirection
operator
(whatever follows the output
redirection operator is
written to the screen)
LINE 8
return 0;
- shows whether or not the
function successfully
executed.
cin>> (input redirection operator)

- this asks for an input from the user.


- this will not work if the variable for
the input is not declared.

You might also like