first cpp program

7
Yogi’s Guide to C++ Yogi’s Guide to C++ First C++ Program Yogendra Pal

Upload: learn-by-watch

Post on 16-Jan-2017

313 views

Category:

Education


1 download

TRANSCRIPT

Page 1: First cpp program

Yogi’s Guide to

C++Yogi’s Guide

toC++

First C++ ProgramYogendra Pal

Page 2: First cpp program

www.learnbywatch.com | [email protected]

At the end of this tutorial you will be able to• Explain and write the minimal skeleton of C++ program.

• Write C++ programs without classes.

• Use cin and cout.

• Use comments in C++ programs.

• Use Code::Blocks IDE to write, compile and run C++ programs.

Page 3: First cpp program

www.learnbywatch.com | [email protected]

First C++ Program• Write a program to print a line of text

on computer screen.

Page 4: First cpp program

www.learnbywatch.com | [email protected]

Comments• Single line comment

• Multiple line comment

“Use comments to document your source

code.”

//this is single line comment

/* this is multiple line comment */

Page 5: First cpp program

www.learnbywatch.com | [email protected]

C++ Program with variable(s)• Write a c++ program that accept an

integer value and print it.

Page 6: First cpp program

www.learnbywatch.com | [email protected]

cin and cout• << is known as output operator when used with cout

• >> is known as input operator when used with cin

• << and >> operators can handle any C++’s data types.

• In a single cin statement we can use more than one variable.

• In a single cout statement you can print many variables and constants.

Page 7: First cpp program

Yogi’s Guide to

C++Yogi’s Guide

toC++

Ask your questionsto learn better

Yogendra Pal

www.learnbywatch.com | [email protected]