ProductsLogo
LogoStudy Documents
LogoAI Grader
LogoAI Answer
LogoAI Code Checker
LogoPlagiarism Checker
LogoAI Paraphraser
LogoAI Quiz
LogoAI Detector
PricingBlogAbout Us
logo

Computer Programming Lab - Structures and Classes

Verified

Added on  2021/07/28

|10
|541
|208
AI Summary
This article is about Computer Programming Lab on Structures and Classes. It includes solved assignments and programs on creating a phone number database, movie database, student information system, and more. The tasks include creating a rectangle using a point structure, developing a student information system, and creating a movie database using structures.

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Computer Programming Lab
spring 2021
Submitted by: ADNAN AYAZ
Registration No.: 20PWCSE1860
Class Section: A
“On my honor, as student of University of Engineering and Technology, I have neither given
nor received unauthorized assistance on this academic work.”
Student Signature: ______________
Submitted to:
SIR ABDULLAH HAMID
JULY 25, 2021
Department of Computer Systems Engineering
University of Engineering and Technology, Peshawar

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Lab 10 &;11: Structures and Classes
Objectives:
To learn about data structures and classes in C++
Tasks:
Task 1:
1. 1. A phone number such is (091) 767-8900 can be thought of as having three parts: the area
code (091), exchange (767) and number 8900. Write a program that uses structure to
store these 3 parts of a phone number separately. Assume name of the structure is
‘phone’. Create two objects of type ‘phone’, initialize one object and take the other one
from the user. Display both numbers.
Sample Run:
Enter you Area code, exchange, and number: 091 767 8900
My number is (042) 867-4982
Your number is (091) 767-8900
CODING:
Document Page
OUTPUT:
Document Page
Task 2:
2. Write a C++ Program where you create a movie database using structures. i.e the struct
must have two members “title” and “year”. For test run add 3 movies into the database
and then display the move title and names.
CODING:
OUTPUT:

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Task 3:
3. A point on a two-dimensional space has two numbers: an ‘X’ coordinate and a ‘Y’
coordinate such as (4, 5). Write a program that uses a structure called ‘point’ to model a
point and draw a rectangle of ‘*’ based on the entered height and width of the rectangle.
Sample Run:
Enter the point coordinates: (x, y)
3 2
Enter width of the rectangle: 3
Enter Height of the rectangle: 2
* * *
* * *
CODING:
Document Page
OUTPUT:
Document Page
Task 4:
4. Write a program to develop student information system. This system should be able to
take the student’s credentials, like name, reg no and semester no, as input and store them
in a structure object Student. The system should be capable of storing the information
of multiple students.
And it should be capable of displaying the student’s information, when asked to do so,
via reg no.
.
CODING:

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
OUTPUT:
Document Page
Task 5:
Make a C++ Program that will have a Class of your choosing. You can pick your own
concept it doesn’t need to be a specific Class (for example we in lab we made a class
about rectangle choose anything like that). Your class must contain the following:
 Constructor
 Member functions
 Data members
 Destructor
CODING:
OUTPUT:
Document Page
1 out of 10
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]