Professional Documents
Culture Documents
C++
www.lsp4you.com
What is C++
A Simple Program
Comments in C++
Output Operator
Input Operator
Cascading of I/O Operator
Structure of a C++ Program
www.lsp4you.com
C++
www.lsp4you.com
A Simple Program
www.lsp4you.com
A Simple Program
// my first program in
C++
#include <iostream.h>
int main ( )
{
cout << "Hello World!";
return 0;
}
www.lsp4you.com
Hello World!
continue
Comments in C++
// line comment
/* block comment */
www.lsp4you.com
Comments in C++
continue
www.lsp4you.com
Output Operator
cout << "Hi, this is my program!";
cout is a predefined object that represents
the standard output stream in C++, here
the standard output stream is screen.
scr
een
<<
cout
Object
Insertion Operator
www.lsp4you.com
C++ variable
scr
een
Output Operator
<<
cout
Object
continue
C++ variable
Insertion Operator
cout
cout
www.lsp4you.com
Input Operator
cin >> number1;
cin is a predefined object that corresponds
to the standard input stream in C++, here
the standard input stream is keyboard.
Object
Extraction Operator
>>
cin
Keyboard
www.lsp4you.com
C++ variable
50.55
Input Operator
Object
Extraction Operator
>>
cin
continue
C++ variable
50.55
Keyboard
www.lsp4you.com
Cascading of I/O
Operators
www.lsp4you.com
Structure of a C++
Program
Include files
Class declaration
Member functions declaration
Main function program
www.lsp4you.com