Lab 01
Lab 01
Lab 01
Startup
Type the following program in your editor
1 #include <iostream>
2
3 using namespace std;
4
5 main()
6 {
7 cout << "Programming is ";
8 cout << "great fun!";
9 }
Task-01
Write a program that has following character variables: first, middle, and last.
Store your initials and then display them on your screen.
Try to store initials with single quotes and observe the output
Try to store initials with double quotes and observe the output
Task-02
Write a program that defines an integer variable named age and a float variable named
weight. Store your age and weight in the variables. The program should display
these values on the screen in a manner similar to the following:
Program Output
My age is 20 and my weight is 180 pounds.
(Feel free to lie to the computer about your age and your weight it’ll never know!)
1
Algorithm Workbench
Task-03
Convert the following pseudocode to C++ code. Be sure to define the appropriate
variables
Store 20 in the speed variable.
Store 10 in the time variable.
Multiply speed by time and store the result in the distance variable.
Display the contents of the distance variable.
Task-04
Convert the following pseudocode to C++ code. Be sure to define the appropriate
variables
Store 172.5 in the force variable.
Store 27.5 in the area variable.
Divide area by force and store the result in the pressure variable.
Display the contents of the pressure variable
Programming Challenges
2
Task-08 (Ocean Level)
Assuming the ocean’s level is currently rising at about 1.5 millimeters per year, write a
program that displays:
The number of millimeters higher than the current level that the ocean’s level will
be in 5 years
The number of millimeters higher than the current level that the ocean’s level will
be in 7 years
The number of millimeters higher than the current level that the ocean’s level will
be in 10 years
Submission Instructions
Store File as Lab-01-Task-01.cpp (Task Number will change with each task)
Write Observation File for your lab task and store as readme.docx
All .cpp files and .docx file must be compresses as YOUR_ROLL_NUMBER-Lab-
01.zip
Only submit one zip file that contains all the lab tasks.
Discuss Problems with each other but write your code independently.
All copied labs will be treated as zero.
The Labs are graded and marks in the labs will be accumulated in your final results
of lab.
Never Miss a lab submission. Missing a lab means you missed a question in your
examination.
****************** BEST OF LUCK ***********
3