0% found this document useful (0 votes)
57 views13 pages

Lab Journal: Computer Programming (2+1 Credit Hours)

The document is a lab journal for a computer programming course. It contains 13 tasks related to programming concepts like variables, data types, decision statements, loops, arrays, functions, pointers and file handling. The tasks involve writing C++ code to perform calculations, read and output data.

Uploaded by

Dawood Shahzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views13 pages

Lab Journal: Computer Programming (2+1 Credit Hours)

The document is a lab journal for a computer programming course. It contains 13 tasks related to programming concepts like variables, data types, decision statements, loops, arrays, functions, pointers and file handling. The tasks involve writing C++ code to perform calculations, read and output data.

Uploaded by

Dawood Shahzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

COMPUTER PROGRAMMING

(2+1 Credit Hours)

CSL-113

LAB JOURNAL

DEPARTMENT OF COMPUTER SCIENCE


BAHRIA UNIVERSITY, KARACHI, PAKISTAN
Student Name: Dawood Shahzad

Registration Number: 02-136221-034

Class & Section: BS(AI)-1

Fall/Spring: Spring

Year: 2022

Lab Day & Timing: 7-March-2022

Course Teacher: Dr. Talha

Lab Engineer: Miss Laila Nadeem


BAHRIA UNIVERSITY KARACHI CAMPUS
Department Of Computer Science

Table of Contents
No. TASKS SIGNATURE

Lab 1 Getting Started ( Microsoft Visual Studio)

Lab 2 Getting Started( Pseudo Code, Algorithms


& Flow Chart)

Lab 3 Variables and Data Types

Lab 4 Decision Statements

Lab 5 Loops (For, While, & Do-while)

Lab 6 Array (One Dimensional)

Lab 7 Multi-Dimensional Arrays

Lab 8 Functions – I

Lab 9 Functions - II

Lab 10 Function Overloading and Recursion

Lab 11 Strings and Structures

Lab 12 I/O stream File handling

Lab 13 Pointers
Task 1:
Install Visual C++ and attach proper screenshots to Lab File.

Solution:
Installed successfully:
Task 2:
Write a C++ program to store statement record such as (Name,
Age, Grade and CGPA).

Solution:
#include <iostream>

using namespace std;

int main()
{
cout << "Name:" << "Dawood Shahzad" << endl;
cout << "Age:" << "30" << endl;
cout << "CGPA:" << "3.8" << endl;
cout << "Grade:" << "A" << endl;
system("pause");
return 0;
}
Task 3:
Write a C++ program to read student’s three grade, calculator
the average of the grade, and then display the average grade.

Solution:
#include <iostream>
using namespace std;
int main() {

int English=5;
int Physics=5;
int Maths=5;
int Average;
Average=English+Physics+Maths;//sum the marks of grades
Average=Average/3;//now divide them by their 3
cout<<"Average is:"<<Average<<endl;
cout<<"Grade 1 numbers are 5"<<endl;//english
cout<<"Grade 2 numbers are 5"<<endl;//physics
cout<<"Grade 3 numbers are 5"<<endl;//maths
system("pause");
return 0;
}
Task 4:
Write program that reads the height, length , and width of the
rectangular box , Calculates and displays the volume.
Note: Volume = lwh.

Solution:
#include <iostream>
using namespace std;
int main() {
int HEIGHT=4;//HEIGHT GIVEN HERE
int LENGTH=8;//LENGTH GIVEN HERE
int WIDTH=6;//WIDTH GIVEN HERE
int volume;
volume = HEIGHT*LENGTH*WIDTH;//USING FORMULA

cout<<"volume of rectangular box is:" <<volume << endl;


system("pause");
return 0;
}

You might also like