Вы находитесь на странице: 1из 7

Sukkur-Institute of Business

Administration
Faculty of Computer Science
Introduction to Information Programming (Fall-
2014)
LAB No. 2
Prepared by: Ghulam Mujtaba Shaikh
Last updated on: 09th August, 2014

Objective of Lab No. 2:


After performing lab1, students will be able to:
o Use Comments
o Use Escape Sequences
o Use Variables
o Use Numeric Data types
o Use Measureable data types
o Use basic Arithmetic operators
o Using cin>>
Sample Programs:

Sample Program No. 1


Sample Program No. 2
Sample Program No. 3
Sample Program No. 4
L
ab Exercises:

Exercise No. 1:
Write a C++ program to print numbers from 1 to N on the same line with each pair of
adjacent numbers separated by space in the following ways:
(Where N is the number of characters in your first name like Wasif Ali N will be 5)
Using one statement with one stream insertion operator
Using N statement
Using one statement with N stream insertion operators

Exercise No. 2:
Write a program that displays your favorite poem.

Exercise No. 3:
Write a program to print a box, an arrow and diamond of asterisks using escape sequences

Exercise No. 4:
Develop a C++ program that inputs marks of three students (using integers) from the user
and then calculates and displays their sum, average and the minimum marks. Your program
should work like following screenshot.
Exercise No. 5:
Write a small program for KFC restaurant. In the program first of all you set the price of
Burgers, Broast, Ice cream and cold drink. After that the program will ask you enter the
number of burgers, broast, ice cream and cold drinks you want. Finally the program should
calculate the total amount for each product and grand amount for whole order.

Вам также может понравиться