Introduction To Computer Laboratory Experiments Manual
Introduction To Computer Laboratory Experiments Manual
Introduction to Computer
Laboratory
Experiments Manual
CSE-111
Semester 1st
Name:_______________________________________________
Roll Number:_________________________________________
List of Experiments
Lab No Topics Remarks Mapping
1 Introduction to Computer’s hardware and programs Using CLO_1
MS office-word
2 Introduction to the MS power point and MS Excel CLO_1
3 Introduction to Internet, Web browsers, and social media CLO_1
4 Introduction to Basic Configuration and Simulation of a CLO_1
Network Using Packet Tracer
5 Operating System Installation CLO_1
Open Ended Lab
6 Introduction to the Multimedia software CLO_1
7 Introduction to IDE for C/C++ and structure of a Basic C++ CLO_2
Program
8 To understand the Data Types, Variables and I/O Functions CLO_2
9 To understand the arithmetic and logic operations CLO_2
10 To understand the decisions: IF-ELSE and SWITCH – CASE CLO_2
statements
11 CLO_2
To understand the control structure using FOR LOOP
12 To understand the control structure using While and DO CLO_2
WHILE loop
13 To Understand the Concept of Arrays CLO_2
14 To understand and use Multi dimension array CLO_2
Open Ended Lab
Marks Evaluation
Marks
Class Experiment Experiment Total
Experiment No. Participation Performance Reporting (1)
(0.3) (0.5) (0.2)
10
11
12
13
14
15
Total
-----------------------------------
Instructor’s signature
Instructor:
Prerequisite: None
Objectives:
This course focuses on coverage of computer science and engineering discipline, introducing computing
environments, general application software, basic computing hardware, operating systems, desktop publishing,
Internet, software applications and tools and computer usage concepts.
Introduction:
This course aims to introduce the students with Computing. The course lays emphasis on foundations of
Computer and communication available in today’s world in the form of internet. Being the first course
towards computing it will discuss elementary concepts of computer software and hardware. It will discuss how to
explore Cyberspace, Communication, Network & Safeguards and Challenges of the digital age.
Learning Outcomes:
Marks Distribution:
Class Performance (Quizzes/Assignments) 20%
Mid Term Exams (1 exam) 30%
Final Exam 50%
Recommended Books:
1. “Discovering Computers – Fundamentals”, Gary B. Shelly, Misty E. Vermaat @2013 (Cengage Learning), ISBN: 1-
1115-3045-9
2. “Using Information Technology: A Practical Introduction to Computer & Communications”, WilliamsSawyer, 9thEd
(McGraw HILL), ISBN: 0077523415
Reference Books:
1. “Computers, Information Technology in Perspective”, Larry Long and Nancy Long, 12thEd, (Prentice Hall), ISBN:
0131405721
2. “Introduction to Computers”, Peter Norton, 6thEd, (McGraw-Hill), ISBN: 0-07-059374-4
Administrative Instructions:
Things will not always go as expected; this is the nature of the learning process. While conducting the
Experiment think before you do anything. If you do so you will avoid wasting time going down dead-end
streets. Be logical and systematic. First, look for obvious errors that are easy to fix. Is your measuring
device correctly set and connected? Are you looking at the proper scale? Is the power supply set for the
correct voltage? Is the signal generator correctly set and connected? How are the variables in the code set?
Is there a syntax error? And so on. Next, check for obvious misconnections or broken connections, at least
in simple circuits.
As you work through your circuit, use your Lab Manual record tests and changes that you make as you go
along; don't rely on your memory for what you have tried. Identify some test points in the system at which
you know what the signal should be and work your way backwards from the output through the test points
until you find a good signal.
Neatness
When you have finished for the day, return all modules to their proper storage bins, return all test leads and
probes to their storage racks, return all equipment to its correct location, and clean up the lab station. If
appropriate switch off the unneeded equipment. Save your files in the Computer and on any USB device for
your records because you might not get the same PC System again for the next experiment. Also email your
file contents to your email address as a backup.
Laboratory Safety
Always pay attention to what you are doing and you’re surrounding during the experiments and notify the Instructor
for any unlikely event or mishap and leave the Laboratory with the permission of Instructor immediately.
All students must read and understand the information in this document with regard to laboratory safety and
emergency procedures prior to the first laboratory session.
Your personal laboratory safety depends mostly on YOU. Effort has been made to address situations that may
pose a hazard in the lab but the information and instructions provided cannot be considered all-inclusive.
Students must adhere to written and verbal safety instructions throughout the academic term. Since additional
instructions may be given at the beginning of laboratory sessions, it is important that all students arrive at each
session on time. With good judgement, the chance of an accident in this course is very small. Nevertheless, research
and teaching workplaces (labs, shops, etc.) are full of potential hazards that can cause serious injury and or damage to
the equipment. Working alone and unsupervised in laboratories is forbidden if you are working with hazardous
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
substances or equipment. With prior approval, at least two people should be present so that one can shut down
equipment and call for help in the event of an emergency. Safety training and/or information should be provided by a
faculty member, teaching assistant, lab safety contact, or staff member at the beginning of a new assignment or when
a new hazard is introduced into the workplace.
Emergency Response
1. It is your responsibility to read safety and fire alarm posters and follow the instructions during an emergency
2. Know the location of the fire extinguisher, eye wash, and safety shower in your lab and know how to use
them.
3. Notify your instructor immediately after any injury, fire or explosion, or spill.
4. Know the building evacuation procedures.
Common Sense
Good common sense is needed for safety in a laboratory. It is expected that each student will work in a
responsible manner and exercise good judgement and common sense. If at any time you are not sure how to
handle a particular situation, ask your Teaching Assistant or Instructor for advice.DO NOT TOUCH
ANYTHING WITH WHICH YOU ARE NOT COMPLETELY FAMILIAR!!! It is always better to
ask questions than to risk harm to yourself or damage to the equipment.
10.Equipment Failure - If a piece of equipment fails while being used, report it immediately to your lab assistant
or tutor. Never try to fix the problem yourself because you could harm yourself and others.
11.If leaving a lab unattended, turn off all ignition sources and lock the doors.
12.Never pipette anything by mouth.
13.Clean up your work area before leaving.
14.Wash hands before leaving the lab and before eating.
15.Unauthorized person(s) shall not be allowed in a laboratory for any reason
Electrical safety
6. Always make sure all capacitors are discharged (using a grounded cable with an insulating handle) before
touching high voltage leads or the "inside" of any equipment even after it has been turned off. Capacitors can
hold charge for many hours after the equipment has been turned off.
7. When you are adjusting any high voltage equipment or a laser which is powered with a high voltage supply,
USE ONLY ONE HAND. Your other hand is best placed in a pocket or behind your back. This procedure
eliminates the possibility of an accident where high voltage current flows up one arm, through your chest, and
down the other arm.
8. Discard damaged cords, cords that become hot, or cords with exposed wiring.
9. Before equipment is energized ensure, (1) circuit connections and layout have been checked by a Teaching
Assistant (TA) and (2) all colleagues in your group give their assent.
10.Know the correct handling, storage and disposal procedures for batteries, cells, capacitors, inductors and
other high energy-storage devices.
11.Experiments left unattended should be isolated from the power supplies. If for a special reason, it must be left
on, a barrier and a warning notice are required.
12.Equipment found to be faulty in any way should be reported to the Lab Engineer immediately and taken out
of service until inspected and declared safe.
13.Voltages above 50 V rms AC and 120 V DC are always dangerous. Extra precautions should be considered as
voltage levels are increased.
14.Never make any changes to circuits or mechanical layout without first isolating the circuit by switching off
and removing connections to power supplies.
15.Know what you must do in an emergency.
16.Emergency Power Off: Every lab is equipped with and Emergency Power off System.
17.Only authorized personnel are permitted to reset power once the Emergency Power Off system has been
engaged.
Electrical Emergency Response
The following instructions provide guidelines for handling two types of electrical emergencies:
1. When someone suffers serious electrical shock, he or she may be knocked unconscious. If the victim is still in
contact with the electrical current, immediately turn off the electrical power source. If you cannot disconnect
the power source, depress the Emergency Power Off switch.
2. Do not touch a victim that is still in contact with a live power source; you could be electrocuted.
3. Have someone call for emergency medical assistance immediately. Administer first-aid, as appropriate.
4. If an electrical fire occurs, try to disconnect the electrical power source, if possible. If the fire is small and
you are not in immediate danger; and you have been properly trained in fighting fires, use the correct type of
fire extinguisher to extinguish the fire. When in doubt, push in the Emergency Power Off button.
5. NEVER use water to extinguish an electrical fire.
Mechanical safety
1. When using compressed air, use only approved nozzles and never direct the air towards any person.
2. Guards on machinery must be in place during operation.
3. Exercise care when working with or near hydraulically- or pneumatically-driven equipment. Sudden or
unexpected motion can inflict serious injury.
Additional Safety Guidelines
9. Maintain unobstructed access to all exits, fire extinguishers, electrical panels, emergency showers, and
eye washes.
10. Do not use corridors for storage or work areas.
11. Do not store heavy items above table height. Any overhead storage of supplies on top of cabinets should
be limited to lightweight items only. Also, remember that a 36" diameter area around all fire sprinkler
heads must be kept clear at all times.
12. Areas containing lasers, biohazards, radioisotopes, and carcinogens should be posted accordingly.
However, do not post areas unnecessarily and be sure that the labels are removed when the hazards are
no longer present.
13. Be careful when lifting heavy objects. Only shop staff may operate forklifts or cranes.
14. Clean your lab bench and equipment, and lock the door before you leave the laboratory.
Clothing
3. Long hair must be tied back, and dangling jewelry and baggy clothing must be secured.
1. Do not panic.
2. Report any accident (spill, breakage, etc.) or injury (cut, burn, etc.) to
the teacher immediately, no matter how trivial it seems.
3. If you or your lab partner is hurt, immediately (and loudly) yell out
the teacher's name to get the teacher's attention.
LAB # 1
Introduction to Computer’s hardware and programs
(Using MS Office - Word)
Objective:
To learn about different parts of computer hardware
Learn to create a word document using different features of MS Word
Apparatus:
Personal
MS office
Background
Software:
Computer software, or just software, is a collection of computer programs and related data that provides
the instructions for telling a computer what to do and how to do it.
Operating system:
An operating system (OS) is a collection of software that manages computer hardware resources and
provides common services for computer programs. The operating system is a vital component of the
system software in a computer system. Application programs require an operating system to function.
Examples:
Microsoft Windows
Linux
Macintosh
Hardware:
Computer hardware is the collection of physical elements that comprise a computer system. Computer
hardware refers to the physical parts or components of computer such as monitor, keyboard, hard disk,
mouse, etc., refers to objects that you can actually touch, like disks, disk drives, display screens,
keyboards, printers, boards, and chips. In contrast, software is untouchable. Software exists as ideas,
application, concepts, and symbols, but it has no substance. A combination of hardware and software
forms a usable computing system. This allows it for computer run better than normally faster.
Two typical components of a CPU are the arithmetic logic unit (ALU), which performs arithmetic and
logical operations, and the control unit (CU), which extracts instructions from memory and decodes and
executes them, calling on the ALU when necessary.
Motherboard:
Figure 3. MotherBroad
The motherboard serves to connect all of the parts of a computer together. The CPU, memory, hard drives,
optical drives, video card, sound card and other ports and expansion cards all connect to the motherboard
directly or via cables.
The motherboard can be thought of as the "back bone" of the computer.
Motherboards, cases and power supplies all come in different sizes called form factors. All three must be
compatible to work properly together.
Motherboards vary greatly in respect to the types of components they support. For example, each
motherboard supports a single type of CPU and a short list of memory types.
Hard disk drives:
A hard disk drive (HDD also hard drive, hard disk, or disk drive) is a device for storing and retrieving
digital information. It consists of one or more rigid ("hard") rapidly rotating discs (platters) coated with
magnetic material, with magnetic heads arranged to read and write data to the surfaces.
RAM (random access memory) is the place in a computer where the operating system, application
programs, and data in current use are kept so that they can be quickly reached by the computer's processor.
RAM is much faster to read from and write
to than the other kinds of storage in a computer, the hard disk, floppy disk, and CD-ROM. However, the
data in RAM stays
there only as long as
your computer is
running. When you
turn the Keyboard computer
off, RAM loses its
data. When you
turn your computer
on again, your
operating system and
other files are once
again loaded into
RAM, usually
from your Mouse / hard disk.
Figure 5. RAM
Touchpad
Random access
memory
Scanner
Microphone
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
Input devices:
The devices that use to enter data and instructions in a computer. For Example:
Output devices:
The devices that allow information to be represented (that is, given out) to the user. For Example:
Monitor
/
LCD
Printer
Speakers
Ports:
Ports are the socket at the back of the computer that allows different peripheral devices to connect to the
computer
Microsoft Word:
Speakers
Microphone
Microsoft Word is a powerful tool to create professional documents.
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
To begin, open Microsoft Word. Your screen will look like the one shown here.
At the left corner of the title bar is the Quick Access toolbar. The Quick Access toolbar provides you with
access to commands you frequently use. By default Save, Undo, and Redo appears on the Quick Access
toolbar. You can use Save to save your file, Undo to roll back an action you have taken, and Redo to
reapply an action you have rolled back.
The Ribbon:
You use commands to tell Microsoft Word what to do. In Microsoft Word 2010, you use the Ribbon to
issue commands. The Ribbon is located near the top of the screen, below the Quick Access toolbar. At the
top of the Ribbon are several tabs; clicking a tab displays several related command groups. Within each
group are related command buttons. You click buttons to issue commands or to access menus and dialog
boxes. You may also find a dialog box launcher in the bottom-right corner of a group. Clicking the dialog
box launcher gives you access to additional commands via a dialog box.
The Status bar appears at the very bottom of your window and provides such information as the current
page and the number of words in your document. You can change what is displayed in the Status bar by
right-clicking on the Status bar and selecting the options you want from the Customize Status Bar menu.
You click a menu item to select it. You click it again to deselect it. A check mark next to an item means it
is selected.
The home tab:
Clipboard Group:
You can use Word's Cut feature to remove information from a document. You can use the Paste feature to
place the information you cut anywhere in the same or another document. In other words, you can move
information from one place in a document to another place in the same or different document by using the
Cut and Paste features. The Office Clipboard is a storage area. When you cut, Word stores the data you cut
on the Clipboard. You can paste the information that is stored on the Clipboard as often as you like.
Furthermore, you can copy information from one area of a document and place the information you copied
anywhere in the same or another document. In other words, after you type information into a document, if
you want to place the same information somewhere else, you do not have to retype the information. You
simply copy it and then paste it in the new location. As with cut data, Word stores copied data on the
Clipboard.
When you need to perform a task in Microsoft Word, you can usually choose from several methods:
The dialogue box launcher
The Ribbon
The Mini-toolbar/context menu
The keyboard.
Document View:
In Word, you can display your document in one of five views: Normal, Web Layout, Print Layout,
Reading Layout, or Online Layout. To change the view of a document, use the view tab.
Print Layout
The Print Layout view shows the document as it will look when it is printed.
Web Layout
Web layout view enables you to view your document as it would appear in a browser such as Internet
Explorer.
Full Screen Reading Layout
Reading Layout view formats your screen to make reading your document more comfortable.
Outline view
The outline view displays the document in outline form. Headings can be displayed without the text. If you
move a heading, the accompanying text moves with it.
Paragraph Group:
When you type information in Microsoft Word, each time you press the Enter key Word creates a new
paragraph. You can format paragraphs. For example, you can indent the first line of a paragraph, you can
set the amount of space that separates paragraphs, and you can align a paragraph left, right, center, or flush
with both margins.
Styles are a set of formats you can quickly apply to a paragraph. For example, by applying a style, you can
set the font, set the font size, and align a paragraph all at once. In this lesson, you will learn about the
various formats you can apply to a paragraph and about styles.
When you are formatting a paragraph, you do not need to select the entire paragraph. Placing the cursor
anywhere in the paragraph enables you to format it. After you format a paragraph, pressing the Enter key
creates a new paragraph in the same format.
Indent Paragraphs:
Indentation allows you to indent your paragraph from the left and/or right margin.
You may find this necessary when you are quoting a large block of text. Try using
the first line indent and hanging indent.
Align Paragraphs
Microsoft Word gives you a choice of several types of alignments. Left-aligned text is flush with the left
margin of your document and is the default setting.
Right-aligned text is flush with the right margin of your document, centered text is centered between the
left and right margins, and justified text is flush with both the left and right margins.
Change Line Spacing
Line spacing sets the amount of space between lines within a paragraph. The spacing for each line is set to
accommodate the largest font on that line. If the lines include smaller fonts, there will appear to be extra
space between lines where the smaller fonts are located. At 1.5, the line spacing is set to one-and-a-half
times the single-
space amount. At 2.0, the line spacing is set to two times the single-space amount (double space).
Bullets and Numbers:
If you have lists of data, you may want to bullet or number them. When
Numbers
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
Bullets
Figure 11Orientation:
Page Size:
Paper comes in a variety of sizes. Most business correspondence uses 8.5 x 11in paper which is the default
page size in Word. If you are not using 8.5 x 11in paper, you can use the Size option in the Page Setup
group of the Page Layout tab to change the Size setting.
Margins define the amount of white space that appears at the top, bottom, left, and right edges of your
document. The Margin option in the Page Setup group of the Page Layout tab provides several standard
margin sizes from which you can choose.
1. Choose the Page Layout tab.
2. Click Margins in the Page Setup group. A menu appears.
3. Click Moderate. Word sets your margins to the Moderate settings.
Inserting Picture:
Copy the picture from any source and paste in MS word. Pictures can be placed in different forms in MS-
Word. MS- Word also allows pictures to be inserted from clip art.
Conclusion:-------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-------------------------------------------
Lab Exercise:
1) Label the diagram of the motherboard.
2) Write an article on any topic comprising of three paragraphs. Use the following MS Word
features:
a. Bold, Italic, Underline, Highlight, Small Caps.
b. Different Line Spacing
c. Bulletin or Numbering
d. Paragraph Alignment
e. Insert a picture relevant to your topic on the right side of your paragraph
f. Place your name and student id at the top right in font size 10.
g. Attach a print out of this article with your manual.
4. ----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
LAB#2
Introduction to the MS power point and MS excel
Objective:
Learn to create presentations using Microsoft power point
Learn to create spreadsheets using Microsoft excel
Background:
File
presentation
Editing tools, such as Copy, Cut and Paste. Commands that will change
Home
the appearance of fonts, paragraphs and borders.
Insert objects into your presentations such as pictures, text boxes, sound
Insert
and movie.
Design Change how your presentation appears on screen.
Animations Add animations to your presentation.
Slide show Commands that control how your slideshow will be viewed.
Review Editing tools such as Spell checker and thesaurus.
View View your presentation in various ways.
Creating a Presentation
it. Design templates specify how your presentation will look overall and includes the colour
scheme, placeholder sizes and positions, font style, type and size of bullets etc.
Inserting New Slides:
There are several different views in PowerPoint. These views can be accessed by clicking on the
appropriate View Button at the bottom of your screen.
Each view has its own use in the creation of a presentation. There are 3 views that you will use
frequently when creating a presentation.
Normal View:
Normal View is split into three panes – Slides/Outline, Slide and Notes. This view can be useful
when you want to work on all three areas of your presentation at once. The panes can be resized
by taking your mouse cursor over the pane line, holding down your left mouse button, and
dragging the cursor in the appropriate direction.
Slide Sorter View:
This view is excellent for giving you an overall view of your presentation and also allows you to
quickly rearrange your slides (very useful for obtaining a logical order to your presentation).
Slideshow View:
This view allows you to view your presentation as a slide show. To move forward through your
slides, either click your mouse, or use the down arrow key on your keyboard. To exit your
slideshow, press the Esc key.
Saving and Closing Your Presentation:
3. Give your presentation a name (be descriptive). The PowerPoint file should have the extension
‘.pptx’.
4. Choose Save.
To save your presentation under a different name, use the 'Save As' command instead of 'Save'.
Printing:
Before printing a presentation, choose the Print Preview command, which can be found by
choosing File tab→ Print → Print Preview. The presentation will appear on a new screen, and
will let you see how your presentation looks before it is printed. It is a good idea to see if any
text or objects are spilling over a page.
To print a presentation, choose File tab→ Print (the print dialog box will appear):
The print dialog box is similar to other office packages; however, in PowerPoint you have the
option to choose what aspect of your presentation you would like to print. It is possible to print:
Slides
Handouts
Notes Pages
Outline View
To choose what you would like to print, click on the drop-down list in the ‘Print what’ area.
Note: If you choose ‘Handouts’, the Handouts options will become active.
Slide Design:
Microsoft PowerPoint provides slide design templates and themes that you can apply to a
presentation to give it a complete professional look.
Customizing a Slide Design
A Design Theme contains a background, colour scheme and font selection(s) for your
presentation. It is a quick way of jazzing up a presentation. PowerPoint comes with a range of
predefined themes for your use. You can find the set of slide design themes from Design
→Themes.
Put mouse over a design theme to preview its application to your presentation. The
theme can be applied to all slides or selected slides, and you can apply more than one type of
design theme in a single presentation. Right click a theme and decide if you would like it applied
to the selected slide (Apply to Selected Slides) or the whole presentation (Apply to All Slides) by
using the corresponding menu command.
Pictures:
A wide range of media and graphical materials such as still and animated pictures can be
incorporated into a PowerPoint presentation. Pictures of any format may be used: jpeg, bmp, gif,
tiff, etc. To add a picture:
1. Click Insert →Picture and select from your files.
2. Locate the picture file that you want to insert, click Insert.
3. With the picture selected, you can edit it using the Picture Tools to set the effect you want:
2. In the Format Background window, click on the Fill tab, and choose Picture or texture fill.
Click the File… button, find the picture and insert.
3. The background can be applied to one or all your slides. If you wish to use a different
picture on each slide, apply the picture only to the slide showing, insert a new slide and
repeat the steps until you have all pictures backgrounds on presentation.
Tip: If you want a transition scheme on multiple slides, highlight the slides first from the Slides
pane on the left side of the screen. (Use the CTRL key to highlight random slides.) Then, choose
the transition scheme and it will apply to the highlighted slides.
Sound:
Sound may be part of the slide transition or it may be inserted as part of the animation sequence.
Inserting Sound
1. Click Insert →Sound →Sound from Clip Organizer.
2. The Clip Art window appears.
3. Click a sound clip to insert it to the slide. You will be asked if you want the sound to play
automatically or on a mouse click.
Movie:
Inserting Movie
Charts:
Creating Charts
You can create charts in PowerPoint so that you can animate and add sound to them. If you have
data and charts already created in other applications you can copy the data into
3. You can enter your own data on the datasheet, import data from a text file or paste data from
another program. (Select the data on the spreadsheet and delete the sample data before
inputting new data.)
4. When data is complete, click on the slide, outside the chart area and see the slide as it would
be presented.
5. With the chart selected, the Chart Tools will appear in the Ribbon. You can do more settings
using the Chart Tools, e.g. change the chart layout or style.
Note: The spreadsheet and chart works just like any Excel spreadsheet and chart so you can
manipulate the data and chart just as you would in Excel.
Animating Charts :
1. Select the chart that you want to animate.
2. Click Animations →Custom Animation.
3. In the Custom Animation window, click on the Add Effect button and select an effect. This
will animate the chart as a whole.
4. To animate the elements of a chart, select the effect, click on the down arrow of the effect
and select Effect Options, a box as in the figure appears – click on the Chart Animation tab,
and select one of the effects from the Group chart box.
General Shortcuts
CTRL + N
CTRL + M
CTRL + O
CTRL + S
CTRL + W
CTRL + P
F1
New presentation
New slide in presentation
Open presentation
Save presentation
Close presentation
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
Print presentation
Help
Slide Show Shortcuts
F5
Esc
B
CTRL + H
, or Spacebar
, or Backspace
<number> + Enter
View slide show
End slide show
Display a black screen
Hide the pointer and button
Next slide or animation
Previous slide or animation
Go to slide <number>
Element 2:
Text and images kept within a reasonable distance from the edges of the slide. This prevents the
slide from looking over-crowded.
Element 3:
Slides those are easy to read. Avoid flashy color schemes, fonts, and animation. These features
should complement a presentation, and not be the presentation itself.
NOTE: Choose "Slide Design - Color Schemes" from the task pane menu to see a variety of
predesigned schemes you can apply to your slides.
Element 4:
Use the slides as prompts and not as a script to be read aloud. Sometimes audiences find it
distracting to try to read and listen at the same time.
Element 5:
When you’re making your presentation, create the content of your presentation first, and then get
creative with colors and animation.
Theory
Microsoft Excel:
Microsoft Excel is the most widespread program for creating spreadsheets on the market today.
Spreadsheets allow you to organize information in rows and tables (which create cells), with the
added bonus of automatic mathematics. Spreadsheets have been used for many, many years in
business to keep track of expenses and other calculations. Excel will keep track of numbers you
place in cells, and if you define cells to refer to each other, any changes made in one cell will be
reflected in these referring cells. It sounds a bit complicated, but Excel makes it all a breeze.
OPENING MICROSOFT EXCEL:
Start >> Programs >> Microsoft Office >> Microsoft Office Excel 2010
Microsoft Excel will automatically open with a blank spreadsheet spanning many columns and
rows. You will notice a number of toolbars with many more options included.
Presentation of data in tables
In all aspects of your university study and professional career, good, clear presentation of data
and information is essential to the success with which your audience receives your information.
Simple features within Excel can really enhance how your data looks and improve comparability
of data sets.
After entering the following data set into Excel we will use features, to improve the presentation
of the data.
From this....
Entering data
When you open a workbook, by default, Excel selects cell A1 as the active cell.
1. Select the row below where you want to position the new row, by clicking on the row
heading (i.e. 1 2 3 4, etc).
2. Right click your mouse while your cursor is over the row heading.
3. Click on Insert.
Merging cells
To centre a heading across the width of the data set
1. Select the cell that contains the heading and drag the cursor across the columns that
represent the data set.
Windows Button > Print > Print Preview > Page Setup. Select the Orientation under the Page tab
in the Page Setup dialog box to make the page Landscape or Portrait. The size of the worksheet
on the page can also be formatted under the Scaling title. To force a worksheet to be printed on
one page, select Fit to 1 page(s).
Margins:
Change the top, bottom, left, and right margins under the Margins tab. Enter values in the
Header/Footer fields to indicate how far from the edge of the page this text should appear. Check
the boxes for centering
Header/footer:
Add preset Headers and Footers to the page by clicking the drop-down menus under the
Header/Footer tab.
To modify a preset Header or Footer, or to make your own, click the Custom Header or Custom
Footer buttons.
A new window will open allowing you to enter text in the left, center, or right on the page.
Format Text – After highlighting the text click this button to change the Font, Size, and Style.
Page Number - Insert the page number of each page.
Total Number of Pages - Use this feature along with the page number to create strings such as
"page 1 of 15".
Date - Add the current date.
Time - Add the current time.
File Name - Add the name of the workbook file.
Sheet Name - Add the name of worksheet.
Picture - Add a picture.
SHEET:
Click the Sheet tab and check Gridlines box under the Print section if you want the gridlines
dividing the cells to appear on the page. If the worksheet is several pages long and only the first
page includes titles for the columns, select Rows to repeat at the top of the Print titles section to
choose a title row that will be printed at the top of each page.
Autosum function
To automatically total a row or column of numbers
For a row of numbers, select the empty cell directly to the right of the numbers, then:
1. Click the AutoSum button on the right hand side of the Home ribbon
2. The SUM formula including the range of numbers selected will appear in the formula bar
3. Check you have the correct range and then press the Enter button.
OR
For a column of numbers, select the empty cell directly below the numbers, then continue
with steps 1 to 3 above.
Rounding
To round a decimal value to a whole number or simply increase or decrease the number of
decimal places a value has:
Select the cell/s containing the value/s you want to alter
1. Click on the Decrease Decimal button to remove decimal places
OR
2. Click on the Increase Decimal button to add decimal places
Mple calculations
To carry out simple calculations:
1. Think about how you would do the problem in your head or on your calculator.
2. Think about how Excel may carry this out and get Excel to do it by clicking on the relevant
cell/s and using the appropriate combination of:
addition+
subtraction-
multiplication*
division /
brackets ()
to the power of ^
3. Round appropriately using the “Decrease Decimal” button or the “Increase Decimal” button
as per Rounding instructions above.
Percentages
To create a percentage from a proportion (decimal), simply use the Percent Style button. This
will automatically display the proportion (decimal) to the nearest whole percent, so:
0.003 will become 0%
0.03 will become 3%
0.3 will become 30%
3 will become 300%
1. Select the cell/s containing the number/s you want to alter
2. Click on the Percent Style button to round to the nearest whole percentage
Borders
Borders can be applied individually to each of the 4 sides of a cell or applied to a group of cells.
Borders allow you to separate data groups and highlight specific sections of data. To add a
border to a cell or group of cells
1. Select the cell(s) that you want to place a border around
2. Click on the down arrow of the Borders button on the toolbar. A range of different border
buttons will be displayed.
3. Click on the Borders button you want for the selected cells.
Sorting data
would look just by pointing at them in the dialog box, even before you make a choice.
Let’s say we want to see graphically the sales of beverages in our café in the first 3 months of the
year.
1. Select the cells containing the sales data, including cells with text (e.g. column and row
headings for the data.)
2. Select Insert tab.
3. Select Column icon from Charts group
4. Select Clustered Column chart from 2-D Column type
The chart shows the sales of the 4 different beverages grouped together for each month. What if
we want to see what happened in the sales of each beverage month over month? Select the chart,
Chart Tools -> Design -> Data -> Switch Row/Column.
Chart elements
A chart has many elements. Some of these elements are displayed by default; others can be
added as needed. You can change the display of the chart elements by moving them to other
locations in the chart, resizing them, or by changing the format. You can also remove chart
elements that you do not want to display.
Here are some standard chart elements.
1. The chart area encompasses the entire chart and all its elements.
2. The plot area is that area bounded by the axes, including all data series, category names, axis
titles, and all markers that represent data points.
The data points are the individual values plotted in a chart and represented by bars, columns,
lines, pie or doughnut slices, dots, and various other shapes called data markers. Data markers
of the same color constitute a data series (i.e. related data points. You can plot
one or more data series in a chart, but pie charts have only one data series.
3. The horizontal (category) or vertical (value) axis is a line bordering the chart plot area used as
a frame of reference for measurement. The y-axis is usually the vertical axis and contains
data. The x-axis is usually the horizontal axis and contains the categories.
4. A legend is a box that identifies the patterns or colors that are assigned to the data series or
categories in a chart.
5. A chart title is the descriptive text for a chart. Note that horizontal and vertical axes usually
have titles too.
Modifying charts
After you create a chart, you can modify it. For example, you may want to change the way that
axes are displayed, add a chart title, move or hide the legend, or display additional chart
elements.
To modify an element in the chart, you can right-click on it and choose the appropriate (format)
option. Or, you can use the appropriate tabs, groups and options under Chart Tools. Add titles to
a chart: Chart Tools -> Layout -> Labels -> Chart Title
Add axis titles to a chart: Chart Tools -> Layout -> Labels -> Axis Title
Add legend to a chart: Chart Tools -> Layout -> Labels -> Legend
Add data labels to a chart: Chart Tools -> Layout -> Labels -> Data Labels
Add data table to a chart: Chart Tools -> Layout -> Labels -> Data Table
To change formatting and layout of each axes: Chart Tools -> Layout -> Axes ->Axes
To turn gridlines on or off: Chart Tools -> Layout -> Axes -> Gridlines
To format the plot area: Chart Tools -> Background -> Plot Area
To format the chart wall (for 3-D charts): Chart Tools -> Background -> Chart Wall
To format the chart floor (for 3-D charts): Chart Tools -> Background -> Chart Floor
To change 3D viewpoint of a chart: Chart Tools -> Background -> 3-D Rotation
To move chart to a different sheet: Chart Tools -> Design -> Location -> Move Chart
Conclusion:-------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-------------------------------------------
Lab Exercise:
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
Create a marks sheet on Microsoft excel, which calculates the total, percentage and average of 5
courses of a student. Also create a chart to display the result in graphical form
Sample spread sheet
LAB-3
Introduction to Internet, Web browsers, and social media
Objective:
To learn the basics of Web Browsers Setting, Internet and Social Media
Background:
Internet is a worldwide collection of computer networks that allows people to find and use
information and communicate with others. This also allows accessing their resources, such as
files, services, or other people. A web browser is a software application which provides the
environment for retrieving, presenting, and traversing information resources on the Internet.
Internet Terminology
The most important parts of the World Wide Web are the elements, such as servers, pages, hot
links, and more--all of which comprise the bulk of the World Wide Web. The following are some
related terms:
Address: The unique location of an information site on the Internet or a specific file (for
example, a Web page).
Internet Protocol: A set of rules. On the Internet, this translates into the set of rules computers
use to communicate across networks.
TCP/IP: An abbreviation for Transmission Control Protocol/ Internet Protocol. Set of rules used
to connect computers on the internet.
Megahertz (MHz): One hertz represents a single cycle of current per second in a circuit. A cycle
is merely the time it takes an electron to make a "trip" between two points in a circuit. A
megahertz represents 1,00,00,000 cycles per second. PC speed is usually gauged in megahertz,
so a 66MHz processor can complete 6,60,00,000 cycles in one second.
Download: To copy a file from one computer system to another. From the Internet user's point of
view, to download a file is to request it from another computer (or from a Web page on another
computer) and to receive it.
Upload: Transferring a file to a host computer from the user’s computer, usually using FTP.
Internet Service Provider (ISP): An organization or company that provides its users access to the
Internet.
The World Wide Web, a hypertext based system, is the fastest growing part of the Internet, as
well as the most exciting. In time, most daily activities may very well take place through the
World Wide Web. It is practically entertaining as well as provides practical education and
business.
The most important parts of the World Wide Web are the elements, such as servers, pages, hot
links, and more--all of which comprise the bulk of the World Wide Web. The following are some
related terms:
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
Web site: A collection of World Wide Web documents, usually consisting of a home page and
several related pages. The user might think of a Web site as an interactive electronic book.
Uniform Resource Locator (URL): The World Wide Web address of a site on the Internet.
Webmaster: The individual responsible for maintaining and updating the content of a World
Wide Web document. Webmasters are the creative force behind the World Wide Web.
Home page: Frequently, the "cover" of a particular Web site. The home page is the main, or
first, page displayed for an organization's or person's World Wide Web site.
Hypertext Transfer Protocol (HTTP): A standard used by World Wide Web servers to provide
rules for moving text, images, sound, video, and other multimedia files across the Internet.
Bookmark: A saved link to a Web site that has been added to a list of saved links so that the
user can simply click on it rather than having to retype the address when visiting the site again.
Link: Short for "hypertext link." A link provides a path that connects the user from one part of a
World Wide Web document to another part of the same document, a different document, or
another resource. A link usually appears as a uniquely colored word that the user can click to be
transported to another Web page.
Anchor: A link that takes the user to a different part of the same Web page.
FAQ: Stands for Frequently Asked Questions. Many times, newcomers to a newsgroup will ask
questions that the old-timers have heard over and over again. FAQs are written and posted
periodically to reduce the number of redundant questions.
Hits: When conducting an Internet search on the Web, each result of a particular search is called
a hit.
Finding Information on the Internet
The Internet isn't called the Information Superhighway for nothing. The Internet is information.
Sometimes unfiltered, many times even useless, more information is available on the Internet
than any one person could ever deal with. There are Search Engines which can help the user find
just about anything he wants. A search engine is a computer program that indexes a database and
then enables users to search it for relevant information.
Using the WWW for Communication
The most popular use of the Internet is the World Wide Web. In the following sections, are a few
ways people are using the Internet to communicate with one another.
Personal Communication - Email:
E-mail makes up a majority of Internet traffic today. They provide a cheap, fast and convenient
way of communicating with each other. Some of the terms which users come across while using
email are as follows:
POP: This term stands for Post Office Protocol, which is the technical name for the way some e-
mail clients receive their mail.
SMTP: This term stands for Simple Mail Transport Protocol, which is another technical name for
the way e-mail messages are sent on the Internet by the clients.
Spam: Any mass-mailed material meant for self-promotion, advertisement, or pure silliness.
Spam, or electronic junk mail, is probably one of the most offensive aspects of the Internet.
Every e-mail message contains two basic parts: the header and the body. The body is simply the
text that the user wants the person on the other end to see on receiving the message. The
following are the different headers the user needs to be concerned about when sending e-mail:
To: field contains the e-mail address of the person to whom the e-mail is being sent.
From: This field includes sender’s e-mail address.
Subject: It contains a very short (20-30 characters) description of what the message is about.
5. It stands for Carbon Copy and contains the e-mail addresses of additional recipients.
BCC: It stands for Blind Carbon Copy, gives the sender a way of copying an e -mail message to
another person without the first person he sends the message knowing about it.
Attachments: It enables the user to attach entire documents to e-mail messages.
Date: This header is not visible to the senders; many e-mail servers require it to process e-mail.
This header is filled by the current Time and Date control panels of the user’s PC.
Mailing Lists - List-servers
After the advent of e-mail, users soon realized that being able to send e-mail to groups of people
for collaboration and discussion would be very helpful. This e-mail list "server" managed a large
number of mailing lists, each one addressing a specific area of interest for network users and
each having an independent set of list members. This service made the exchange of ideas and
information among the members very convenient.
Usenet and Newsgroups
A Usenet has a machine that is dedicated solely to storing and serving news. The user can read
from and post to the news server using a news client. The user then can read what he wants,
when he wants--instead of having tons of list-server mail jamming up his mailbox. These news
servers organize, distribute, and keep track of thousands of messages.
Newsgroups cover topics regarding recreation, society, culture, business, and computers (of
course). Usenet can be thought of as a structure, or umbrella, that encompasses the thousands of
newsgroups that make up Usenet.
Communicate in Real Time
In the last few years, the Internet has been hit by a wave of real-time communication. The
processes of getting information, talking to others, and collaborating with colleagues no longer
require a waiting period.
Web Browser
Web Browser is a software program that lets the user finds, see, and hear material on the World
Wide Web, including text, graphics, sound, and video. Popular browsers are Internet Explorer,
Mozilla Firefox, Google chrome, safari, Netscape, and so on. Most online services have their
own browsers.
In this lab, we have to do practice same general setting on a Mozilla Firefox,
Advanced panel - Accessibility, browsing, network, updates, and other advanced settings in
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
also known as, "redditors," submit content which is then voted upon by other members. The goal
is to send well-regarded stories to the top of the site's main thread page.
Pinterest is a social curation website for sharing and categorizing images found online. Pinterest
requires brief descriptions but the main focus of the site is visual. Clicking on an image will take
you to the original source, so, for example, if you click on a picture of a pair of shoes, you might
be taken to a site where you can purchase them. An image of blueberry pancakes might take you
to the recipe; a picture of a whimsical birdhouse might take you to the instructions.
Furthermore, Brian Solis created the following social media chart, known as the conversation
prism, to categorize social sites and services into various types of social media. Social media is
becoming an integral part of life online as social websites and applications proliferate. Most
traditional online media include social components, such as comment fields for users. In
business, social media is used
to market products, promote brands, and connect to current customers and foster new business.
Conclusion:-------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-------------------------------------------
Lab Exercise:
LAB-4
Introduction to Basic Configuration and Simulation of a Network
Using Packet Tracer
Objectives:
Computer Network:
A network is a group of two or more computer system linked together. There are many types of
computer networks, including:
LAN: Local Area Network
WAN: Wide Area Network
MAN: Metropolitan Area Network
Network topology:
A topology is the way of laying out the network. It is of 2 types:
1. Physical topology
2. Logical topology
Physical topology:
It tells the physical arrangement of the nodes in a network. There are 5 major physical
topologies:
Bus
Star
Ring
Mesh
Hybrid
Logical topology:
It tells how the message travels in the network. There are 3 major ways of data travelling in a
network:
Ethernet
Token ring
FDDI
Physical topolgy:
Bus topology:
Logical topology:
Ethernet:
Ethernet is the most popular network architecture. It can be configured in a star or bus
topology.
1. In a star topology, all devices are connected to a central device. This device is usually a
hub or switch.
2. In a bus topology, each computer is connected to a single cable or a backbone.
Figure 6.Ethernet
3. The Token will then pass from device to devices. Each device will look at the data to
determine if it was meant for them.
4. When the destination device gets the Token, it strips off the data and attaches a reply
to the Token and sends it out.
5. The original sender strips off the reply and sends out the free Token.
FDDI:
FDDI is Fiber Distributed Data Interface. Although FDDI normally uses fiber optic cable it can
use UTP (unshielded twisted pair cable) as well. Because of the cost, FDDI is usually used to
connect LANs together and not devices. FDDI works very much like Token Ring. However,
FDDI allows multiple users to attach data to the Token.
Figure 9. FDDI
FDDI is sometimes called Dual-Counter Rotating Rings. It uses the concept of dual ring we
discussed in ring topology. There are two pieces of fiber that carry data in opposite directions.
One ring is called the Primary the other the Secondary. Most data gets transmitted on the primary
ring. The secondary ring is usually reserved for system maintenance and if there is a failure of
the primary ring. If one ring breaks, any device can switch data from one ring to the other. This
causes the data to travel in the opposite direction.
Tcp/ip address configuration:
The builder of a house must ensure that all construction takes place on a firm foundation. The
same is true for the builder of a TCP/IP-based networking system. Fundamental network
configuration problems will plague all network users until they are resolved.
MS Windows workstations and servers can be configured either with fixed/static IP addresses or
via DHCP (Dynamic Host Configuration Protocol). The examples that follow demonstrate the
use of DHCP and make only passing reference to those situations where fixed IP configuration
settings can be affected.
It is possible to use shortcuts or abbreviated keystrokes to arrive at a particular configuration
screen. The decision was made to base all examples in this chapter on use of the Start button.
Ms windows 7 configuration
IP Address
IP addresses are four sets of numbers separated by periods that allow computers to identify each
other. Every computer has at least one IP address, and two computers should never have the
same IP address. If they do, neither of them will be able to connect to the internet.
Dynamic vs Static IPS
Most routers assign dynamic IP addresses by default. They do this because dynamic IP address
networks require no configuration. The end user can simply plug their computer in, and their
network will work. When IP addresses are assigned dynamically, the router is the one that
assigns them. Every time a computer reboots it asks the router for an IP address. The router then
hands it an IP address that has not already been handed out to another computer. This is
important to note. When you set your computer to a static IP address, the router does not know
that a computer is using that IP address. So the very same IP address may be handed to another
computer later, and that will prevent both computers from connecting to the internet. So when
you assign a static IP addresses, it's important to assign an IP address that will not be handed out
to other computers by the dynamic IP address server. The dynamic IP address server is generally
referred to as the DHCP server.
Setting up a Static IP for Windows
Here is paths to the Windows 7 navigate to the Control Panel, choose Network and Internet, and
then click Network and Sharing Center.
Click Start -> Control Panel -> Network Connections.
The following procedure steps through the Windows 7 static IP configuration process:
1. Click the Local Area Connection to begin configuring your static IP address.
From the Local Area Connection Status window, click the Details button to see your
existing connection details (most likely DHCP). If you’re running this in VMWare
Fusion, the 172.16.153.129 is the first IP address allocated. You should note the default
gateway and DNS server IP address, which should always be 172.16.153.2. Click the
Close button when you’ve made note of those IP addresses for subsequent steps
Back at the Local Area Connection Status window, click the Properties button. It will show
you the Local Area Connection Properties dialog. Click on the Internet Protocol Version 4
(TCP/IPv4) in the item box of the dialog window.
Click the Use the following IP address radio button and enter the appropriate values for your
static IP address. The default gateway and DNS server are generally different but are the
same when you’re using NAT addressing inside VMWare.
IPCONFIG Command
IPCONFIG Command Is used to find out your current TCP/IP settings. With IPCONFIG you can
find out your IP Address, find your Default Gateway and find your Subnet Mask. This is a very
handy network tool for finding your local IP address.
IPconfig /all Command
IPconfig /all Command are used to display all your IP information for all adapters. With ipconfig
/all you can also find out your DNS Server and MAC Address. This will show your full TCP/IP
configuration for all adapters on your Windows machine. You can find out your own IP Address
as well as your default gateway.
IPconfig /release
IPconfig / release Command is use to release your current IP information and obtain a new IP
Address from the DHCP server.
IPconfig /renew
IPconfig / renew Command is used to renew your IP Address if you have it set to obtain IP
Address automatically.
IPconfig /displaydns
This shows your current DNS Resolver Cache Logs.
IPconfig /flushdns
This flushes or clears your current DNS Resolver Cache Logs.
Ping Command
The Ping command is a network tool used to determine if you are able to send packets between
your computer networks on the internet to another computer without losing packets along the
way. By doing this you can determine if you're online or if a website is down. It also calculates
round trip time and Time to Live. This can let you know if your NIC card is working properly
and if you're able to reach your router or modem. It can also be used as a network tool for
troubleshooting.
The Simulator
Packet Tracer Overview:
1 Menu Bar This bar provides the File, Edit, Options, View, Tools,
Extensions, and Help menus. You will find basic commands such
as Open, Save, Print, and Preferences in these menus. You will
also be able to access the Activity Wizard from the Extensions
menu.
2 Main Tool Bar This bar provides shortcut icons to the File and Edit menu
commands. This bar also provides buttons for Zoom, the drawing
Palette, and the Device Template Manager. On the right, you
will also find the Network Information button, which you can
use to enter a description for the current network (or any text you
wish to include).
3 Common Tools This bar provides access to these commonly used workspace tools:
Bar Select, Move Layout, Place Note, Delete, Inspect, Add Simple
PDU, and Add Complex PDU. See "Workspace Basics" for more
information.
4 Logical/Physical You can toggle between the Physical Workspace and the Logical
Workspace and Workspace with the tabs on this bar. In Logical Workspace, this
Navigation Bar bar also allows you to navigate through levels of a cluster, create a
new New Cluster, Move Object, Set Tiled Background, and
Viewport. In Physical Workspace, this bar allows you to navigate
through physical locations, create a New City, create a New
Building, create a New Closet, Move Object, apply Grid to the
background, Set Background, and go to the Working Closet.
5 Workspace This area is where you will create your network, watch
simulations, and view many kinds of information and statistics.
6 Realtime/Simul You can toggle between Realtime Mode and Simulation Mode
ation Bar with the tabs on this bar. This bar also provides buttons to Power
Cycle Devices as well as the Play Control buttons and the Event
List toggle button in Simulation Mode. Also, it contains a clock
that displays the relative Time in Realtime Mode and Simulation
Mode.
7 Network This box is where you choose devices and connections to put into
Component Box the workspace. It contains the Device-Type Selection Box and the
Device-Specific Selection Box.
8 Device-Type This box contains the type of devices and connections available in
Selection Box Packet Tracer 5.1. The Device-Specific Selection Box will change
depending on which type of device you choose.
9 Device-Specific This box is where you choose specifically which devices you want
Selection Box to put in your network and which connections to make.
10 User Created This window manages the packets you put in the network during
Packet simulation scenarios. See the "Simulation Mode" section for more
Window* details.
Creating Devices:
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
Creating Networks:
Start creating a network by first selecting the End Devices. Add a Generic PC and a Generic
Server to the workspace.
Under Connections, select the Copper Straight-through cable (solid black line) and connect the
devices with it. The red lights on the link indicate that the connection is not working. Now, use
the Delete tool to remove the Copper Straight-through cable, and use a Copper Cross-over cable
(dashed line) instead. The lights should turn green at this point, and if the mouse pointer is held
over either the PC or the Server, the link status will be shown as “Up.” The network should lo ok
similar to the picture above.
Click on the PC. While paying attention to the link lights, turn the power on, off, and on again.
Follow the same steps for the server. The link lights turn red when the device is off. This means
that the link is down or is not working. The link lights turn green when the device is turned back
on.
Try all three ways to learn about the devices. First, mouse over the devices to see basic
configuration information about them. Second, click on each device with the Select tool to show
the device configuration window, which provides several ways to configure the device. Third,
use the Inspect tool to view tables the network device will build as it learns about the network
around it. In this example, only the ARP tables will appear. Since the devices have not been
configured yet, the ARP tables are empty. Always remember to close windows after viewing
them or they will clutter the workspace.
Open the PC configuration window and change the settings using the Config tab. Change the
display name to Client and set the DNS server to 192.168.0.105. Under Interface, click
FastEthernet and set the IP address as 192.168.0.110. Packet Tracer automatically calculates
other parameters. Make sure that the Port Status box is checked. For future reference, note that
other Ethernet interface settings, such as bandwidth, duplex, MAC address, and subnet mask can
be modified using this window.
Go to the Desktop Tab and click on IP Configuration. Notice that the IP address, subnet mask
and DNS server can be changed here as well.
Open the Server configuration window and go to the Config tab. Change the display name to
Web Server. Click FastEthernet and set the IP address as 192.168.0.105. Make sure that the Port
Status is also on. Click DNS and set the domain name as www.firstlab.com. Set the IP address as
192.168.0.105 and click Add. Finally, check to make sure that the service for DNS is on.
Reposition the network devices by dragging them to a new location. Add a network description
by using the “i” button on the upper ri ght corner. Then add some text labels within the Logical
Workspace by using the Place Note tool.
Load a background grid using the Set Tiled Background button.
Save your work using the File > Save As option and create a meaningful filename.
Conclusion:-------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-------------------------------------------
Lab Exercise:
1.Check network configuration of your computer & ping your IP in CMD (Command Prompt-
line interpreter)..
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
2.Create a hybrid network and simulate the flow of data among the different devices of the
network using below addressing scheme.
Gateway: 192.168.1.1
DNS server: 192.168.1.100
IP address: 192.168.1.2 – 50
Subnet Mask : 255.255.255.0
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Lab-5
Operating System Installation
Objective:
General installation method of operating system
Learn to install Microsoft Windows 7 Procedure
Intro to install Microsoft Windows 7 on Virtual Machine (VMware Workstation 7)
Background:
Installing of any fresh operating system, first we will have to delete all of the data on the hard
disk and then install Windows on their computer which can take 30 to an hour depending on
computer hardware and operating system. The installation process is given below.
Procedure:
Enter your computer's BIOS. Turn off the computer that you want to install Windows on
then turn it back on. When the BIOS screen appears or you are prompted to do so,
The boot options menu of your BIOS may vary in location or name from the illustration, but you
may eventually find it if you search around.
Select the CD-ROM/USB/LAN drive as the first boot device of your computer. Although
this method may vary among computers, the boot options menu is typically a menu of
moveable device names where you should set your drive i.e. (CD-ROM /USB/LAN) as the first
boot device. It can also be a list of devices that you can set the order of their boot on.
Save the changes of the settings. Press the button indicated on the screen or select the save
option from the BIOS menu to save your configuration.
Windows 7 Installation:
Installing Windows 7 can take up to an hour depends on computer configuration. The installation
process is given below.
Steps to Follow:
Insert the Windows 7 DVD into your disc drive and restart your computer.
If prompted to start from the CD, press SPACEBAR. If you miss the prompt (it only appears for
a few seconds), restart your computer to try again.
It will now load the setup files.
4. Select your language, time & currency format, keyboard or input method and click Next.
Click Upgrade if you already have a previous Windows version or Custom (advanced) if
you don’t have a previous Windows version or want to install a fresh copy of Windows 7.
(Skip this step if you chose Upgrade and have only one partition) Select the drive where
you want to install Windows 7 and click Next. If you want to make any partitions, click
Drive options (advanced), make the partitions and then click Next.
Install Windows on your preferred hard drive and partition. Once you’ve decided on
where to install Windows, select it and click Next. Windows will begin installing.
It will now start installing Windows 7. The first step, (i.e. Copying Windows files) was already
done when you booted the Windows 7 DVD so it will complete instantly.
After completing the first step, it will expand (decompress) the files that it had copied.
The third and fourth step will also complete instantly like the first step.
After that it will automatically restart after 15 seconds and continue the setup. You can also click
Restart now to restart without any delays.
After restarting for the first time, it will continue the setup. This is the last step so it will take the
most time than the previous steps.
It will now automatically restart again and continue the setup. You can click Restart now to
restart without any delays and launch their first desktop.
Type your desired user name in the text-box and click Next. It will automatically fill up the
computer name and if you want to set a password, type in the text-boxes and click Next.
Type your product key in the text-box and click Next. You can also skip this step and simply
click Next if you want to type the product key later. Windows will run only for 30 days if you do
that.
If you are connected to any network, it will ask you to set the network’s location.
CONGRATULATIONS! YOU ARE ALL DONE. Windows 7 setup is complete. You can log on
by clicking your name on the logon screen. If you’ve installed Windows 7 on a new computer or
new hard disk drive, you can now use the File and Settings Transfer Wizard to copy your
important data to your computer or hard disk drive.
VMware is a virtualization platform where you can install multiple Operating Systems (OS)
on your desktop or laptop computer. A desktop or laptop with good processing power and
plenty of available memory is all that you will need to unlock your desktop from a single OS
to multiple OS’s. For example, if your computer is running Windows Vista but you want to
experiment with Windows 7 for development or certification, you can install a guest OS of
Windows 7. In fact, you can install an entire virtual domain on a single computer.
6. Let’s begin by opening VMware Workstation from the Start menu. Alternatively, you
can type, “VMware” in the instant search field and select VMware Workstation from the list of
programs
Next, click File | New | Virtual Machine. A wizard appears to create a new virtual
machine
6. Click “Next” and choose how you want to load Windows 7. You can load it from
installation media (DVD) or you can use an ISO image. For the purposes of this article, we
will use an ISO image
Next, select “Installer disc image file (ISO)” and browse to where your Windows 7 ISO image
resides. Click “Next” and enter the Windows 7 product key. Note: You can optionally
personalize Windows 7 with a user and password.
Click “Next”, and enter a virtual machine name and choose a location for your virtual
machine to reside. You can simply accept the defaults and move forward in the installation
Click “Next” and accept the default disk size of 40 GB. You can increase or decrease this
size as you see fit. Experimenting with different sizes will help you obtain your sweet spot
for all Windows 7 virtual machines. Additionally, you have the option of splitting the virtual
machine in 2 GB files; this will help when moving your virtual machines between
computers.
2. Click “Next” and you can customize your virtual machine hardware prior to
beginning the Windows 7 virtual machine Operating System (OS) load
For example, you can add disks, serial ports, and printers. You can also remove
unnecessary hardware such as floppy drives and sound cards.
Click OK and Finish and Windows 7 begins to load. Since you entered the product key,
VMware Workstation enters an “Easy Install” mode. Just sit back, relax, and a Windows 7
virtual machine is installed.
Finally, if you must stay current on a wide range of different technologies, including the
multitude of operating systems on the market such as Windows 95, 98, NT4, 2000, XP, Vista,7,
8, Server (2000, 2003, 2008), and other permutations of the Windows operating systems,
virtualization is the answer.
Now that your virtual machine is ready, you can use it like it was a physical computer. If
you choose View | Full Screen, you can work with your virtual machine a full-screen mode.
Other options you have when working with virtual machines is the following:
Conclusion:-------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-------------------------------------------
Lab Exercise:
Install the WINDOWS – 7 using Windows-7 .ISO file on VMWare Work Station,
Make at least two partitions of available Virtual Hard disk.
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Create two users, one Admin of your name and one Standard User.
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Step of login window along with your name and roll number.
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Purpose:
This is a statement of problem to be investigated. It provides the overall direction for laboratory
investigation and must be addresses in the conclusion.
Procedure:
1. Step by step procedure carefully explained in a numbered sequence.
2. All experimental variables identified and named
3. Brief description of how the independent variables are controlled.
Hint:
Open ended lab must be so much descriptive such that someone who has not studied the topics covered in
open ended lab must be able to understand it and be able to reproduce the results.
Data:
1. What data needs to be taken?
2. Draw data tables
Data Analysis:
1. How do you interpret data?
2. Draw graphs, analyze them or perform calculations in order to analyze collected data.
Conclusion:
1. Discuss any questionable data or surprising results.
2. Explain the possible source of any error.
3. Suggest changes in experimental design that might test your explanations.
LAB-6
Introduction to the Multimedia software
Objective:
Introduction to basic multimedia tools using adope potoshop.
Background:
Multimedia is media and content that uses a combination of different content forms. This
contrasts with media that use only rudimentary computer displays such as text-only or traditional
forms of printed or hand-produced material. Multimedia includes a combination of text, audio,
still images, animation, video, or interactivity content forms. Multimedia is usually recorded and
played, displayed, or accessed by information content processing devices, such as computerized
and electronic devices, but can also be part of a live performance. Multimedia devices are
electronic media devices used to store and experience multimedia content. Multimedia is
distinguished from mixed media in fine art; by including audio, for example, it has a broader
scope. The term "rich media" is synonymous for interactive multimedia. Hypermedia can be
considered one particular multimedia application.
Types of Multimedia
Adobe Photoshop is a graphics editing program developed and published by Adobe Systems.
Adobe Photoshop is the premier photo editing software tool available. Whether you are working
on a webpage, PowerPoint presentation, or a document to be printed, Photoshop can be used to
enhance your images. In this lab we will learn about image file types, cropping images,
compositing (putting several images together), ghosting images (for use as webpage
backgrounds), using layers, creating masks, applying filters, and formatting text with bevels and
other effects.
Adobe Flash (formerly called "Macromedia Flash") is a multimedia and software platform used
for authoring of vector graphics, animation, games and Rich Internet Applications(RIAs) which
can be viewed, played and executed in Adobe Flash Player. Flash is frequently used to add
streamed video or audio players, advertisement and interactive multimedia content to web pages,
although usage of Flash on websites is declining.
Flash manipulates vector and raster graphics to provide animation of text, drawings, and still
images. It allows bidirectional streaming of audio and video, and it can capture user input via
mouse, keyboard, microphone and camera. Flash applications and animations can be
programmed using the object-oriented language called ActionScript. Adobe Flash Professional is
the most popular and user-friendly authoring tool for creating the Flash content, which also
allows for automation via the JavaScript Flash language (JSFL).
Below is a screenshot that shows what Photoshop looks like. Move your mouse over each section
to see what the different areas are called.
Application Bar - The top of the screen holds common tools that you would use in any situation.
You can change your Workspace from here as well (currently set to 'Essentials'). On the right
side is the "X" to close the application (or you can click on the "Ps" icon to the left as well), and
the other buttons to minimize or shrink the window that program is using.
Menu Bar - This area holds all drop down menus. For example, if you want to see a list of
filters, click on the "Filters" tab to see a complete list of filters that are installed. Many of the
options you'll use are in these menus. For working with photographs, the Image menu will be
used extensively.
Option Bar (below the Menu Bar) - this area changes depending upon which tool is being
used. In this example, the Zoom tool is active, so you will see various options related to zoom,
shown.
Toolbar (in this case, on the left side of the image and lists all of the tools)- the toolbar
contains the most common tools and is usually kept on the screen at all times.
Workspace (the space in which your image is located)- This is where the action takes place. It
contains the design or photo that you are working on. You can vary the size of the workspace
window, zoom in or out, add guides for placement, etc. You'll also hear this referred to as the
Image Window.
Filename (Located across the top of the Work Space window)- This bar shows the file you
are either working on, or if you have multiple files open, each file will have a title bar tab so that
you don't get confused.
Ruler (located on the top and left side of the Workspace Window)- you have the option of
turning the rulers on or off (Ctrl +R), but if they are on you can choose different units such as
pixels or inches by "Right Clicking" in the ruler bar. These are handy when creating designs that
require specific sizes or spacing. You can also "Click & Drag" a guideline from the ruler bar
and place it anywhere on the page or change the measurement starting point by "Clicking &
Dragging" from the upper left corner of the ruler. The visibility of these can be turned on and off
by navigating to "View> Show> Guides" from the "Menu Bar". You can lock them into place
from the same drop down menu.
Windows - Windows contain tools that give you control over the image. Some examples of
Windows are Layers, Colors, Character and History. These aren't really tools like you see in the
toolbar, but offer you complete control over the image and settings. These will be covered in
more depth as they pertain to the later tutorials. These Windows can be docked (fixed in place)
or floating (moved to any area of the screen).
So those are the basic parts of the screen, the later tutorials will refer to them from time to time
so it's good if you get to know them.
From the WINDOW menu, make sure LAYERS and NAVIGATOR have checkmarks beside
them. These are floating palettes that are in the bottom right and upper right corners of the screen
by default.
These basic techniques will help you view and navigate around within an image in PhotoShop:
4. Select a Layer
In the Layer palette (lower right corner) click on a layer to selected it.
The layer will be blue when selected:
Click on the same box (which will be empty when the image is hidden) to show the
layer again.
6. Use the Navigation Palette to zoom in/out and move around in a zoomed image
Click on the lower left corner of a PhotoShop window and hold down the mouse
Select the layer containing the content you want to move or reposition (hide/show to find it).
Click on the move tool (arrow tool) in the upper left corner of the toolbar (left side of the
screen):
Click and drag on the layer to move it as desired.
By making this preference setting, PhotoShop will by default ask you how many PIXELS wide
and high you want a new image to be when you create it.
Next, choose FILE - NEW. Specify the height and width of the new image. For your first image
make it 450 pixels wide and 300 pixels high:
As a rule of thumb for webpage images, use a maximum width of 450 pixels. If you make
images too wide, they will not completely be displayed if a web visitor's screen size is set to 640
x 480, or their browser window is small.
Resolution
Resolution is how many pixels (dots) are included in a defined measurement. Often dpi (dots per
inch) are used as a unit of resolution.
For screen display (PowerPoint) and webpage work: Use 72 dpi o For
graphics that will be printed: Use 300 dpi
Indexed color is used for GIF images. This format is limited to a 256 color palette. The fewer
the colors contained in the palette, the smaller the file size.
CMYK and other image modes are used extensively by commercial print shops, who must have
precise "color separations" for their printers.
Whenever you save a file in Photo Shop, you can choose the FILE FORMAT to save in:
the benefit of retaining the different layers you create in the image
(they stay separate, instead of being "flattened")
After the image is finished, choose to save a copy of the file in the desired format (FILE - SAVE
- under SAVE OPTIONS check "As a Copy"):
Two of the best known image formats (because they are widely used on the internet) are:
JPEG (Joint Photographic Experts Group) retains 24 bit color (millions of colors).
extension is .jpg
Can compress JPEG up to 4:1 (lossy compression, some detail may be lost)
Can compress in PhotoShop.
Extension is .gif
Limited to 8 bit color palatte (256 colors)
Needs to be in INDEXED COLOR format
Best for simple graphics
3 variations of GIF: transparent, animated, and interlaced
When saving a PhotoShop image as a JPG file, several options will be presented:
Select image quality based on the expected use of the file (internet images should be smaller) and
desired quality.
Tools
The PhotoShop toolbar contains a large array of selectable tools for image manipulation. The
toolbar in PhotoShop 6.0 for Windows looks like this:
Multiple Undos
One of the best features of PhotoShop is its ability to allow multiple undos. This means that,
unlike most programs which allow you to just "undo" the last thing you did, PhotoShop will let
you go back MANY steps.
Use the History palette () to "move back in time" and undo past actions.
After a file is closed, actions are not saved, however, so complete all undos before closing.
One of the best sources for graphics is the internet. Any image copied from a webpage can be
inserted into PhotoShop easily.
After an image is copied to "the clipboard," create a new image in PhotoShop (FILE - NEW).
The dimensions of the photograph will automatically correspond to the exact height and
width of the image copied on the clipboard!
When you paste the clipboard contents into the PhotoShop image (see instructions below) the
copied picture is brought in as a NEW PHOTOSHOP LAYER.
Choose to save the image file as a copy and select the desired format. Remember most
photographs should be saved in JPG format to preserve colors most accurately.
Drawing / Painting
The drawing and painting tools are located in the second part of the PhotoShop toolbar:
Whenever a tool is selected, like the Airbrush tool ( ), options for that tool are shown at the
top of the screen and can be changed by clicking on each setting:
Note that some tools, like the Fill tool (Paint Bucket), are hidden by default behind another tool
choice (in this case, the Gradient Tool):
Also note the differences between tools: the Paintbrush tool ( ) located beside the Airbrush
tool, and the Pen tool ( ) located below the Path Component Selection Tool ( ):
The Airbrush tool "applies gradual tones (including sprays of color) to an image,
simulating traditional airbrush techniques." (PS 5.0 Manual, p. 197)
The Pencil tool "creates hard-edged freehand lines and is most useful for bitmapped
images." (SSAA, p. 197)
The Pen tool "lets you create straight lines and smooth flowing curves with greater
precision than possible with the freeform pen or magnetic pen tool. For most users, the
pen tool provides the best control and greatest accuracy for drawing." (SSAA, p. 153)
Layers provide a powerful way for you to organize and manage the various components of
your image. For example, by placing an artwork element on a separate layer, you can easily
edit and arrange the element without interfering with other parts of the image. To organize
related groups of elements, you can nest several layers under a layer set. Layers also provide
the basis for managing and defining advanced features such as Web animations and rollovers.
Move a layer to a new relative location by clicking and dragging it within the layers palette.
Delete a layer by clicking on the Delete Current Layer button on the layers palette. It looks like a
trash can:
Click on the same box (which will be empty when the image is hidden) to show the layer again.
Duplicate a Layer
As a technique, before modifying something in PhotoShop create a duplicate layer, then hide the
original (click on the eye). Then make changes to the copy. If you don't like the changes, delete
the duplicate layer and repeat these steps.
Cropping
One of the most basic ways to edit an image is to CROP it: remove unwanted portions and focus
the viewer's attention on a particular aspect or element.
Cropping a photo means cutting out parts of the photo by making it a smaller rectangle.
Click and drag on the image to define the part you want to KEEP. As a technique, click in the
upper left corner first and then drag down, to the right.
Stretch the crop region "handles" (the boxes in the corners and on the sides of the
Using Type
After selecting the text tool ( ), text options are displayed at the top of the screen that can be
changed as desired:
From the LAYER menu, choose LAYER STYLE, then the desired effect. More than one can be
selected.
12. Compositing
Each image should be inserted as a separate LAYER. Refer to the previous section on
copying/pasting.
When you save the final version as a JPG image, it will be FLATTENED so the different layers
will not be preserved.
Save a copy of the original image in PhotoShop format (PSD) to keep the layers seperate, in case
you want to change something later.
Retouching Photos
With an image open and selected in PhotoShop, choose IMAGE - ADJUST - CURVES.
Click and drag on the line to make the image darker or lighter:
With the PREVIEW box checked, you can immediately see the effects of your curve changes.
Adjust the LEVELS (the definition of pure white, pure black, and the point midway between
these values)
If this result is not desirable, manually define the pure white and black values for your image by
choosing LEVELS from this menu and:
Dragging the triangles under the graph on the left and right sides underneath the levels
graph.
Click on one of the eyedroppers, and then click on the appropriate part of the photograph
(white eyedropper on the right defines pure white, black eyedropper on the left defines
pure black, middle eyedropper defines mid-gray.)
Your image may not include pure white or pure black pixels. If this is the case, don't use
these eyedroppers.
From the same menu (IMAGE - ADJUST) select other variables to change
Either drag sliders to adjust values, or directly input numerical values:
The Clone Stamp Tool allows you to duplicate one part of the screen on another, by
"painting it on"
After selecting it, choose the desired type and size of the brush, depending on what size and type
of cloning you need to do:
Make sure you are in the desired LAYER before using the Clone Stamp Tool.
Hold down the ALT key (Mac: Option key) and click to DEFINE the part of the image
you want to clone.
Release the key and click / drag over the area you want to erase and STAMP a clone of
the defined area.
Color Enhancement
One of the things Photoshop is widely used for is color enhancement. We can achieve this using
a combination of the Levels and Hue & Saturation commands.
The first thing we need to do is adjust the levels of the photograph using the Levels
command. Press CTRL+L to access the dialogue box.
Move the far right slider towards the left until it reaches the start of the first peak. Next alter
the gamma by moving the middle arrow towards the right or left. You will see the changes as
you move the arrow. Select OK when you are satisfied with the new colors.
Now to brighten up the colors. From the Image menu, select Adjust... Hue & Saturation (or
press CTRL+U (WIN) or COMMAND+U (MAC)). From the Edit drop down list, choose
Reds. Move the Saturation slider to the right. Straight away you will notice that only the red
colors within the image have brightened.
You can do the same with any of the other colors in the Edit drop down list. Press OK when
you are finished.
From the EDIT menu choose PASTE (the image should be pasted as a new Photo Shop
layer)
In the Layers palette, change the OPACITY setting (for that layer) between 20 and 30
percent: It may look too faint in Photo Shop, but in a web browser a background with an
opacity greater than 30% tends to compete with overlaying text.
From the LAYER menu, choose FLATTEN IMAGE (this removes the separate layer)
Save the image (FILE - SAVE)
Alternatively, skip steps 6 and 7 and choose FILE - SAVE AS COPY
Conclusion:-------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-------------------------------------------
Lab Exercise
Demonstrate a picture which will have all the features that expressed in lab, and perform
following:
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
i. Select two pictures merge them in a one picture
ii.Change the background colour / theme
iii.Apply at least two different effects on the picture
iv.ADD your name and roll number on a picture
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
LAB # 06
Introduction to IDE for C/C++ and structure of a Basic C++
Program
Objective
To Study the features of Integrated Development Environment (IDE) for C++ language and
basic building blocks and structures of C++ program
Background
IDE Basics:
General Overview:
To enter the IDE, double click on the CodeBlocks icon at the desktop or select from the start
menu. This will make you enter into the IDE interface. Click on the new icon or select it from
the File Menu which will look like the figure given below. Start writing your program where
cursor is currently placed. Press F5 to compile and run your program.
Using Menus
If the menu bar is inactive, you can invoke by pressing the ALT function key. To select different
menu, move the highlight left or right with cursor (arrow) keys. You can also revoke the
selection by pressing the key combination for the specific menu.
Writing a Window
For writing program the Edit window will be active. Type the program code with the proper
syntax and command. Characters will appear where the cursor is positioned. Press [Enter] to
move to the next line. Use the cursor keys to move to any position on the screen. You can delete
characters by using [Del] key. You can delete the entire line by selecting the line and pressing
the [Del] key or by pressing CTRL+Y key combination.
Saving a Program
After typing the program code, you should save it to the disk. To perform this operation, select
Save from the File menu. Pressing the [CTRL+S] combination can also complete this operation.
Save the file and provide an appropriate and unique name to the file. Make sure you add the
“.cpp” extension to your filename. You can save the code after compiling the program but saving
it before is more appropriate.
Executing a Program
If the program is compiled and linked without errors, the program is executed by selecting
Run from the Build menu or by pressing the [F5] key.
Correcting Error
If the compiler, recognize some error, it will let you know through the Build window, which is at
the bottom of the program window. The error will be listed and the line containing the error will
be highlighted.
Now you have to see your Edit window and remove the error by appropriate actions. These
errors are due to different reasons. For example; wrong termination, wrong syntax, etc.
Exiting IDE
Before exiting IDE, programmer must save the necessary source file. If the file is not closed and
you try to exit the IDE, it will ask whether you wish to save the program or exit anyway.
An Edit window can be closed by different ways. You can click on the small cross in the upper
right corner, you can select Close from the Window menu, you can right click on the tab of the
program and click ‘close’ or you can press the [Alt] [X] key combination.
You can close the CodeBlocks IDE by selecting EXIT from the File menu or by pressing the
keys [Alt] [F4].
In order to a write program in any programming language, it is necessary to know about its
command and syntax. Programmers must also know the basic usage of commands and other
programming structures. Programs written in C++ language are really not much difficult to
understand than one written in any other language, once you become familiar with the basic
syntax.
Function Definition:
All C++ programs are divided into units called ‘functions’. Every C++ program consists of one
or more functions. Consider the following program:
#include <iostream>
int main ()
return 0; }
The above program has a function named “main”. This function is one to which control is passed
from the Operating System when the program is invoked, i.e. it is the first function which will be
executed. The word “void” preceding “main” specifies that the function “main” will not return a
value. The second “void” in parentheses specifies that the function takes no arguments.
Delimiters:
The braces after the function definition signal the beginning and the end of the body of the
function. The opening brace { indicates the start of a block of code whereas the closing brace }
indicates the end of block or it terminates the block of code.
Braces are also used to delimit blocks of code in situations other than functions. They are used in
loops and decision-making statements within a program.
Statement Terminator:
Statement in C++ language are terminated with a semicolon “;”. Semicolon terminates the line
not the carriage return you type afterwards. C++ language pays no attention to carriage return in
your program listing. The compiler pays no attention to any of the so called “white space”
characters: the carriage return, the space and the tab.
Programmers can place as many of few white space characters in a program; they will be
invisible and will be ignored by the compiler.
Program Indentation:
As you can place as many white space characters in the program, therefore, they can be used to
make the program easier to read. Consider the previous program, which can also be written as
follows without proper indentation.
The compiler would not know the difference; however, stretching the code out vertically makes
for a more comprehensive program, and aligning and matching braces makes it easier to ensure
that each opening brace has a closing brace.
Indentation of block of code enclosed in braces is an important aspect of making C++ program
readable. Indentation the line of code is not critical in small programs but when there are many
sets of nested braces in a program, indentation becomes increasingly important.
The cout Statement:
Consider the program line:
cout << “This is a program” << endl;
The cout statement causes the phrase in quotes to be printed on screen. The cout statement is
always followed by insertion operator << i.e. every element in the cout statement must be
separated with << operator as it is used to separate the quoted phrase and manipulation operator
“endl”. As C++ language distinguishes between uppercase and lowercase characters, thus the
statements ‘COUT’ and ‘cout’ are not the same.
Syntax
Here e stands for an element. As syntax indicates, cout can take either one element or multiple
elements separated by << operators. Don’t forget ; (semicolon) at the end of cout statement as it
terminates the statement.
Printing strings:
Any symbol or sequence of characters and symbols enclosed within double quotation is treated
as strings in C++. Consider the following program:
#include <iostream>
Using namespace std ;
Compile and run the aforementioned program and note down the output.
Printing numbers:
cout behaves differently when it encounters numerical expressions instead of strings. Recall that
anything enclosed within double quotation is printed as it is on the output screen. Numerical
expressions on the other hand are substituted with the result of expression and resulting answer is
than printed on the output screen. Consider the following program:
}
Compile and run the above mentioned program and note down the output.
Lab Task
Write a program which prints your bio data
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Sample Output
8x1=8
8 x 2 = 16
8 x 3 = 24
8 x 4 = 32
8 x 5 = 40
8 x 6 = 48
8 x 7 = 56
8 x 8 = 64
8 x 9 = 72
8 x 10 = 80
Write a program which prints the following shape on the display screen.
*
**
***
****
Write a program which reads marks for three subjects and then prints total marks and percentage.
Sample Output
Enter Marks for English: 70
Enter Marks for Maths: 70
Enter Marks for Physics: 70
Total Marks: 210
Percentage: 70.0
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
Lab-8
To understand the Data Types, Variables and I/O Functions
Objective:
Learn to write programs declaring different variables and data types
To learn statements for providing input and displaying output
Background:
Variable:
A variable is a named memory location that can hold various values. All variables must be
declared before they can be used. A variable’s declaration serves one important purpose that it
tells the C compiler what type of variable is being used. Variable declaration means that you are
giving an identity to the variable, which is to be used in the program.
Character:
It is one bit long and it is most commonly used to hold a single character. A variable of type
char can also be used as a “little integer” if desired. A character constant is either a single
alphabet, a single digit, or a single special symbol enclosed within single inverted commas. For
example ‘A‘, ‘0‘, or ‘&‘. It requires 1 byte in the memory for storage.
Integer:
Integer may hold signed whole number (Number with no fractional part). It may hold values
in the range –32768 to 32767.
Float:
Data type float hold signed floating-point values, which may have fractional components. Float
can hold very large values.
Variable Declaration:
Type var-name;
Here ‘Type’ is C data type (e.g char, int, float etc )and ‘var-name’ is the name of the variable.
You can also declare more than one variable of same type by using a comma-separated list.
For example
int a,b,c ;
A programmer can assign a unique value to the variable. The general form of an assignment
statement is
For example;
X = 1000;
Example Programs
Program 1:
#include<iostream>
main (void)
int number;
number = 1000;
Output
Program 2:
This program declares different type of variables and prints their assigned values.
#include<iostream.h>
main (void)
int event = 5;
cout<<"The winning time in heat "<< heat <<" of event was "
Output
Variables are used to hold values in memory. All variable must be defined before their usage. C+
+ provides list of primitive data types including int, float, char, double and bool. Variable
definition has the following syntax.
Syntax
Example
int age;
Input Statement:
The cin statement allows the user to enter data from the keyboard. The cin statement allows the
user to enter a number or a single character. The cin statement consists of the keyword cin
followed by the extraction operator (>>) followed by a variableName where the input is to be
stored then ended by a semicolon (;). It has the following syntax.
Syntax
cin >> VariableName;
Consider the following program which prompts a user for the age and then returns his/her age
in days.
main (void)
{
int age;
cout << “Enter your age: “;
cin >> age; //age variable created earlier
cout << “Age in days: “ << age*365 << endl;
Compile and run the program and note down the output.
In C++, decisions to execute or not execute a statement or group of statements can be made by
using the statement if (expression). The expression must be an expression that can be
Syntax
if ( expression )
statement;/ block
Compile and run the following program and note down the output.
#include <iostream>
Using namespace std ;
main (void)
{
int age;
cout << “Enter your age: “;
cin >> age;
if (age <= 0)
cout << “Invalid age” << endl;
Control Structures
if (expression )
statement;/block
else
statement;/block
For clarity and making a program easy to understand, each ‘else’ should be indented the
same amount as its matching ‘if’.
Compile and run the following program and note down the output.
#include <iostream>
Using namespace std ;
main (void)
{
int age;
}
Conclusion:-------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-------------------------------------------
Lab Exercise:
Q1 Write a program that inputs, three numbers and find the greatest numbers among these
numbers.
Sample Output
Enter First Number: 2
Enter Second Number: 3
Enter Third Number: 5
The greatest number is 5
Q2 Write a program that swaps the value of two variables using a third variable
Sample Output
Variable1: 5
Variable2: 9
After swapping
Variable1: 9
Variable2: 5
Q3 Write a program that checks whether the entered year is a leap year or not
Q 4Write a program that checks whether the entered number is positive or negative
Lab-9
To Understand The Arithmetic And Logic Operations
Objective:
Learn to write programs using different arithmetic and logical operators
Background:
Arithmetic Operators:
Arithmetic Operators are used to do basic arithmetic operations like addition, subtraction,
multiplication, division, and modulus.
Types of Arithmetic Operators:
The following table lists the arithmetic operators used in C++.
Sample Program
#include <iostream>
int main( )
int x = 13;
int y = 6;
int a = x%y;
int b = x+y;
return 0;
Program Output:
Unary operators are operators that only take one operand. There are two unary arithmetic
operators, plus (+), and minus (-). These are used as increment and decrement operators.
Examples
x = x+1; x = x-1;
x++; x--;
Sample Program:
#include <iostream>
Using namespace std ;
main()
{
int a = 21;
int c ;
Program Output:
The assignment operator assigns a value to a variable. The assignment operation always takes
place from right to left.
e.g. x = 5;
Sample Program:
#include <iostream>
Program Output:
a:4 b:7
Relational Operators:
In the following table different relational operators are listed that are supported by C++ language
to the value of the right operand
Sample Program
#include <iostream>
Using namespace std ;
main()
{
int a = 21;
int b = 10;
int c ;
if( a == b )
{
cout << “a is equal to b" << endl ;
}
else
{
cout << "a is not equal to b" << endl ;
}
if ( a < b )
{
cout << "a is less than b" << endl ;
}
else
{
cout << "a is not less than b" << endl ;
}
if ( a > b )
{
cout << "a is greater than b" << endl ;
}
else
{
return 0;
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
Program Output:
a is not equal to b
a is not less than b
a is greater than b
Logical Operators:
There are following logical operators supported by C++ that are defined in the table below:
#include <iostream>
Using namespace std ;
main()
{
int a = 5;
int b = 20;
int c ;
if ( a && b )
{
cout << "Line 1 - Condition is true"<< endl ;
}
if ( a || b )
{
cout << "Line 2 - Condition is true"<< endl ;
}
/* Let's change the values of a and b */
a = 0;
b = 10;
if ( a && b )
{
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
}
return 0;
}
Program Output:
Conclusion:-------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-------------------------------------------
Lab Exercise
Q1 Write a program that prints the area and the parameter of the rectangle Area of LxB
Parameter of rectangle: 2(L+B)
Sample Output
Area of a rectangle is 54
not
Write a program that checks whether the number entered as input is odd or
even.
Write a program that takes two numbers as input and then calculate and print the sum,
difference, product and quotients of these two numbers
Sample Output
Enter first number: 6
Enter second number: 2
Sum: 8
Difference: 4
Product: 12
Quotient: 3
Conclusion:
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
LAB - 10
To Understand The Decisions: IF-ELSE And SWITCH – Case
Statements
Objective:
To understand Switch Case Statements in C++
To learn statements for providing flexible jumping within program
Background:
Switch Case statements are additional for long IF declarations that relate a variable to a number
of "integral" values ("integral" values are simply values that can be expressed as an integer,
such as the value of a char or a ASCII Code). The basic syntax for using Switch Case is sketched
under. The value of the variable set into switch is compared to the value following each of the
cases, and when one value matches the value of the variable, the computer continues executing
the program from that point and onwards. If no value matches, it will jump to DEFAULT and
continues excuting from that point.
Explaination:
A C++ switch statement acts as a routing device that tells the computer which line of code to
execute next. On reaching a switch statement, a program jumps to the line labeled with the value
corresponding to the value of integer-expression. For example, if variable has the value 2, the
program goes to the line that has a case 2: label. Also each label must be an integer constant
expression. Most often, labels are simple int or char constants, such as 1 or ‘q’ , or enumerators
(Enumerated data types are types that are well-defined with a set of custom identifiers, known as
enumerators, as possible values. Objects of these enumerated types can take any of these
enumerators as value). If value doesn’t match any of the labels, the program jumps to the line
labeled DEFAULT.The default label is optional. If you neglect it and there is no match, the
program jumps to the next statement following the switch, illustarated in figure below:
Sample Syntax:
switch ( <variable> )
{
case this-value:
break;
case that-value:
...
default:
{Code to execute if <variable> does not equal the value following any of the
cases} break;
Sample Program:
The name of the month can be printed in a switch statement that used the value of "month" to
select the correct name. The switch statement required to select the month could be coded as:
...
Switch (month) {
case 1:
cout << "January ";
break;
case 2:
cout << "February ";
break;
...
...
case 12:
cout << "December ";
break;
}
Example Program – 1:
On the next page, it is the Example program – 1, it simple adds, subtracts, multiply and
divde two integers provided by user:
#include <iostream>
using namespace std;
int main()
{
float a, b, result;
char operation;
cin >> a >> operation >> b; // USER must enter complete syntax example "5+4 or 4-3"
switch(operation)
{
case '+':
result = a + b;
break;
case '-':
result = a - b;
break;
case '*':
result = a * b;
break;
case '/':
result = a / b;
break;
default:
}
cout <<"\nYour Answer is : ";
cout << result << endl;
return 0;
}
Example Program – 2:
Below is the example program – 2, using enum to define a set of related constants and then using
the constants in a switch statement. In general, cin doesn’t recognize enumerated types (it can’t
know how you will define them), so the program reads the choice as an int.When the switch
statement compares the int value to an enumerator case label, it promotes the enumerator to int.
case blue :
Output
Bye
Conclusion:------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
Lab Task:
Write a program that inputs, user grade A to F and display its comments according to grade inputed.
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Sample Output
Excellent!
Write a program that ask user for which shape you want to calculate area (Example Circle, square and
triangle) and then take appropeate input from user to calculate.
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
This lab demonstrates the use of repetition structure named “for loop”.
Background:
Loops
There are many situations where a certain operation is repeated number of time, this repetition is termed
‘loop’ in programming languages. Loops are broadly divided into two categories (1) counted loops (2)
conditional loops. Counted loops are those in which number of iterations can be predicted or counted
whereas in conditional loops one cannot count the number of iterations and loop terminates when condition
is met. Consider a situation in which user is prompted to type any string and program gets input until user
hits the Enter key. In this lab only for loop is discussed which is usually considered a counted loop.
For Loop
There are different loop statements in C++ language and ‘For’ is one of them. These statements also allow
one or more statements to be repeated. The ‘For loop’ is considered most flexible loop because it allows
number of variations. In its most common form, the ‘for’ loop is used to repeat a statement or block of
statements for some specified number of times.
General Form
statement ;/ Block
Program 1
#include <iostream>
using namespace std;
int main ()
{
for ( int count=1 ; count<=10 ; count++ )
}
Initialization
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
count variable is initialized by expression count=1. The initialization expression is always executed only
once at the top of the loop. Loop variable count can be initialized with any integer value and here in our
example it is initialized with integer 1.
Conditional Expression
The expression count<=10 test each time through the loop to see if the count is less than equal to 10 or not.
To do this it is using the relational operator <= (less than or equal to). If the test is true the body of the loop
is executed each time after the test, otherwise exit the loop and control is passed to the statement(s) that are
written just after the loop.
The expression, count++, adds 1 into the value of count variable on each iteration of the loop. A
programmer can also use decrement operator as well instead of the increment operator. Remember that loop
will become infinite if test condition always remains true i.e. count is not increment so it will always have
value 1.
The statement, which is repeated during the loop operation, is termed as the ‘body of the loop’. Here the
statement cout<< “count = ”<< count <<endl; is in the body of the loop. The statement is terminated with
a semi colon whereas For statement is not, this is because the entire combination of the ‘For’ keyword, the
loop expression and the statement continuing the body of the loop are considered to be a single C++
statement.
Program 2
1+2+3+… 10
#include <iostream>
using namespace std;
int main ()
{
int sum=0;
for ( int count = 1 ; count<=10 ; count++ )
Write and compile the program and observe the output generated.
#include<iostream>
using namespace std;
int main ( )
{
cout << “Table of 5” << endl;
cout << “----------” << endl;
for (int i=1; i <= 10; i++)
return 0;
}
Write and compile the program and observe the output generated.
Program 4
This program draws a pyramide of given numbers of rows of stars.
#include <iostream>
using namespace std;
int main()
{
int row, c, n, temp;
cout << "Enter the number of rows in pyramid of stars you wish to see ";
cin >> n;
temp = n;
for ( row = 1 ; row <= n ; row++ )
{
for ( c = 1 ; c < temp ; c++ )
cout << " ";
temp--;
for ( c = 1 ; c <= 2*row - 1 ; c++ )
cout << "*";
cout <<"\n";
}
system (“pause”);
return 0;
}
Write and compile the program and observe the output generated.
Conclusion:------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
Lab Exercise:
Write a program to calculate the factorial of the input number. ( For example: 5! =
1*2*3*4*5 = 120 )
Factorial of a number:
******************
Enter any number: 5
5! = 1*2*3*4*5 = 120
0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,……
12
123
1234
12345
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
The ‘for’ loop does something a fixed number of times. But in a case where you don’t know how many
times you want to do something before you start the loop, you use a different loop: the while loop. Here is
the syntax template for the While loop:
SYNTAX:
while (condition_expr)
statement; / Block
Program 1
This program asks the user to enter a series of numbers, when the number entered is ‘0’, the loop
terminates. Observe that the program does not know in advance, how many numbers will be typed before
the ‘0’ appears, that is upto the user.
#include<iostream>
using namespace std;
int main ( )
{
total ++;
}
cout<< “ You entered ” << total << ” numbers ” <<endl; system
(“pause”);
return 0;
}
Program 2
#include<iostream>
int main ( )
sum = sum + m;
else
m = m + 5;
system (“pause”);
return 0;
Syntax:
do
statement; / Block
while (condition_expr);
Program 3
This program will execute once, even if the initial value of feet is 0
#include <iostream>
int main ()
double feet = 0;
do
cin>> feet;
system (“pause”);
return 0;
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
We’ve made some general statements about how loops are used. The ‘for loop’ is appropriate when you
know in advance how many times the loop will be executed. The ‘while’ and ‘do’ loops are used when you
don’t know in advance when the loop will terminate; the ‘while loop’ when you may not want to execute
the loop body even once and the ‘do loop’ when you’re sure you want to execute the loop body at least
once. This criteria are somewhat arbitrary. Which loop type to use is more a matter of style than of hard-
and-fast rules.
Switch Statement
The switch statement is a selection control structure that allows us to list any number of branches. It is a
control structure for multiway branches.
The value of the ‘switch sxpression’ (an expression whose value is matched with a label attached to a
branch) determines which one of the branches is executed.
Syntax:
switch (n)
{
case 1:
statement(s);
break;
case 2:
statement(s);
break;
case 3:
statement(s);
break;
default:
statement(s);
}
Program 4
#include <iostream>
int main ()
char size;
cout<< “Enter the letter on the tag of your shirt [X, L, M, S]:”;
switch (size)
case ‘X’:
break;
case ‘L’:
break;
case ‘M’:
break;
case ‘S’:
break;
default:
system (“pause”);
return 0;
Conclusion:------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
Lab Exercise:
Q1 Write a program to generate a number table of the given value. The user should be asked for RE-
RUN or EXIT the program giving up the following massage; “Do You Want To Continue (Y/N)”.
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Background:
Array
In everyday life similar objects can be grouped into units. In computer languages, this can be done by using
arrays. Arrays can hold a few data items or tens of thousands. The data items grouped in an array can be
simple types like int or float. Arrays group data of the same type. For example, we can store 5 values of
type int in an array without having to declare 5 different variables. Items in the array are called elements
and they can be accessed by an index number. These elements, of the same type, are placed in contiguous
memory locations.
For example, an array to contain 5 integer values of type int could be represented like this, where each
blank panel represents an element of the array.
0
300
0
301
0
302
0
303
304 0
Like a regular variable, an array must be declared before it is used. A typical declaration for an array in C++
is:
Where type is a valid type (like int, float...), name is a valid variable name and the elements field (which is
always enclosed in square brackets []), specifies the number of elements the array has to contain.
Initializing Arrays
When we declare an array, we have the option to assign initial values to each one of its elements by
enclosing the values in braces { }. For example:
23
25
40
16
19
The amount of values between braces { } must not be larger than the number of elements that we declare
for the array between square brackets [ ]. For example, in the example of array ‘age’ we have declared that
it has 5 elements and in the list of initial values within braces { } we have specified 5 values, one for each
element.
When an initialization of values is provided for an array, C++ allows the option of leaving the square
brackets empty [ ]. In this case, the compiler will assume a size for the array that matches the number of
values included between braces { }:
int age [ ] = {23, 25, 40, 16, 19} ;
After this declaration, array ‘age’ would be 5 ints long, since we have provided 5 initialization values.
Accessing the values of an array
In any point of a program in which an array is visible, we can access the value of any of its elements
individually as if it was a normal variable, thus being able to both read and modify its value. The format is
as simple as:
name[index]
Following the previous examples in which age had 5 elements and each of those elements was of type int,
the name which we can use to refer to each element is the following:
300 23 age[0]
301 25 age[1]
302 40 age[2]
303 16 age[3]
304 19 age[4]
For example, to store the value 40 in the third element of age, we could write the following statement:
age[2] = 40;
a = age[2];
Program 1
#include <iostream>
int main ()
int n, result=0;
result += age[n];
system (“pause”);
return 0;
Conclusion:------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
Lab Exercise:
Write a program to add two arrays.
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Write a program that input the marks of five students in an array and find the average.
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
Hamdard Institute of Engineering & Technology, Hamdard University
Sharae Madinat Al-Hikmah, Muhammad Bin Qasim Avenue, Karachi 74600, Pakistan.
FACULTY OF ENGINEERING SCIENCES AND TECHNOLOGY
Hamdard Institute of Engineering & Technology
Hamdard University
----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Write a program that creates an array of 8 numbers and perform the following:
Input a number from user and search in array if it is present or not.
Find the highest number present in array.
Find the lowest number present in array.
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Multidimensional arrays can be described as "arrays of arrays". For example, a two-dimensional array can
be imagined as a two-dimensional table made of elements, all of them of the same data type. To declare a
two dimensional array the syntax would be:
01 2
0
table 1
Here, “table” represents a two-dimensional array of 4 per 3 elements of type int. The simplest way to
declare this array in C++ is:
int table[4][3];
And, for example, to refer to the second element vertically and third horizontally in an expression would be:
table[1][2];
0 1 2
#include <iostream>
int main ()
int row=4;
inti,j;
int table[row][column];
for(i=0;i<row;i++)
for(j=0;j<column;j++)
cout<<",Column "<<j+1<<":";
cin>>table[i][j];
cout<<"\n\n\n";
for(i=0;i<row;i++)
for(j=0;j<column;j++)
system (“pause”);
return 0;
}
The following program demonstrates how to initialize a two dimensional array.
Program 2
#include <iostream>
int main ()
int i, j;
int sqrs[10][2] = { {1, 1}, {2, 4}, {3, 9}, {4, 16}, {5, 25}, {6, 36}, {7, 49}, {8, 64}, {9, 81}, {10, 100} };
cin>> i;
if(sqrs[j][0]==i)break;
cout<<sqrs[j][1]<<endl;
system (“pause”)
return 0;
Conclusion:------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
Lab Exercise:
Using two-dimensional arrays, write a program which sums two (2x2) matrices of integers.
Example input/output should be:
8. 4
7
Plus
9. 1
10. 2
Equals
6. 5
9. 9
Write a program to print the given numbers in ascending order using arrays similar to the following
output.
Lab Report:
Your lab report must include:
Purpose:
This is a statement of problem to be investigated. It provides the overall direction for laboratory investigation and
must be addresses in the conclusion.
Procedure:
4. Step by step procedure carefully explained in a numbered sequence.
5. All experimental variables identified and named
6. Brief description of how the independent variables are controlled.
Hint:
Open ended lab must be so much descriptive such that someone who has not studied the topics covered in open ended
lab must be able to understand it and be able to reproduce the results.
Data:
3. What data needs to be taken?
4. Draw data tables
Data Analysis:
3. How do you interpret data?
4. Draw graphs, analyze them or perform calculations in order to analyze collected data.
Conclusion:
1. Discuss any questionable data or surprising results.
2. Explain the possible source of any error.
3. Suggest changes in experimental design that might test your explanations.
Performance Performance
Mark Performance between Poor between
Poor Satisfactory Excellent
Heads s below Poor and Satisfactory
Satisfactory and Excellent
Hardware
3
Presentation
Communication
3
skills
Viva 6
Report 3
Total Marks 15
Marks Obtained