Professional Documents
Culture Documents
Session-2018
Semester Fall 2018
CS-101L Computing Fundamentals Lab
1. Using the technique that is appropriate for your operating system, start Word.
2. When the Start screen appears, press the Esc key to create a new blank document.
The ribbon is located below the title bar. The commands you'll use when working with a
document are gathered together in this central location for efficiency. (Figure 2)
Across the top of the ribbon is a set of tabs. Clicking a tab displays an associated set of
commands arranged in groups. Commands related to managing Word and documents (rather
than document content) are gathered together in the Backstage view, which you display by
clicking the File tab located at the left end of the ribbon. Commands available in the
Backstage view are organized on named pages, which you display by clicking the page tabs in
the coloured left pane. You redisplay the document and the ribbon by clicking the Back arrow
located above the page tabs. (Figure 3)
On each tab, buttons representing commands
are organized into named groups. You can
point to any button to display a ScreenTip that
contains the command name, a description of
its function, and its keyboard shortcut (if it has
one) (Figure 4).
Some buttons include an arrow, which might
be integrated with or separate from the button.
To determine whether a button and its arrow
are integrated, point to the button to active it.
(Figure 5)
Maximizing and minimizing the word
interface impacts on the ribbon and title page.
You can see Figure 6 for 1024 pixels wide
screen.
Figure 3: Backstage view
To auto-hide ribbon and other customization options, click on fourth-left icon on the
extreme top-left side of word application. See Figure 8 for details. It is also called Ribbon
Display Options menu.
CS-101L Computing Fundamentals Lab Manual
Figure 9: The title bar elements are always on the left end, in the centre, and on the right end
of the title bar
At the top of the app window, title bar displays the name of the active file, identifies the
app, and provides tools for managing the app window, ribbon, and content. (Figure 9)
The Quick Access Toolbar at the left end of the title bar can be customized to include any
CS-101L Computing Fundamentals Lab Manual
commands that you want to have easily available. The default Quick Access Toolbar in the
Word app window displays the Save, Undo, and Redo/Repeat buttons. On a touchscreen
device, the default Quick Access Toolbar also includes the Touch/Mouse Mode button.
(Figure 9).
Across the bottom of the app window, the /status bar displays information about the current
document and provides access to certain Word functions. You can choose which statistics and
tools appear on the
/status bar. Some items, such as Document Updates Available, appear on the /status bar
only when that condition is true. (Figure 7)
The View Shortcuts toolbar, Zoom Slider tool, and Zoom button are at the right end of the
/status bar. These tools provide you with convenient methods for changing the display of
document content. (Figure 10).
Figure 10: You can display different content views and change the magnification from the
status bar
1. Right-click the status bar to display the Customize status Bar menu. A check
mark indicates each item that is currently enabled.
2. Click to enable or disable a status bar indicator or tool. The change is
affected immediately. The menu remains open to permit multiple selections.
3. When you finish, click away from the menu to close it.
Exiting Ms Word:
You can exit word by clicking the close button in the upper right corner of title bar. Or by
selecting file menu and click on close option.
You can use options explained in Figure 14 and Figure 15 for applying fonts, colours and
text effects on your writing. You can also use shortcut keys for quick tasking. For
example, for saving a document press Ctrl key with S key. (Figure 16)
Steps:
1. Start Ms Word from the start button as mentioned above. And open new document by
clicking on new option and selecting blank document. (Figure 18)
2. Start typing in the blank working area according to the given format.
3. Appearance of document can be changed. You can make the heading bold, italics and
underlined. Select the text you want to format. On the Home tab from the font group, font
size and style can be changed. (Figure 19)
4. Font size can be changed by clicking the font size arrow and selecting the desired font.
(Fig 20)
5. Font style can be changed by clicking the font arrow and selecting the desired one.
(Figure 17)
6. Change Indentation and alignment of the text if needed. The text in the application can be
left, right, centre and justify. Indention of the paragraph can be increased or decreased.
All this can be done from Home tab in the paragraph group. (Figure 21)
7. After all the formatting, document can be saved. To save a document click on File tab and
then select Save As. Click on the browse button. (Figure 22 and Figure 23)
8. The save as dialog appears. Enter the name of the file in the bar next to File Name. And
in the Save As Type box enter the format in which you want to save the file. Then press
OK, file will be saved.
Sample
2.2 CREATE A POSTER FOR SPORTS GALA FOR CS &E DEPARTMENT UET.
1. Open a new blank Word document.
2. Set the paper width and height to 22” by 22’’. For this click on the layout tab and select
size. From drop-down list select more paper sizes. (Figure 24)
3. Page Setup dialog box appears. Change the width and height to 22’’ and click OK. (Figure
25)
4. First, insert the picture related to the given topic. Click Insert tab and select pictures
options. (Figure 26)
5. Insert pictures dialog box appears. Select the desired picture you want to insert and then
click insert. (Figure 28)
6. To format the picture, select the picture and then select Format Picture from drop-down
list. (Figure 27)
7. Format picture pane appears, which helps to crop the picture, changing picture colours,
applying 3-D rotation and many more. (Figure 30)
8. Text can be inserted by selecting the picture and then select wrap text option from the
drop-down list or from the layout options. (Figure 29)
9. Text colours can be changed from the theme colours available in Font group from Home
tab. (Figure 31)
10. Text highlight colour and text effects can also be applied from the font group. (Fig 32)
11. On Insert tab, click on arrow and select desired Word Art. (Figure 34)
12. Colour of background can also be changed. Go to Design tab and select Page Colour and
change the colour to the desired one.
13. Check the print preview of the poster. To do this, select the File tab and then select Print
option (Figure 35)
14. After checking the print preview, save the poster with desired name. (Figure 36)
Sample
CS-101L Computing Fundamentals Lab Manual
1. Open a New blank Word document. Set the paper size to letter and start creating form
according to given specimen.
2. Insert picture in the form (UET logo) and select “in line with text’’ from the wrap
text option and add text.
3. Start entering text in the form. Shapes will be inserted in the form. To insert shapes in the
form, select the insert tab and in the illustrations group, click on the shapes option and
select the desired shape.
4. In this form, we have used rectangle shape to insert picture and symbols and line shape to
underline the text.
5. Symbols must be inserted in the form. To do this select the insert tab and in the symbols,
group click on the symbol button. (Figure 37)
6. To view all symbols, click on the ‘’more symbols’’ options. Symbols dialog box appears.
And select the tick symbol which is used in the form in this assignment. (Figure 37 and 38)
7. Also, add your education in table. Go to insert tab and click on table. Hover the mouse
over the grid and decide how many columns and rows you want. When decided, click on
it. Add headings in first row and data in other rows. (Figure 39)
8. After completing the form, fill the form with appropriate information and save it.
CS-101L Computing Fundamentals Lab Manual
CS-101L Computing Fundamentals Lab Manual
2 INSTRUCTIONS
Question1 is mandatory to be completed in lab.
Rest of the questions will be homework and will be evaluated in coming labs.
Cheating or plagiarism will result in 0 for both the copier and one who allows his/her
to get copied.
Bring printed versions of your submitted homework tasks in next lab. Viva will
also be conducted.
Soft copies (e-copy) of your work will be submitted via email. (Already
explained in class).
Email your queries to zramzan@uet.edu.pk.
CS-101L Computing Fundamentals Lab Manual
PowerPoint Exercise
This exercise will help you explore some creative, and less standard, ways of using
PowerPoint to create an interactive presentation. Read through the instructions on the
following pages for an idea of some of the things you can do with this program. For this
exercise, you will create a PowerPoint slide show that includes the following six slides (Item
numbers from the following instructions are included in parentheses to help you create each
slide.)
1. A “homepage” slide with a title and links or buttons to each of your other five pages. (see #
1, 2, 7, 8, 20, 22, 23)
2. A slide that uses arrows (and/or circles) and text to label different aspects of a photograph
or graphic image. (see # 4, 8, 9, 10, 11)
3. A slide that uses no words but is an image collage that builds itself automatically. (In other
words, images appear on the page one-at-a-time, automatically timed, to create one large
collage). (see # 16, 19)
4. A slide that has a bulleted list of items that are animated so that the items appear on the
page one-at-a-time. Set it up so that each item dims as the next item appears. (see # 1, 18)
5. A slide that uses a sound effect that is integrally tied to the information on the page (either
as an auditory example of something you are talking about, or as an element that helps to
create the context for what you are talking about – for example, birds singing as you talk
about the rain forest.) (see # 25, 26)
NOTE: Rather than using one of the standard design templates that comes with PowerPoint, this
exercise has you designing your own color scheme and slide layout.
ANOTHER NOTE: Be sure that all sound files are saved in a folder with your PowerPoint
presentation. (This does not include sound effects added from PowerPoint; only sound files that
you have inserted from the Web or from your own computer). (see #25 for instructions)
In the Mac Lab, PowerPoint is on your Dock under Microsoft Office (with Word). Double-click to
open it, then select PowerPoint presentation and click OK.
CS-101L Computing Fundamentals Lab Manual
Using PowerPoint
7. To change typeface
Click and drag to highlight the words, then use the text tools to change formatting.
Select Arrange
Select Send to Back or Bring to Front
OR, if you chose a slide layout with a box for clipart, simply double click on the square
In the center of the pop-up screen, click on the “Web Page” button
In the “Link To” box at top of screen, type/paste the website URL (starting with http://)
Click OK (your text will become an underlined hyperlink)
NOTE: the link will only work when in the Slide Show mode
Click and drag your movie to the location you want it on the slide
NOTE: don’t make your movie larger or it will become fuzzy
A movie toolbar will appear. Using this toolbar you may:
Preview your movie
Select a frame to show before the movie starts playing
Add a border to your movie
NOTE: If you did not choose to have your movie play automatically, you must click on
your movie to start it playing during your slide show. Make sure you wait for the hand to
show before you click or it will simply move to the next slide.
http://www.stonewashed.net/sfx.html
http://www.sounddogs.com/start.asp (click on Sound Effects in left column)
Or simply do a Google search for free sound effects
When you locate a sound you would like to use, Control-click on the link
Choose Save Target As
Save the file to your PowerPoint folder
Formats supported by PowerPoint include: WAV, MP3, AIF, AIFF, MIDI, MID, MOV
NOTE: you must save both your PowerPoint and your sound files in the same folder
To create a new folder for both, click your mouse on the Desktop
From the File menu, choose New > Folder
An untitled folder will appear on the Desktop
Click on the name to rename the folder
Put your sound files and your PowerPoint presentation in this folder
OR When your slideshow is complete, save it as a PowerPoint Package
File>Save As, then change the Format from PowerPoint presentation to
PowerPoint Package
This will automatically generate a folder with all necessary files included
PowerPoint
PowerPoint is a presentation software package. With PowerPoint, you can easily create slide
shows.
In the upper-left corner is the Microsoft Office button. When you click the button, a menu
appears. You can use the menu to create a new file, open an existing file, save a file, and perform
many other tasks.
Next to the Microsoft Office button is the Quick Access toolbar. The Quick Access toolbar
provides you with access to commands you frequently use.
The Title bar is located at the top in the center of the PowerPoint window. The Title bar displays
the name of the presentation on which you are currently working.
The Ribbon
1 Tabs
2 Command Group
3 Command Buttons
4 Launcher
You use the Ribbon to issue commands. The Ribbon is located near the top of the PowerPoint
window, below the Quick Access toolbar.
Rulers
Rulers are vertical and horizontal guides. You use them to determine where you want to place an
object. If the rulers do not display in your PowerPoint window:
1 Slide
2 Placeholders
3 Notes
Slides appear in the center of the window. You create your presentation on slides.
Placeholders hold the objects in your slide. You can use placeholders to hold text, clip art, charts,
and more.
You can use the notes area to creates notes to yourself. You can refer to these notes as you give
your presentation.
The Status bar generally appears at the bottom of the window. The Status bar displays the
number of the slide that is currently displayed, the total number of slides, and the name of the
design template in use or the name of the background.
The Outline tab displays the text contained in your presentation. The Slides tab displays a
thumbnail of all your slides. You click the thumbnail to view the slide in the Slide pane.
The View buttons appear near the bottom of the screen. You use the View buttons to change
between Normal view, Slider Sorter view, and the Slide Show view.
Normal View
Normal view splits your screen into three major sections: the Outline and Slides tabs, the
CS-101L Computing Fundamentals Lab Manual
Slide Show
Use the Slide Show view when you want to view your slides, as they will look in your
final presentation. When in Slide Show view:
Esc Returns you to the view you were using previously.
Zoom allows you to zoom in and zoom out on the window. Zooming in
makes the window larger so you focus in on an object. Zooming out makes the window smaller
so you can see the entire window.
You can click and drag the vertical and horizontal splitter bars to change the size of your panes.
You use the Minimize button to remove a window from view. While a window is minimized,
its title appears on the taskbar. You click the Maximize button to cause a window to fill the
screen. After you maximize a window, clicking the Restore button returns the window to its
former smaller size. You click the Close button to exit the window and close the program.
You create your PowerPoint presentation on slides. You use layouts to organize the content on
each slide. PowerPoint has several slide layouts from which to choose.
Themes are sets of colors, fonts, and special effects. Backgrounds add a colored background to
your slides. You can add themes and backgrounds to your slides.
When you start PowerPoint, PowerPoint displays the title slide in the Slide pane. You can type
the title of your presentation and a subtitle on this slide. To enter text:
CS-101L Computing Fundamentals Lab Manual
Click and type the title of your presentation in the "Click to add title" area.
Click and type a subtitle in the "Click to add subtitle" area.
If you do not wish to use the title slide, click the Delete Slide button in the Slides group on the
Home tab.
After completing your title slide, you can create additional slides. To create a new slide:
2. Click the New Slide button in the Slides group. The Office Theme dialog box
appears and displays several layout templates.
3. Click the layout you want. The layout appears in the Slide pane of the
PowerPoint window.
Right-click the slide layout. A menu appears. Click Layout and then click the layout you
want.
Choose the Home tab, click the New Slide button , and then choose the slide
layout you want.
2. Click the New Slide button in the Slides group. The Office Theme dialog box
appears.
3. Click the Title and Content Layout. The slide appears on the Slides tab.
CS-101L Computing Fundamentals Lab Manual
4. Enter the information shown here. Type Here is what to do: (including the colon) in the
Click to Add Title text box. Type the bulleted text in the Content text box.
Create an Outline
If you need to present the information in your slide in outline form, you can easily create an
outline by using the Increase List Level button to create a hierarchy.
2. Click the New Slide button in the Slides group. The Office Theme dialog box
appears.
3. Click the Title and Content layout.
4. Enter the information shown here. Click the Increase List Level button in the
Paragraph group to indent the bullets for Stafford Loans and PLUS Loans.
CS-101L Computing Fundamentals Lab Manual
If you ever need to decrease an indent, use the Decrease List Level button in the
Praragraph group.
2. Click the New Slide button in the Slides group. The Office Theme dialog box
appears.
3. Click the Two Content layout.
1. Place the mouse pointer at the point at which you would like to add text.
2. Type the information you want to add.
You can use the Backspace key to delete text. You can also delete text by highlighting the text
and pressing the Delete key.
Apply a Theme
A theme is a set of colors, fonts, and special effects. Themes provide attractive backgrounds for
your PowerPoint slides.
1. Click the Slides tab, located on the left side of the window.
2. Hold down the Ctrl key and then click to select the slides to which you want to apply a
theme.
3. Choose the Design tab.
6. Click Apply to Selected Slides. Excel applies the theme to the slides you selected.
Apply a Theme
3. Click the theme you want. PowerPoint applies the theme to all of the slides in your
presentation.
Add a Background
After you create your slides, you can run your slide show:
1. Do any one of thefollowing:
o Press F5.
o Choose the Slide Show tab. Click the From Beginning button in the Start
Slide Show group.
o Click the Slide Show icon in the bottom-right corner of your screen.
Task Procedure
PowerPoint is a presentation software package. With PowerPoint, you can easily create slide
shows.
Animations, Transitions, Spell Check, Outline Tab, Slides Tab, Sorter View, and Printing
Animations control how objects move onto, off of, and around your slides. Transitions control
how your presentation moves from one slide to the next.
Add Animations
You can animate the objects on your PowerPoint slides. PowerPoint provides four types of
animations: Entrance, Emphasis, Exit, and Motion Paths. An Entrance animation determines the
manner in which an object appears on a slide; for example, an object can move onto a slide. An
Emphasis animation does something to draw attention to an object; for example, the object can
become larger. An Exit animation determines the manner in which an object leaves a slide; for
example, an object can move off a slide. A Motion Paths animation determines how an object
moves around a slide; for example, an object can move from left to right.
If the Auto Preview box is checked on the Custom Animation pane, PowerPoint provides you
with preview of your animation after you create it and each time you modify it. You can also use
the Play button on the Custom Animation pane to preview an animation.
To choose an effect:
To modify an effect:
CS-101L Computing Fundamentals Lab Manual
1. Click the down arrow next to the Start field on the Custom Animations pane and then
select the start method you want.
2. Click the down arrow next to the Property field on the Custom Animations pane and
the select the property you want. The Property field might be labeled Direction,
Size, or some other property.
3. Click the down arrow next to the Speed field on the Custom Animations pane and then
select the speed you want to apply to your animation.
To preview the animation, click the Play button on the Custom Animations pane.
7. Click Fly In. PowerPoint applies the effect. If the Auto preview box is checked,
PowerPoint automatically provides you with a preview of the animation.
CS-101L Computing Fundamentals Lab Manual
1. Click the down arrow next to the Start field and then select After Previous.
2. Click the down arrow next to the Direction field and then select From Bottom.
3. Click the down arrow next to the Speed field and then select Medium.
4. Click Fly In. PowerPoint applies the effect. If the Auto preview box is checked, PowerPoint
automatically provides you with a preview of theanimation.
CS-101L Computing Fundamentals Lab Manual
1. Click the down arrow next to the Start field and then select After Previous. The Apply
for Financial Aid field appears in the center of the Custom Animation pane.
2. Click the down arrow next to the Apply for Financial Aid field and then click Timing.
The Fly In dialog box appears.
5. Click the down arrow next to the Direction field and then select From Bottom.
6. Click the down arrow next to the Speed field and then select Medium. If the Auto
preview box is checked, PowerPoint automatically provides you with a
preview of the animation. You can click the Play button on the Custom
Animation pane at anytime to preview an animation.
Add Transitions
Transitions determine how your presentations move from one slide to the next. For example, a
slide can move up onto the screen and replace the previous slide. PowerPoint provides several
transition methods. You can add sound to a transition and you can control its speed. You can
apply a transition to selected slides or to all of the slides in your presentation.
A transition can occur when the presenter clicks the mouse or after the amount of time you
specify.
1. On the Slides tab, hold down the Ctrl key and then click the slides to which you want
to apply the transition.
2. Choose the Animations tab.
3. Click the More button in the Transition to this Slide group. A menu of
transitions appears.
4. Click the transition you want to apply. PowerPoint applies the transition. As you roll your
pointer over each transition, PowerPoint provides you with a live preview of the
transition.
4. Click the Apply to All button in the Transition to This Slide group.
Add Transitions
s
CS-101L Computing Fundamentals Lab Manual
3. Click the Push Up transition. As you roll your pointer over each transition,
PowerPoint provides you with a live preview of the transition.
1. Click the down arrow next to the Transition Sound field and then click Click.
2. Click the down arrow next to the Transition Speed field and then click Slow.
Advance Slide
6. Type 00:03 in the Automatically After text box. PowerPoint changes the timing for
Slide 1.
Spell Check
PowerPoint checks your spelling as you type and displays errors with a red wavy line under the
misspelled word. You can right-click and then select the correct spelling from the list of offerings
on the menu that appears or select Spelling to open the Spelling dialog box. If you need to, you
can initiate a spell check anytime you like. To start a spell check, do one of the following:
Press F7.
Choose the Review tab and then click the Spelling button .
If the spell check finds a possible spelling error, the Spelling dialog box opens with the spelling
error highlighted. You can respond in several ways.
CS-101L Computing Fundamentals Lab Manual
Response Procedure
2. Click Change.
Spell Check
1. Press F7
2. Correct any spelling errors PowerPoint finds. If PowerPoint doesnot find any errors, the
Spelling Check is Complete message box appears. Click OK.
2. Choose the Outline tab to view the text of your presentation as an outline.
Choose the View tab and then click the Slide Sorter button in the
Presentation Views group.
Click the Slide Sorter button in the bottom-right corner of the PowerPoint window.
Task Procedure
Task Procedure
2. Press Ctrl+C.
2. Press Ctrl+V.
1. Select the slide or slides you
Cut a slide. want to cut.
CS-101L Computing Fundamentals Lab Manual
Task Procedure
2. Press Ctrl+X.
2. Press Ctrl+D.
EXERCISE 5
PowerPoint provides you with many printing options. You can print a large view of your slides or
you can print your slides as handouts with 1, 2, 3, 4, 6, or 9 slides per page. You can also print
your Notes pages or the Outline view of your slides.
To: Print:
1. Click the Microsoft Office button. A menu appears.
2. Choose Print.
4. Click the down arrow next to the Print What field in the Page Setup group and then select
what you would like to print. A preview appears onscreen.
5. Click the Print . The Print dialog box appears.
6. Click the down arrow next to the Color/Grayscale field to select whether you want your
slides to print in color, grayscale, or black and white. If you are using a black and white
printer, choose black and white. You will use less ink or toner.
7. Click Ok.
Print an Outline
2. Choose Print.
6. Click the down arrow next to the Color/Grayscale field to select whether you want your
slides to print in color, grayscale, or black and white. If you are using a black and white
printer, choose black and white. You will use less ink or toner.
7. Set the other print settings.
4. Click the down arrow next to the Print What field in the Page Setup group and then select
Slides.
4. Click the down arrow next to the Print What field in the Page Setup group and then
select Handouts (4 slides perpage).
8. Click Ok.
1 LAB 3 (INTRODUCTION TO ANALYSIS TOOL)
2 SECTION A
Microsoft Excel is a powerful electronic spreadsheet program you can use to automate
accounting work, organize data, and perform a wide variety of tasks. Excel is designed to
perform calculations, analyze information, and visualize data in a spreadsheet. Also, this
application includes database and charting features.
When you create a new Excel 2016 workbook, the app presents a blank workbook that
contains one worksheet. You can add or delete worksheets, hide worksheets within the
workbook without deleting them, and change the order of your worksheets within the
workbook. You can also copy a worksheet to another workbook or move the worksheet
without leaving a copy of the worksheet in the first workbook. If you and your colleagues
work with many documents, you can define property values to make your workbooks easier to
find when you and your colleagues attempt to locate them by using the Windows search box.
Another way to make Excel easier to use is by customizing the Excel app window to fit your
work style. If you find that you use a command frequently, you can add it to the Quick Access
Toolbar so it's never more than one click away. If you use a set of commands frequently, you
can create a custom ribbon tab, so they appear in one place. You can also hide, display, or
change the order of the tabs on the ribbon.
To save your workbook by using a keyboard shortcut, press Ctrl+S. Students often ask, "How
often should I save my files?" It is good practice to save your changes every half hour or
even every five minutes, but the best time to save a file is whenever you make a change that
you would hate to have to make again.
Open Microsoft Excel and create a file named Lab2.
Formula: You can create any type of math calculation on your own using the following
mathematical operators:
For example: = A1 + A5 ….
Let’s start practicing. Add some numbers in cells of your choice as shown in Figure 3.
Figure 3: Dummy data written in excel worksheet
1. Click in the empty cell which will contain the formula. In current example case,
it will be E2.
2. Type an equal sign (=). (Figure 4)
3. Type the cell address or click the cell that contains the first number. (Figure 4)
4. Type the math operator (+ - / * ^). (Figure 4)
5. Type the cell address or click the cell that contains the second number. (Figure 4)
6. Continue in this manner until the formula is complete.
7. Use parenthesis for clarification.
8. Press the Enter key. Result will be added to that cell.
9. To use same formula for all rows, hover mouse to the right most bottom point
until mouse pointer changes to plus sign (+). Click at corner of cell and drag it to
the bottom of the same column. Formula will automatically be copied to other
cells according to their cell references.
Once you select a category and a function name, click on the OK button. The Function
Arguments palette will appear. (Figure 6) Type any numbers, cell addresses, ranges, or any
other parameters in the required boxes, and then click on the OK button to insert the
completed formula in the spreadsheet.
AutoSum:
Adding is the most common math operation performed in Excel. The Home ribbon includes
an AutoSum button for adding. This button provides a shortcut to typing formulas. (Figure 7)
Sum:
Adding is the most common function performed
in
Excel. The SUM function adds values.
Specify
values, individual cell addresses and/or range
addresses in the number’s variables.
Syntax =SUM(number1,number2,...)
Examples =SUM(A10:A25)
=SUM(B15:C20)
Averag
e:An average sum all values and divides by the
total of values. Specify values, individual
number
cell
addresses and/or range addresses in the
number’s
variables. You can simply select the range of
cells
and select average from AutoSum button
Syntax =AVERAGE (number1, number2…)
Examples =AVERAGE (15, 255, 45)
=AVERAGE (B2:B18)
Figure 7: AutoSum button
Maximum (MAX): Minimum (MIN):
Maximum indicates the largest value in Minimum indicates the smallest value in the
the
designated list of numbers. designated list of numbers.
Syntax =MAX (number1, number2...) Syntax =MIN (number1, number2...)
Examples =MAX (A15:A35) Examples =MIN (A15:A35)
=MAX (D10:D200, =MIN (D10:D200, D225:D325)
D225:D325)
3 LAB TASKS (TO BE PERFORMED IN LAB)
Figure 9: Shapes
Figure 11: Calculation sum Figure 12: Sum Figure 13: Calculating average
calculation
Figure 15: Percentage calculation
1. First, select the data values of which you want to create the chart. In case of pie chart, it is
between obtained and total marks. Select the values. See Figure 18
2. Then go to the insert tab and select pie chart in chart group. And select 2-D in pie
chart option. See Figure 19 for details.
3. The pie chart will be created according to the data values. (Figure 20)
4. Now click on the chart title text box to enter the title and to change colour
scheme. (Figure 21)
5. After adding title and changing colours, save the chart with specified name.
6. For bar chart, select the required data values as shown in Figure 22.
7. To create chart, go to the insert tab and in the chart group, select the recommended
chart and select the clustered column chart. (Figure 23)
8. The chart will be created. Add title of the chart and tick the check boxes of which
chart elements you want to include in your chart. (Figure 24)
9. In this chart five chart elements are included, which are shown in the above
figure. Legends are defined at the bottom of graph. (Figure 25)
10. Add axis titles and chart titles and you can also change the colour and style of graph.
11. After doing all above steps, chart will be created in desired form and it can now be saved.
12. See Figure 16 and Figure 17 for sample output.
click on arrow below Format and select Column Width from drop down
menu. (Figure 30)
9. Change the Column Width and click OK. (Figure 35)
10. Column width of selected cells will be changed.
11. Merge the required cells by the methods described previously.
12. To fill colour in cells, right click on it and select format cells from the
dropdown menu. (Figure 31)
13. Click on Fill from Format Cell dialogue box and select desired fill colour. (Figure
32)
14. Select the merged cells and on Home tab, in Alignment group, click on and
then select Vertical Text from drop down menu. (Figure 34)
15. Add text. It will appear vertically. (Figure 36)
16. Again, select other merged cell, click on and select Rotate Text Up from the list.
17. Add text in cell and text will appear in this way.
18. In some cells, text will appear in this way. (Figure 37)
19. To resolve this, select the cell and click on Home tab, in Alignment group,
select Wrap Text. (Figure 40)
20. Text in cell will then appear in the form of Figure 38.
21. Text in the cell is Upper Aligned. (Figure 39)
22. Complete the task and save the document.
23. See Figure 33 for sample output.
Figure 26: Cells are merging
Figure 39:
Alignment
buttons are
Figure 35: Writing column width shown
Figure 36:
Vertical text is
shown
1.1. Internet
Internet is an important source of information sharing. Internet means International Network.
When we share different resources (resources includes information and hardware both) between
more than one computers it is called Network and the way of sharing resource among all
computers of the world is called Internet. Internet is a global system of interconnected computer
networks. Internet is such a network where millions of private, public, academic, business, local
and government networks are linked to each other or in other words we can say that internet is
collection of many networks.
The Internet carries a vast range of information and services. One of the greatest things about the
Internet is that nobody really owns it. It is a global collection of networks, both big and small.
These networks connect together in many different ways to form the single entity that we know
as the Internet.
Via internet you can send and receive e-mail. You can chat with text or voice. You can browse
the World Wide Web. And you can perform countless other tasks with the appropriate software.
Tags: In html we use tags to tell web browser how to show web-page. Everything in html file
that start with “<” and end with “>” is called tag. For example <html> , <head> and <body>.
Every HTML page start with <html> and ends with </html> tags. First tag <html> is called
opening of tag and second one </html> is called closing of tag. All remaining tags used for
developing the web page will be written in these two tags
There are two sub portion of <html> tag one is <head> </head>and other is <body> </body>
Both body and head tags have their own uses. The information that we want to show to user
should be written inside opening and closing tags of body tag. The purpose of head tag will be
discussed in some other course.
We have enough background knowledge to start our first website.
1. Task: Open Notepad (Go to start menu click at run and type Notepad )
Explanatory Note: To make web site we can use any Text editor .there are many text editors
available on the internet: Textpad, notepad++. For this course we will use notepad.
2. Task: Write following line of code into text editor.
code In this code some text is included
in body opening and closing tags
Whatever written inside <body>
tag show to user.
3. Task : Now Save html file (Press ctrl+s) . Type any name for the file and don’t forget to
change the extension from .txt to html or htm. Also choose All File option from bottom
[important].
6. Open the file in any web browser by double clicking on it and the output will be:
4. Open the file in any web browser by double clicking on it and the output will be:
4. Open the file in any web browser by double clicking on it and the output will be:
Explanatory Note: That means when we use tag inside tags. Important is inner tag should be
closed before the outer tag. You can not write something <b><i> italic text </b> </i> this is
incorrect method. If a tag open inside another tag then it should be close before opening tag.
Correct way to write above is <b><i>italic text</i></b>
4. Open the file in any web browser by double clicking on it and the output will be:
4. Open the file in any web browser by double clicking on it and the output will be:
Attributes of tags
All html tags have a number of attributes. It includes id, class, style etc.id attribute is used to
assign a unique value to an element or tag. Class attribute is used to give a unique class name to
an element. 2.6 Image tag
To put an image on a web page <img> tag is used. For this purpose the attribute of <img> tag
that is necessarily be used is src. Src attribute is used to give the path to the image.
1. Task: Open your html file in Notepad
4. Open the file in any web browser by double clicking on it and the output will be:
Note: Path of the image will be given in this way only when image is located in the same folder
as the html document.
Image tag has some other attributes like width and height which are used to control the
dimensions of the images that is to be displayed.In this we will learn about some more tags of
html that includes links and list tags i.e.<a>, <ul>, <ol>
3.1 Hyperlink
We can link pages using hyperlink tag. Linking mean we can go from one web page to other by
simply clicking on it. In <a> tag a stands for anchor. And <a> tag must use it attribute href to
give the website address in it.
8. Open the file in any web browser by double clicking on it and the output will be:
Up till now we learned to make a hyperlink on a text now we proceed by making a hyperlink
over an image. It can be done very easily. As we have already talked in the html hierarchy that
we can use a tag within another tag.
To create a link to an image we will use image tag inside the anchor tag.
1. Task: Open your html file in Notepad
4. Open the file in any web browser by double clicking on it and the output will be:
Explanatory Note: Now when you open html file in your browser ,you will see the image whose
path has been gave in src attribute now if you place your mouse on displayed image it will
change its shape form arrow to hand. By clicking over it you will be directed to the page whose
address is given in href attribute. In this case it is yahoo.com.
3.2 List
Sometimes we need to show information in numbering or in bullets format. For this html provide
us un-order list <ul> and ordered <ol> list.
3.2.1 Un-ordered List Tag
HTML offers authors several mechanisms for specifying lists of information. To present list of
Information in bulleted format we can use <ul> tag.
1. Task: Open your html file in Notepad
4. Open the file in any web browser by double clicking on it and the output will be:
Note: There are different styles of bullets like square ,disc, circle. But customized bullets can be
used.
4. Open the file in any web browser by double clicking on it and the output will be:
Note: To specify the type of the numbering, type attribute of the <ol> is used.
For different styles of numbering there are three built in types of bullets like A, i, 1.
4. Open the file in any web browser by double clicking on it and the output will be:
4. Open the file in any web browser by double clicking on it and the output will be:
In this we will see more details of html tables.
To give an organized an appealing look to a web page, its content may be shown within a table.
we can define entire structure of the web in a table.
Fig 4.1 web page containing table with rowspan and columnspan
Now we will learn some more attributes of table tag that includes column-span and row-span.
4.1 Column-span
4. Open the file in any web browser by double clicking on it and the output will be:
Explanatory Note: In this example 2nd row of table contain columns that have a span of 2.That
means through column-span we gave this cell a space equal to two columns. 4.2 Row-span
Just like column-span we can also apply row span over the rows of the table.
1. Task: Open your html file in Notepad
4. Open the file in any web browser by double clicking on it and the output will be:
On a web page along with text content ,image and video content can also be included in a table
to make the web page more arranged and attractive.
Fig 4.2 This picture is an example of multimedia content on the webpage
4. Open the file in any web browser by double clicking on it and the output will be:
Till now we only have talked about those tags that are related to make a website “Presentable
and organized”.
But now we will talk about html forms that are used to create interactivity between a website
and a user. You will not find a single website on the internet that doesn’t include html forms.
Every website is using more or less number of tags of html forms.
For example forms are used in an online shopping websites and creating user registration on any
website.
Fig 5.1 This picture is an example of forms on a webpage
5.1 Html Forms
In this we will read about forms in html and input tags. Form also possess closing and opening
tags like html tag
<form>
This is form opening tag
</form>
This is form closing tag
Now remaining form code is typed in these two tags .There are different input items available for
forms e.g. Buttons, textboxes, check box, radio buttons etc.
To use these input items ,we have to specify them in the type attribute of the form input tag.
5.1.1 Text input
This item is used to take a single line input from a user. It can be used for typing an email
address, username, address etc. Indeed this is the only input item which is very common.
1. Task: Open your html file in Notepad
4. Open the file in any web browser by double clicking on it and the output will be:
5.1.2 Password
It can be used on the user registration page or on user log in page
1. Open your html file in Notepad
4. Open the file in any web browser by double clicking on it and the output will be:
5.1.3 Checkbox
This input item is provided to allow users to select more than one options out of a number of
available options.
4. Open the file in any web browser by double clicking on it and the output will be:
5.1.4 Radio-buttons
This item is provided to the user to make one selection out of a number of available options.
1. Open your html file in Notepad
4. Open the file in any web browser by double clicking on it and the output will be:
5.1.5 Drop-Downlist
4. Open the file in any web browser by double clicking on it and the output will be:
5.1.6 Button
To include button which is the most essential part of the forms in html ,it can be added to the web
site in this manner.
4. Open the file in any web browser by double clicking on it and the output will be:
INTRODUCTION TO CSS
CSS stands for Cascading Style Sheets. CSS is effectively the clothing that we put on a web page.
CSS is an tremendous addition to plain HTML. With plain HTML you define the colors and sizes
of text and tables throughout your pages. If you want to change a specific element you will have to
change the entire document.
With CSS we define the colors and sizes in "styles". Then as you write your web pages you refer to
the styles. In short we can say that we use CSS to control the style and layout of multiple Web
pages all at once.
Let us show you how CSS works!
• Inline
• Embedded (page-level style)
• CSS (external style-sheet)
As already mentioned, that every HTML tag possesses some attributes. In case of Inline way of
styling, we apply the style using the attribute right inside the elements of your HTML code, and
this method of styling is referred to as inline CSS .This attribute specifies style information for the
current element only.
Below is the general form for setting inline CSS in any HTML element.
Pseudo Code
Task: Open Notepad (Go to start menu click at run and type Notepad++)
Explanatory Note: To add inline styling to a web site we can use any Text editor in this case we
are using notepad ++. For this course we will use notepad.
3. Open the file in any web browser by double clicking on it and the output will be:
Embedded style is fairly an intermediary between inline styles and an external style sheet. An
internal style sheet should be used when a single document has a unique style. The style element
requires both start and end tags <style>...</style> which are inserted between the
<head>...</head> tags of your html file. The type attribute of the style tag defines the type of style
sheet being used so we'll put text/css as the value.
Below is the general form for setting embedded CSS in any HTML element.
Pseudo Code
<style type="text/css"> htmltag{attribute: value;}</style>
Explanatory Note: To add embedded styling to a web site we can use any Text editor. For this
course we will use Notepad++.
3. Task: Open the file in any web browser by double clicking on it and the output will be:
Using external style sheets is the definitive web designer tool in that it allows you to apply
formatting to many different web pages at once with a single .css file.An external style sheet is
simply a text file containing a list of CSS rules sets. The file is saved with a .css extension and
saved to any directory that can be accessed by the web pages using it.
Below is the general form for setting External CSS in any HTML element.
Pseudo Code
Explanatory Note: To add external styling to a web site we can use any Text editor. For this
course we will use notepad++.
We have to perform two tasks separately. There are two files css and html.
1. Task: We write our Html file (see HTML for more details)
3. Task: Now Save css file (Press ctrl+s).While creating a style-sheet, Just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
In this we will get knowledge regarding different types of selectors and the precedence of these
selectors.
In addition to setting a style for a HTML element, CSS allows you to specify your own selectors
called “Tag”, "id" and "class".
If we define css style for a tag then this style will be applied for all appearances of that tag in our
html file. For example if we add style for tag p then all <p> that occur in html file will have that
style.
Note: Html tag is called also selector while Attribute-value pair is called declaration.
We have to perform two tasks separately. There are two files css and html. 1.
Task: We write our Html file (see HTML for more details)
Add This code to your html file
4. Task: Open the html file in to web browser by double clicking on it and the output will
be:
3.2 ID Selectors
ID selectors initiate such rules in embedded or external style sheets that focus individual HTML
elements. To apply different styling to an Html tag we need to assign a unique name to that
element. The id selector uses the id attribute of the HTML element, and is defined with a "#". ID is
assigned to an element in the html file while this id is used in .css file to assign styling to the
element.
IDs allow you to get very specific about which elements your styles are applied to. This is basically
a subject of staying organized and can also help a lot once you start creating more complex CSS
selectors.
We have to perform two tasks separately. There are two files css and html. 1.
Task: We write our Html file (see HTML for more details)
3. Task: Now save css file (Press ctrl+s).While creating a style-sheet, just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
Explanatory Note: So resultantly we have used id selector and applied different formatting or
styling on same type of HTML tag. This is p tag in current example.
We have to perform two tasks separately. There are two files css and html. 1.
Task: We write our Html file (see HTML for more details)
Add This code to your html file
Note: A good practice is to name classes according to their function rather than their appearance.
Classes can be a very effective method of applying different styles .The difference between an ID
and a class is that an ID can be used to identify one element, whereas a class can be used to identify
more than one.
In this we will explore Colors in CSS, color setting methods, Hexadecimal Color codes,
background color and background image properties.
4.1 Introduction
The colors selection is very vital part of look and feel of any web site, so please spend a suitable
amount of time on surfing a number of websites and ponder on the available color range, color
matching and color contrast.
There are many methods to define color in css.
• Color Name
.mycolors{color:blue; background-color:green;}
• Hexadecimal value
Define colors with the use of hexadecimal values, similar to defining colors in plain
HTML.
Hexadecimal form is a pound sign (#) followed by at most, 6 hex values (0-F)
Hex Code of pure RED color which id FF0000 and GREE Color WHICH is 00FF00 and
BLACK color which is 000000 and WHITE COLOR which is FFFFF.
A color code FFAA20 specifies that this color contain RED component equal to FF(255
maximum part of red color)] and Green component equal to AA (170 in decimal ) and
BLUE is 20(32 in decimal).Look at ref [1] for more details
• RGB value
Define colors with the use of RGB values, by simply entering the values for amounts of
Red, Green and Blue.
.mycolors{color:rgb(255,201,202); background-color:rgb(40,51,110);}
In rgb: r stands for red g stands for green and b stands for blue.
Below are a screenshots of some websites presenting the use of very reasonable background
colors and background images . he lowest value that can be given to one of the light sources is 0
(hex 00). The highest value is 255 (hex FF).
Now let’s find out the how we can apply background color and set background image in Html using
CSS styling.
As name identifies that background color will help us applying a color at the background of an
element.
We have to perform two tasks separately. There are two files css and html.
1. Task: We write our Html file (see HTML for more details)
Add This code to your html file
3. Task: Now save css file (Press ctrl+s).While creating a style-sheet, just save the file
as Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in to web browser by double clicking on it and the output
will be:
As now you just saw that how easily we can add color to the background of any element.
Note: Here we have used id selector to apply color to elements. But we can make use of Tag
selector (specifically) and class selector (generically) to apply our color styling as well.
Now we learn the how we can add image to the background of any element.
It’s very simple just use background image property. And you are done!
We have to perform two tasks separately. There are two files css and html.
1. Task: We write our Html file (see HTML for more details)
Add This code to your html file
In the above example if we see carefully, the width of the each paragraph is 400px.In the
paragraph one and two; image is repeated while in the third paragraph image is not repeated.
Reason is that if the Background image is smaller than the given size of the element then the
image is repeated along the height and width of the element to completely fill the background of
the element.
If we do not want to repeat the background image then we have to explicitly declare that we do
not need to repeat the image in background. Method for this is follows
background-repeat:no-repeat. By default, the image is repeated in both x and y direction so it
covers the entire element.
The background-repeat property sets if/how a background image will be repeated. You can
have a background image repeat vertically (y-axis), horizontally (x-axis), in both directions, or
in neither direction
4.3 Background-position
The background-position property defines the initial position of an element.If you would like to
define where exactly an image appears within an HTML element, you may use CSS's background-
position. Please take note that there are three different ways of defining position: length,
percentages, and keywords. For instance we are using Keyword.
Three ways to define the position of an element
• Keywords
center top bottom top left top center top right bottom left bottom center bottom right
• Percentages
• Lenghts
Note: If no background-position has been specified, the image is placed at the default top-left
position of the element (0,0), which is located within the top-left corner of the element
3. Task: Now save css file (Press ctrl+s).While creating a style-sheet, just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
In this we will see that what is html box model, how to set margins, border of an element, how to
give padding, how to handle floating Images, text and font Properties.
First of all we take a look at box model followed by the elements of html.
TB
LB TP
RB
Content
RP
LP
BP
BB
BP
Stands For?
TM stands for top margin RM-Right Margin LM-Left margin BM-Bottom margin TM-Top
Border RM-Right Border LM-Left border BM-Border Bottom TP-Top padding RP-Right Padding
LP-Left Padding BP-Bottom Padding
Boundary of any element is called border. Distance between the content of any element and its
boundary is called Padding.While the distance between two elements of html is called Margin.
CSS Border, allow you to completely customize the borders that appear around HTML elements.
To alter the thickness of your border use the border-width attributes. You may use key terms or
exact values to define the border width.
Note: You must define a border-style for the border to show up. Available terms: thin, medium,
thick. The border has been made visible, in our example work for each element, so you may more
readily see the effects of padding margin.
1. Task: We write our Html file (see HTML for more details)
Add This code to your html file
3. Task: Now save css file (Press ctrl+s).While creating a style-sheet, just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
We continue with the formatting text stuff! Basically, we can adjust the size, alignment, style and
the weight of our text to be displayed. Let’s format our text straight away!
1. Task: We write our Html file (see HTML for more details)
Add This code to your html file This code is typed in the
HTML file. We will set
different text styling on the
paragraphs elements.you can
set different font families
provided they are installed on
client machine.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
1. Task: We write our Html file (see HTML for more details)
Add This code to your html file This code is typed in the
HTML file.
.In our CSS file we will
apply formatting to our
paragraphs and heading
elements.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
Now we move to the most interesting part of CSS which is “Floating”. Float is a CSS positioning
property.
Float Left
Float right
3. Task: Now save css file (Press ctrl+s).While creating a style-sheet, just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in web browser by double clicking on it and the output will be:
By using float we will place elements side by side.
1. Task: We write our Html file (see HTML for more details)
Add This code to your html file In this case we have placed
two paragraphs in this file.
Paragraphs in this file will
take their styling from .css
file.
3. Task: Now save css file (Press ctrl+s).While creating a style-sheet, just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in web browser by double clicking on it and the output will be:
Up till now we have played with two text elements and why to apply float on them, now we
will play with image and text and apply float on them.
1. Task: We write our Html file (see HTML for more details)
3. Task: Now save css file (Press ctrl+s).While creating a style-sheet, just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
Explanatory Note: In this example we have just noticed that if we do not apply floating to the
image appearing within the paragraph tag. It will give an unordered and unstructured look and
feel.
Note: While floating images, it should be noted that a margin should be added to images so that
the text does not get too close to the image. There should always be a few pixels between words
and borders, images, and other content.
Now in the Following example, we will apply float property to position the image at a suitable
place.
1. Task: We write our Html file and save it.(see HTML for more details)
Add This code to your html file This code is typed in the
HTML file.
.In our CSS file we will
apply formatting to our
paragraph and image element
to get adjusted in the
paragraph text nicely.
2. Task: Write following lines of code into a separate file.
Add this code to your .css file
In this code we have floated
our image element to the left
as a result text will be moved
towards right.
3. Task: Now save CSS file (Press ctrl+s).While creating a style-sheet, just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
In this we will get more knowledge about floating and the scenarios arising when floating is
applied, what is clear, and also will get basic understanding of div (division) in CSS.
A already mentioned that one of the powerful tools and the backbone of CSS is floating action.
Floating can be even used to design the entire layout of a web site same as what we said about a
table in html.
Let’s perform floating to place two paragraphs side by side! Obviously using left and right floating.
1. Task: We write our Html file and save it.(see HTML for more details)
Add This code to your html file Type the code shown in the
image in your html file.
3. Task: Now save CSS file (Press ctrl+s).While creating a style-sheet, just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
We just saw from the output that #p1 didn’t allow #p2 to lay aside. Again the problem is same as
described above that elements are using Box model and didn’t allow two paragraphs to lay side
by side even if there s some space is left after the first paragraph.And this space is enough to be
occupied by the paragraph2,But default behavior of Paragraph to follow box model pushed
paragraph2 below it.
How to place them aside by side with each other. Again solution is to use floating.
Also use another useful element of CSS which replaces table of HTML. The <div> element is
well-suited to take over from tables as a layout tool. It is an element that is used to divide the
page into sections, and can hold whatever you need inside it. Each section can then have its own
formatting. Using div it becomes easy to manage and manipulate the web page easily.
1. Task: We write our Html file and save it.(see HTML for more details)
Add This code to your html file Type the code shown in the
image in your html file.
3. Task: Now save CSS file (Press ctrl+s).While creating a style-sheet, just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
Controlling the width of the container div we can minimize the distance between the two elements
.the more we reduce the width .the more they come close to each other.
Elements following a floated element will wrap around the floated element. If you do not want this
to occur, you can apply the "clear" property to these following elements. The clear property is used
to control how the subsequent elements of floated elements in a document shall behave. By default,
the subsequent elements are moved up to fill the available space which will be freed when a box is
floated to a side.
Now we see one problem by the use of float and find out its solution.
1. Task: We write our Html file and save it.(see HTML for more details)
Add This code to your html file Type the code shown in the
image in your html file
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
Now this is the time to take our new element (which is a paragraph at the moment) out of the empty
space left due to other floating elements.
Use clear as the solution
Clear property can be used to clear from left or from right or both. Clear both means that element
having clear:both styling defined in its tag should have both lefts and right clear.
1. Task: We write our Html file and save it.(see HTML for more details)
Add This code to your html file Type the code shown in the
image in your html file
3. Task: Now save CSS file (Press ctrl+s).While creating a style-sheet, just save the file as
Filename.css and put it in the same directory as your referenced html file.
4. Task: Open the html file in to web browser by double clicking on it and the output will be:
Lab 5: CLO: 1
Quiz 1 (Program the given screen shots using HTML, CSS, Bootstrap)
C++ Programs:
Example: Hello World Program
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World!";
return 0;
}
Output
Hello, World!
Every C++ program starts from the main() function.
The cout is the standard output stream which prints the "Hello, World!" string on the monitor.
The return 0; is the Exit status" of the program.
int main()
{
int number;
int main()
{
int firstNumber, secondNumber, sumOfTwoNumbers;
// Prints sum
cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;
return 0;
}
Output
Enter two integers: 4
5
4 + 5 = 9
In this program, user is asked to enter two integers. These two integers are stored in
variables firstNumber and secondNumber respectively.
Then, the variables firstNumber and secondNumber are added using + operator and stored
in sumOfTwoNumbers variable.
Finally, sumOfTwoNumbers is displayed on the screen.
int main()
{
int divisor, dividend, quotient, remainder;
return 0;
}
Output
Enter dividend: 13
Enter divisor: 4
Quotient = 3
Remainder = 1
The division operator / is computes the quotient (either between float or integer variables).
The modulus operator % computes the remainder when one integer is divided by another (modulus operator
cannot be used for floating-type variables).
int main()
{
cout << "Size of char: " << sizeof(char) << " byte" << endl;
cout << "Size of int: " << sizeof(int) << " bytes" << endl;
cout << "Size of float: " << sizeof(float) << " bytes" << endl;
cout << "Size of double: " << sizeof(double) << " bytes" << endl;
return 0;
}
Output
Size of char: 1 byte
Size of int: 4 bytes
Size of float: 4 bytes
Size of double: 8 bytes
int main()
{
int a = 5, b = 10, temp;
temp = a;
a = b;
b = temp;
return 0;
}
Output
Before swapping.
a = 5, b = 10
After swapping.
a = 10, b = 5
To perform swapping in above example, three variables are used.
The contents of the first variable is copied into the temp variable. Then, the contents of second variable is
copied to the first variable.
Finally, the contents of the temp variable is copied back to the second variable which completes the
swapping process.
int main()
{
char c;
cout << "Enter a character: ";
cin >> c;
cout << "ASCII Value of " << c << " is " << int(c);
return 0;
}
Output
Enter a character: p
ASCII Value of p is 112
When we explicitly print the integer value of a char type, it's corresponding ASCII value is printed.