You are on page 1of 2

PIR MEHR ALI SHAH ARID AGRICULTURE UNIVERSITY

University Institute of Information Technology

CS 323: Programming Fundamentals using C++ 4(2-2)


Teacher: Ms. Farkhanda Qamar

ASSIGNMENT # 1
SUBMISSION DATE: 1st NOVEMBER 2018
1) Assuming there are 7.81gallons in a cubic feet, write a program that asks the user to enter a
number of gallons, and then displays the equivalent in cubic feet.
2) Write a program that generates the following output.
10
20
19
Use an integer constant for the 10, an arithmetic assignment operator to generate the 20, and a
decrement operator to generate the 19.
3) Write a program that displays your favourite poem. Use an appropriate escape sequence for the
line break.
Candy is dandy,
But liquor is quicker.
4) Write a program to show following output using one cout statement.

1 2 3 4 5
6 7 8 9 10
5) Write a program that inputs marks obtained by a student in five subjects. It then calculates and
displays the total marks and percentage.

6) Using Switch statement, write a program that displays the following menu for the food items
available to take order from the customer:
B= Burger
F= French Fries
P= Pizza
S= Sandwiches
The program inputs the type of food and quantity. It finally displays the total charges for the
order according to following criteria:
Burger = Rs. 200
French Fries= Rs. 50
Pizza= Rs. 500
Sandwiches= Rs. 150

7) Write the output of the following piece of code


void main()
{
int a=10, b=20;
++a;
cout<<a++<<endl
cout<<b++<<endl;
cout<<-- b<<endl;
cout<<++a<<endl;
b=b++ +(++a);
cout<<b<<endl;
getch();
}

8) Write a program that takes three numbers as input and check whether all numbers are equal
using logical operators nested If- else structure.

You might also like