0% found this document useful (0 votes)
28 views

L P Chro

The document is a lab journal for the Computing Fundamentals CSL-110 course. It details 14 experiments conducted, including building a computer system, using Microsoft Office programs, programming basics, and arrays. Key details provided include the student's name, enrollment number, experiments completed with dates and grades, and objectives, equipment, and conclusions for Experiment 1 on building a computer system. Experiment 1 involved familiarizing oneself with Windows, checking computer hardware specifications, and practicing keyboard shortcuts.

Uploaded by

Arham Iftikhar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

L P Chro

The document is a lab journal for the Computing Fundamentals CSL-110 course. It details 14 experiments conducted, including building a computer system, using Microsoft Office programs, programming basics, and arrays. Key details provided include the student's name, enrollment number, experiments completed with dates and grades, and objectives, equipment, and conclusions for Experiment 1 on building a computer system. Experiment 1 involved familiarizing oneself with Windows, checking computer hardware specifications, and practicing keyboard shortcuts.

Uploaded by

Arham Iftikhar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 195

Computing Fundamentals

CSL-110
LAB JOURNAL

Name: Muhammad Arham Iftikhar

Enrollment No: 09-239241-062

Section: BSRIS 1-B

Department of Robotics & Intelligent Systems


Bahria School of Engineering and Applied
Sciences H-11 Campus, Islamabad

1
Obtained
Exp. No Experiment Name Date Sign
Marks

1 Building up the Computer System

2 Basics of Microsoft WORD

3 Fundamentals of MS Power Point and MS Excel

4 Introduction to AI tools for robotics

5 Introduction to Microsoft Visio

6 Pseudocodes and Algorithms development through


Visual Logic
7 Introduction to Visual Studio and Code Debugging

Programming basics (operators, console input/output,


8
logic development)

9
Introduction to C/C++ Constructs ,Variable types and
memory

Decision Structures (if, if-else, Nested if, Nested if-


10
else, switch statement)

11 Iterative Structures (For, While, Do-While)

12 Single Dimensional Arrays

Programming for Robots (ROS)


13

14 Open Ended Lab

2
EXPERIMENT 01

Building up the Computer System

Objectives
1) To become familiar with the Windows OS environment
2) To become familiar with the hardware of your computer

Equipment /tool Used


 Computer with any version of windows installed

Background
What is a Computer?
• A computer is a machine that can be instructed to carry out sequences of arithmetic or
logical operations automatically via computer programming. Modern computers have the
ability to follow generalized sets of operations, called programs. These programs enable
computers to perform an extremely wide range of tasks.
• [The American Heritage Dictionary] A device that computes, especially a programmable
electronic machine that performs high-speed mathematical or logical operations or that
assembles, stores, correlates, or otherwise processes information.

Figure 1.1 Block Diagram of a Computer System

A computer does what it is told to do…


You tell a computer what to do by giving it a list of precise, unambiguous instructions, a
computer program.
Windows is the most common Operating System (OS) used for Personal Computers (PCs). It is
essential that you familiarize yourself with the basic functionality of this OS.

It is necessary that you are aware of the hardware in your computer. While the operating system
usually takes care of the complexity of managing the hardware of your computer system,
knowing the hardware helps when you must:

1) Install an operating system


2) Upgrade your computer system

3
3) Diagnose and repair problems in your computer system
TASKS

1) Familiarize yourself with the following basic tasks specific to Windows operating systems
[ask your instructor if you have problems]:

a) Copy and paste a file [select a file, right click > copy; go to the directory to paste into, right
click > paste]

Solution:

4
b) Creating a new file [hint: right click > new > file type]

Solution:

5
Create a new folder [hint: right click > new > folder

Solution:

6
c) Delete a file [hint: select a file, right click > delete]

Solution:

7
2) To check the hardware present in your computer, Right click on My Computer and then click
on Properties note down the specifications of the PC you are working on the default tab.

Figure 1.2 System’s specifications

8
a. What Operating System (OS) is being used in your computer?

Solution:
Windows 10

b. What is the CPU name?

Solution:
Intel(R) Core (TM) i7-10700 CPU

c. What is the clock speed of the computer’s CPU?

Solution:
2.9 GHZ

d. What is the amount of RAM present?

Solution:
16 Gigabytes

9
3) Click on the Remote settings then Computer Name tab.

Figure: 1.1 System Properties

a. What is the computer’s description?

Solution:
Not Available

b. What is the computer’s full name?

Solution:
EE-LAB-31

10
c. What is the name of computer’s workgroup?

(A workgroup is Microsoft's terminology for a peer-to-peer PC computer network.


Machines (with Microsoft operating systems) in the same workgroup may allow each
other access to their files, printers, or Internet connection. Members of different
workgroups on the same local area network segment and TCP/IP network can only
access resources in workgroups to which they are joined.
[http://en.wikipedia.org/wiki/Workgroup_(Computer_networking)])

Solution:
Bahria University

4) Click on the Hardware tab and then on Device Manager, note all information about hardware
devices here and answer the following questions?

Figure: 1.2 Device Manager

(Hint: you can right-click on any device and see further properties)

11
a) What is the name of the audio inputs and
outputs?

Solution:
S22e-20 (Intel (R) Display Audio

b) Does your computer have a Bluetooth


radio?

Solution:
NOT AVAILABLE

12
c) Does your computer have a keyboard?

Solution:
YES

d) What is the name of the monitor? Is the proper driver of the monitor installed? Double-click
on the monitor’s name to check the status of the device.
Solution:
Monitor Name: (S22e-20)
Driver: Proper Driver is Installed
Status: This device is working properly

5) Practice some keyboard shortcuts

 F1: Help
 Windows Logo+F1: Help

 Windows Logo: Start menu


 Windows Logo+R: Run dialog box
 Windows Logo+M: Minimize all opened windows
 Windows Logo+E: Windows Explorer
 Windows Logo+D: Minimizes all open windows and displays the desktop
 Windows Logo+TAB: Cycle through taskbar buttons
 Windows Logo+L: Lock the computer (without using CTRL+ALT+DELETE)
 CTRL+ESC: Open Start menus

13
 ALT+TAB: Switch between open programs
 ALT+F4: Quit a program
 SHIFT+DELETE: Delete an item permanently
 CTRL+SHIFT+ESC: Opens Windows Task Manager
 SHIFT+DELETE: Deletes an item immediately without placing it in the Recycle Bin
 TAB: Move to the next control in the dialog box
 F6: Move the cursor to address bar in internet explorer

6) What are the key board shortcuts for the following actions?

a) Open run dialog box

Solution:
Window + R

b) Open windows explorer

Solution:
Window+E

c) Close the current window

Solution:
ALT+F4

14
d) Minimize all windows

Solution:
Window+D

e) Move the cursor to address bar in internet explorer

Solution:
F6

f) Cycle through the taskbar buttons

Solution:
Window+TAB

g) Opens Windows Task Manager

Solution:
CTRL+SHIFT+ESC

h) Lock the computer

Solution:
Window+L

i) Delete an item without placing it in the recycle bin.

Solution:
SHIFT+DELETE

15
Conclusion:

Today I Learned How to Use Shortcut Keys. I copy and pasted


files using keyboard shortcuts which were new for me, and also
learned how to take screenshot. These Skills are essential for
succeeding in today’s technology-driven job market.

16
EXPERIMENT 02

Basics of Microsoft Office Word

Objectives

To become familiar with word processing and enable students to use the various tools in MS
Word effectively to perform common word processing tasks quickly.

Equipment /tool Used


 Computer with any version of windows installed
 MS Office (MS Word)

Background

Explore Window

Following is the basic window which you get when you start word application. Let us understand
various important parts of this window.

17
Figure: 2.1 Overview MS WORD

18
Backstage View

The Backstage view has been introduced in Word 2010 and acts as the central place for
managing your documents. The backstage view helps in creating new documents, saving and
opening documents, printing and sharing documents, and so on.

Figure: 2.2 Backstage View

Review Tab

The easiest way to correct spelling mistakes is to right click any word that has a red wavy
underline

Figure: 2.3 Review Tab

19
To check more than one word at a time, you can bring up the Spelling and Grammar dialogue
box. To see it, click on the Review tab at the top of Word. On the Review tab, locate the
Proofing section. Then click Spelling & Grammar:

Figure: 2.4 Spelling and Grammar

Word count provides the statistics that how many pages, lines and paragraphs etc. are in our
document

Figure: 2.5 Word Count

Another way To know the current word count of a document, open the document and right
click on the status bar at the bottom of the Word window. The context menu which comes up
will have an entry named “Word Count” which will tell you the current word count.

20
Figure: 2.6 Alternate for Word Count

Using “Language” tab one can change the language.

To insert a comment first select the text then go to “New Comment” on “Comments” group in
“Review” tab. Click on “New Comment” and a new comment will be inserted. You can also
move to next or previous comments and can also delete the comments using this “comments”
group.

To insert a comment in a document, highlight the area of text where you want to comment on.
Click the Review tab on the Ribbon then click New Comment

Figure: 2.7 Comment

21
Tracking Group:

With this feature of tracking, you can track and view all changes that are made to the document.
1. While in the document, On the Review tab, under the Tracking group, click Track
Changes.

Figure: 2.8 Track changes

1. On the Review tab, in the Changes section, click the Next button to move to the next change.
2. Click the Accept or Reject button to accept the change or reject the change and move to the
next change.
3. Keep going until you’ve responded to all the changes.

In “Compare” group there is an option to compare two different documents. This option is
usually used to find out the similarity between two different documents

Figure: 2.9 Compare Documents

22
After browsing the paths for original and revised documents click” ok”. A new document will be
opened that will highlight the changes present in the both documents.

View Tab

View tab is used to change the document views. Go through each view and observe the changes
that each view brings.

Quick Access Toolbar:

With MS Word 2010 there is also Quick Access Toolbar which has a save, undo Repeat Typing
button and Customize Quick Access drop down list. Within the list there are New, Open, Save,
E-mail, Quick Print, Print Preview and Print, Spelling & Grammar, Undo, and Redo, Draw
Table, Open Recent File icons. You can also choose to show the Quick Access Toolbar below
the Ribbon by choosing Show below the Ribbon selection and you can also customize further
with the More Commands button and make Microsoft Word 2010 suitable to your preferences
and needs. In such a manner Quick Access Toolbar of MS Word lets you performance routine
tasks much faster. The Microsoft Word 2010 Quick Access toolbar and its functionality are
shown below

Figure: 2.10 View Tab

Reference Tab

This tab provides the quick way to create table of contents, update it, enter citations or
references, choose any writing styles and footnotes etc. For generating the table of contents first
selects the text from the document to appear in it. After selecting the text, make it a heading from
“Styles” group in home tab. After making different headings, go to “Table of Contents” option in
“Table of Contents” group of “Reference” tab and select any one format.

23
Figure: 2.11 Table of Contents

In “Footnotes” group there is an option to add footnotes and endnotes. Footnotes and endnotes
are an easy way to add or provide the reader with supplementary information and that
information will appear at the end of the page.

To insert a footnote or endnote, navigate to Footnotes section. To insert a footnote, click the
menu option with text as AB1Insert (Placeholder1) Footnote

Figure: 2.12 Footnotes

Similarly, to insert an endnote, click the Insert Endnote menu option.

Figure: 2.13 Endnotes

24
The keyboard shortcuts for inserting a Footnote are Alt + Ctrl + F for inserting an Endnote is
Alt + Ctrl + D
Similarly, citations and bibliography can be inserted from “Citations and Bibliography” group.
The writing styles can also be changes from here as citations depend upon it. In technical writing
we have many different styles of writing that can be select from this group of “Reference” tab.

Figure: 2.14 Create Source

In “Captions” group, one can give captions to the figures and hence can create the table of
figures in the same manner as table of content were created.

Figure: 2.15 Table of Figures

25
Mailing Tab

We can create, and print envelops and labels using this tab. “Start mail merge” are used to create
a form letter which one uses for printing and sending purpose. We can select the recipient also.

Figure: 2.16 Mailing Tab

Insert Tab
Click the Insert tab and click Table button. This will display a simple grid shown below. When
you move your mouse over the grid cells, it makes a table in the table which appears in the
document. You can make your table having desired number of rows and columns

Figure: 2.17 Insert Tab

Click the square representing the lower-right corner of your table, which will create actual table
in your document and word goes in table design mode giving lots of options to work with table
as shown below.

Figure: 2.18 Designs

26
Following are the simple steps to “delete” an existing table from a word document.

Figure: 2.19 Layout

Step (1): Click anywhere in the table you want to delete.


Step (2): Click the Layout tab and click Delete Table option under the Delete Table Button to
delete complete table from the document along with its content.
Following are the simple steps to “add formula” in a table cell available in word document.
Step (1): Consider the following table where we will have total of the rows. Click in a cell that
should contain the sum of rows.

Figure: 2.20 Formula Button

27
Following are the simple steps to “add an existing picture” in your word document. It is
assumed that you already have a picture available on your PC before you add this picture in your
word document.
Step (1): Click in your document where you want to add a picture.
Step (2): Click the Insert tab and then click Picture option available in illustrations group,
which will display Insert Picture dialog box.

Figure: 2.21 Insert Picture Dialogue Box

Similarly, you can insert Clip Art, Shapes, and Charts etc.

NAME: ENROLLMENT:
INTRODUCTION TO COMPUTING LAB

Lab Number
Lab Title
Date
Semester & Section

28
Tasks:

1. Do the following formatting on given text

a. Type the formatting text in word file with entire document as 12-point Calibri (Body)
in your document.
b. Change the typeface of the entire document to 11-point Verdana.
c. Change all the word occurrences of the to a.
d. Change the spacing of the entire document from single spacing to 1.5.
e. Change the alignment of the entire document to Justify.
f. Set the phrases technology and science in Italic.
g. Change the color of the text.

Formatting Text

Today we are at the dawn of an age of unprecedented technological change. Sometimes referred to
as the Fourth Industrial Revolution, this historic moment has inspired a growing consensus that recent
developments in science and technology are of a unique nature, and likely to impact almost every
facet of our daily lives.

In areas from robotics and artificial intelligence (AI) to the material and life sciences, the coming
decades promise innovations that can help us promote peace, protect our planet, and address the root
causes of suffering in our world. Our enhanced ability to interact through cyberspace is sustaining
and reinforcing these broad technological strides, multiplying the opportunities we must share
information and build knowledge across our increasingly networked planet.

Solution

29
2. Do the following editing on given text
a. Change the text in form of bullets.
b. Change text Case
c. Insert borders and Shades
d. Insert Text Box
e. Insert Page Number
f. Insert a comment (not more than three lines).

Formatting Text

Today we are at the dawn of an age of unprecedented technological change. Sometimes referred to
as the Fourth Industrial Revolution, this historic moment has inspired a growing consensus that recent
developments in science and technology are of a unique nature, and likely to impact almost every
facet of our daily lives.

In areas from robotics and artificial intelligence (AI) to the material and life sciences, the coming
decades promise innovations that can help us promote peace, protect our planet, and address the root
causes of suffering in our world. Our enhanced ability to interact through cyberspace is sustaining
and reinforcing these broad technological strides, multiplying the opportunities we must share
information and build knowledge across our increasingly networked planet

Solution

30
3. Do the following task for the given data

a. Insert table and this data in it.


b. Write your name and registration number and insert footnote that shows your academic
qualification.
c. Using the data given to use mailing tab to mail the training date to the given people.
d. Insert table of contents that provides the reference to different tasks.
e. Show “X Y Scatter plot”

31
a. Insert table and this data in it.
b. Write your name and registration number and insert footnote that shows your academic
qualification.

c. Using the data given to use mailing tab to mail the training date to the given people.

32
d. Insert table of contents that provides the reference to different tasks.

33
e. Show “X Y Scatter plot”

4. Show the following mathematical expression using word equations:

a. Exponential

34
Solution

b. Matrix
Solution

c. Binomial formula
Solution

d. Quadratic formula
Solution

35
e. Integral
Solution

Conclusion:

36
EXPERIMENT 03

Fundamentals of MS Office PowerPoint and MS Excel

Objectives

 To become familiar with the basics of making presentations using MS PowerPoint


 To become familiar with the basics of good presentation design
 MS Excel is spreadsheet software in the Microsoft Office Suite. Excel allows you
to store manipulate and analyze data in organized workbooks for home and
business tasks

Equipment /tool Used


 Computer with any version of windows installed
 MS Office (MS Power Point)

Background
Microsoft Power Point

Microsoft PowerPoint is a software product used to perform computer-based presentations.


There are various circumstances in which a presentation is made: teaching a class, introducing a
product to sell, explaining an organizational structure, etc.

Home Tab

To begin Microsoft PowerPoint, go to Start Menu > All Programs > Microsoft Office >
Microsoft PowerPoint 2010. Select PowerPoint Presentation from the Project Gallery if a blank
document does not open.

The Design Ribbon toolbar contains several categories for formatting the design and elements of
your presentation. These include: Home, Insert, Design, Transitions, Animations, Slide Show,
Review and View. The brief introduction of these tabs is;

 The Home bar: This has features that allow you to edit Slides, Fonts, Paragraph, Drawing
and Editing.
 The Insert bar: This has features that allow you to add Tables, Images, Illustrations,
Links, WordArt, and Media Clips.
 The Design bar: This allows you to edit how your presentation will look. It includes
features such as Page Setup, Themes, and Background Styles.
 The Transitions bar: This allows you to edit Slide Transitions, Effects, and Transition
Timing. The Animations bar: This allows you to add custom animations to your
presentation. You can select from Preview, Animations, Advance Animation, and
Animation timing.
 The Slide Show bar: This has features that allow you to select how your presentation will
be displayed. From here, you can start your Slide Show, Set Up your Slide Show, and
37
Adjust Monitor Settings.
 The Review bar: This allows you to Proofread, Translate Languages, Comment Slides,
and Compare your Presentation.

38
 The View bar: This has features that allow you to set the View of your Presentation,
Create Master Views, Show/Hide Features, Zoom, Switch from Color to Grayscale,
Adjust Windows, and Add Macros.

Creating a new slide

1. To create a new slide where you can add content, click the Home tab and select New Slide.
2. Clicking the bottom half of New Slide will give you different new slide options.

Figure: 3.1 New Slide

Slide types or layouts include -


 title slides
 title and content slides
 comparison slides
 two content
 picture with caption slides
 and more

These layouts of slides will define the appearance of the slide and the way one can put data into
the slides. The layout of the slides can also be change after they are inserted. In Slides group,
there is a drop-down menu named as “Layout”. By clicking on layout tab and selecting a layout
style, the style of current slide can be changed.

39
Figure: 3.2 Layout

In this tab there is option to cut copy and paste the text. These options are available in
“clipboard” group of Home Tab. Shortcut keys for copy, cut and paste commands are Ctrl+c,
Ctrl+x and Ctrl+v respectively.
Font group allows you to change the font of the text, size, and case etc. of the text. Select the text
first then perform any operation.

Figure: 3.3 Fonts

In order to change the case of text, select the text you want to change then go to Font group of
Home Tab and choose an option from drop down list.
The simplest way to change the way your text looks is to use Bold, Italics, Underline
button on the formatting tool bar. To apply these, just click the button you want your text to be
formatted into. Formatting text involves Underline, Bold, Italic, and Text in different Fonts, Text
in different font sizes, and text in different colors.

Similarly, you can change the text color, outline and appearance etc.

You can make the lists by using bullets, numbering and multilevel list in the “Paragraph Group”.
1. Select the paragraphs you want to format
2. Click the Home tab on the Ribbon and click the Bullets or Numbering button in the
paragraph group

Click the list arrow on each button to apply a different style of bullets or numbering

40
Figure: 3.4 Bullets

Multileveled lists apply different bullets or numbering to the different levels of a list.
1. Select the paragraphs you want to format
2. Click the Home tab on the Ribbon and click the list arrow on the Multilevel List button in the
paragraph group

Figure: 3.5 Styles of Bullets

1. Select the style you want to use


2. Change the level of the items in the list by using the Tab key to increase the indent, and by
pressing Shift + Tab keys to decrease the indent
Similarly, text indentation is also done using this “Paragraph” group.

41
Figure: 3.6 Paragraph

Line and Paragraph Spacing

1. On the home tab of the ribbon, look for the paragraph group. Then click on the Line Spacing
button, as shown in the image below.

Figure: 3.7 Line and Paragraph Spacing

Select your desired line spacing. From this menu you can select to have your line spacing set to
1, 1.15, 1.5, 2, 2.5 or 3.

Figure: 3.8 Line and Paragraph Spacing

Text direction can also be changed.

 Select the test whose direction is to be changed


 Go to Home tab then in Paragraph group
 Select Text Direction and choose one option from the listed options

42
Figure: 3.9 Text Direction

After selecting from Text Direction, the text’s direction will be changed on slide.
To change the alignment of text within the text box, follow the following steps;
 Select the text. Go to Home tab then in “Paragraph” group.
 Click on “Align Text” option. Select any one option.

Figure: 3.10 Align Text

Simple plain text can be converted into SmartArt.

 Select the text. Go to “Home” tab.


 Go to “Paragraph” group and select the “convert to SmartArt” option.
 PowerPoint will list different types of SmartArt graphics.
 You can convert your SmartArt graphic back to text by right-clicking the graphic or
SmartArt shape and selecting Convert to Text.
 You will lose some text customizations, such as changes to the text color or font size that
you made to the text on the slide when you convert the text to a SmartArt graphic.

43
 After you select a layout for a SmartArt graphic, the text in your slides is automatically
put in shapes and arranged based on the layout that you chose. You can then customize
the SmartArt graphic by changing its color or by adding a SmartArt style to it.

You can change the colors applied to the shapes in your SmartArt graphic. The different color
combinations are all derived from the theme colors of your presentation.
1. Click the SmartArt graphic.
2. Under SmartArt Tools, on the Design tab, in the SmartArt Styles group, click Change
Colors.

Figure: 3.11 Smart Art Styles

If you don't see the SmartArt Tools or Design tabs, make sure that you've selected a SmartArt
graphic. You may have to double-click the SmartArt graphic to select it and open the Design tab.

3. Click the color variation that you want.

The figure shown below states the conversion of the text into SmartArt. It shows how the plain
bulleted text is converted into a professional design.

Figure: 3.12 Smart Art Designs

44
“Drawing” Group of home tab is used to create different type of shapes like square etc.

Figure: 3.13 Drawing

Shape outline, color and effects can be changed using the same group in Home Tab.
Find Replace option in editing group:

1. On the “Home” tab of the Ribbon, go to the “Editing” group, and select “Find” … or use the
shortcut key CTRL+F.
2. Type the word you want to find, and then press enter.

If you want to make a change to a specific word, you want to use the replace functionality. To
replace a word/s in PowerPoint:

1. Go to the “Editing” group, and select “Replace”, or use the shortcut key CTRL+H
2. In the “Find what” text box, type the word you want to find
3. In the “Replace with” text box, type the word that you want to replace the original word with
4. To replace words one at a time, click “Replace”, if you want to replace every occurrence of
the word in the document, click “Replace All”

Figure: 3.14 Editing

Insert Tab

First group in insert tab is “Tables”. On selecting the “table”, different option will appear from
where rows and columns can be selected.

 Click on the arrow underneath Table. This will open up a new box with several options
for creating a table.
 If you select the Insert Table option, a dialog box will appear where you can enter more
exact specifications for the table.

45
Figure: 3.15 Insert Table

Next group is “Images” group. Any picture placed in any directory of the computer can be
accessed using “Picture” option of this group and can be inserted in slides. Similarly, Clipart can
also be inserted using this group.

Figure: 3.16 Insert Images

It has an option of getting Screenshots. PowerPoint will automatically take the screenshots of
already opened windows and gives the option to select the screenshot and insert in slide.

To create a photo album


 Go to “Images” group of “Insert” tab.

Click on the. It will give an option to create a new album or edit the existing one.
 On clicking the new photo album, the dialogue box is opened

46
Figure: 3.17 Photo Album

On selecting multiple files for album, a new presentation will be generated having all those
selected pictures.

Shapes, SmartArt and charts can be inserted using the “Illustrations” group of the “Insert”
tab. Adding Audio / Video to PowerPoint presentation:

1. Click on the Insert tab of the ribbon.


2. Click on the Movie or sound button in the media clip group to insert video or audio
in Presentation.
3. There are different options available for inserting audio or video to PowerPoint slides.
4. If you want to hide the audio file during slide show, select “Automatically” from Play sound
drop down menu and check the Hide during show option in the sound options group

Figure: 3.18 Video from file

47
Adding Hyperlink:

Select the text or image to link to insert a hyperlink. From right-click menu, click Hyperlink
option

Figure: 3.19 Hyperlink

This will bring up Insert Hyperlink dialog, from left side bar, select place in This Document,
from center pane, select a slide to create link with and click OK.

Figure: 3.20 Insert Hyperlink

This will insert a hyperlink in a specified slide.


Using “Text” group of “Insert” tab we can insert different text boxes, slide number and word art
etc.

Figure: 3.21 Insert Tab

48
Similarly, different equations can be inserted or created in the slide

Task:

 Select theme for your presentation


 Add hyperlink to an image and a word
 Add video to your slides
 Convert text to Smart Art
 Insert equation
 Insert slide number and footer
 Write your name and rotate to 270°.
Solution

49
50
51
52
53
54
Conclusion:

55
EXPERIMENT 04

Introduction to MS Office Excel

Objectives

MS Excel is spreadsheet software in the Microsoft Office Suite. Excel allows you to store
manipulate and analyze data in organized workbooks for home and business tasks

Equipment /tool Used


 Computer with any version of windows installed
 MS Office (MS Excel)
Background
Microsoft Excel is a spreadsheet developed by Microsoft for Windows, macOS, Android and
iOS. It features calculation, graphing tools, pivot tables, and a macro programming language
called Visual Basic for Applications. It has been a very widely applied spreadsheet for these
platforms, especially since version 5 in 1993, and it has replaced Lotus 1-2-3 as the industry
standard for spreadsheets. Excel forms part of Microsoft Office.

Figure: 34.221 Overview

To begin, open Excel 2016

Creating New Blank Workbook


a. At the top-left of your screen, you will see a File Button. Click on that Button and select new
b. Select ‘Blank Workbook’ from the window that appears, and click create
c. A new Excel workbook opens

56
Opening an Existing Workbook
a. Go to the File Button menu and click on ‘Open’
b. A window appears with some path set (typically ‘My Documents’). The left-hand side of
the window shows some links that allow you to browse through different folders and
change the path
c. Go to the folder where the workbook you want to open is located, select the workbook
and click open

A. Inside Home tab


a. In the Home tab you will see different sections ‘Clipboard’, ‘Font’,
‘Alignment’, ‘Number’, ‘Styles’, ‘Cells’ and ‘Editing’.
b. Each section has different buttons. When you place mouse pointer over a button for
two seconds, a description of the button appears. Try placing the pointer over different
buttons and read the description of each button.

I. Exploring the Fonts Section


a. Make the text bold by selecting some text and clicking on ‘B’.
b. Italicize the text by selecting some text and clicking on ‘I’
c. Similarly, you can underline by clicking ‘U’, add border to cell. Change the font –
type or the font-size. You can change the color of the text or highlight the text.
d. Inside the Font section, click on the little arrow in the bottom right to explore
more options.

II. Exploring Alignment section

a. Text Alignment
 You can left align text
 You can right align text
 You can center align you text
 You can top align text
 You can middle align text
 You can bottom align you text
b. You can change text orientation, wrap text and merge & center multiple cells as well

III. Exploring Alignment section


Explore the use of
‘Increase indent’ button.
‘Decrease indent’ button

IV. Creating New Sheet

You can create multiple sheets within a single workbook

Figure: 34.23 Sheet

57
B. Page Layout Section
 This tab is majorly used to set the margins, orientation and background of
the spread sheet.
 There is an option “Print Area” in page setup group. By using this option we
can select the area for printing purpose
C. Formula Section
• We can apply different formulas using this tab. Function library group is one of
the mostly used groups

Figure: 34.243 Toolbox


Use of Basic Statistics
You can use most common statistical metrics.
• Mean  Average ()
• Sum of points / no. of points
• E.g. you have points, 4, 5, 6 then mean = (4+5+6)/3 = 5
• =Average ()
• Min/Max  minimum or maximum
• Max (4, 5, 6) = 6
• Min (4, 5, 6) = 4
• Standard Deviation  How wide-spread the data is.
• Bigger the spread, higher the standard deviation.
• Size of dataset also effects value of standard deviation.
If we only have a few numbers ranging between 1 and 10 for example, the standard deviation
will likely be higher than if we have thousands of numbers ranging between 1 and 10. For
example,
Both these sets A and B have an average of 5. But A has a standard deviation of 0.7 while B has
a standard deviation of 4.1. Excel has a simple function to calculate the standard deviation of a
set of points:
=stdev ()

Insert a linked Excel chart in PowerPoint


You can insert and link a chart from an Excel workbook into your PowerPoint presentation.
When you edit the data in the spreadsheet, the chart on the PowerPoint slide can be easily
updated.
1. To chart your data in a worksheet
a) Make this table in Excel worksheet

58
Figure: 34.254 Excel worksheet

b) Select the data that you want to chart

Figure: 34.265 Excel worksheet

c) On the Insert tab, in the Charts group, click the chart type that you want to use, and then
click a chart subtype.

Figure: 34.276 Chart

To insert a linked Excel chart in PowerPoint


a) Open the Excel workbook that has the chart that you want.
Notes:
• The workbook must be saved before the chart data can be linked in the PowerPoint
file.
• If you move the Excel file to another folder, the link between the chart in the
PowerPoint presentation and the data in the Excel spreadsheet breaks.
b) Select the chart.
c) On the Home tab, in the Clipboard group, click Copy
d) Open the PowerPoint presentation that you want and select the slide that you want to
insert the chart into.
e) On the Home tab, in the Clipboard group, click the arrow below Paste, and then do one of
the following:

59
a. If you want the chart to keep its look and appearance from the Excel
file, select Keep Source Formatting & Link Data
b. If you want the chart to use the look and appearance of the PowerPoint
presentation, select Use Destination Theme & Link Data
f) You can edit chart data in PowerPoint or in Excel by pressing Right Click->Edit Data

Figure: 34.287 Charts in PowerPoint

Copying chart as a picture from Excel sheet


• Use the option of Special Paste.
CHART TITLE
Projected Actual

99
85
84
30

QTR QTR
1 2
Figure: 34.298 Charts in PowerPoint Special Paste

Task:

 Select theme for your presentation


 Add hyperlink to an image and a word
 Add video to your slides
 Convert text to Smart Art
 Insert equation
 Insert slide number and footer

60
 Write your name and rotate to 270°.
Solution

61
62
63
Tasks:
Do the following tasks

a) Sinusoidal Curves: Generate and plot a 101 sampled sine and a cosine wave of 5
Hz frequency as shown below


• where = 5 Hz
• ranges from 0 to 1 in step of 0.01

Figure: 34.309

Solution

64
65
66
b) Generate a plot of following polynomials

where ranges from -50 to 50 in step of 1


Solution

67
68
69
70
2. Grade sheet
• Create a data that represents the marks obtained by the students in HomeWork#1,
HomeWork#2 and HomeWork#3 (The marks obtained are out of 10 for each
homework)
• Add the data for 10 students, the columns hold categories of the data like:
Students | Name | HW # 1 | HW # 2 | HW # 3
• Apply functions on the data such that
• Fifth column contains the total marks obtained by a student in all the 3
homework.
• Sixth column contains the average of the marks obtained.
• Seventh column contains the percentage.
• Eighth column contains the maximum marks obtained by a student.
• Ninth column contains the minimum marks obtained by a student.
Solution

71
72
73
Conclusion:

74
Experiment 4
Introduction to AI tools for Robotics
Objectives

 To become familiar with current AI tools used to program and develop systems for
robotics.

Equipment /tool Used


 Computer with any version of windows installed

Background
Robotics and artificial intelligence have both been era-defining technologies, and the fusion of both was
nothing short of a revolution. AI in robotics has seen vast success across multiple industries and gained a
significant market over the last few years.

Many organizations integrate AI robots into their routine procedures for increased productivity, efficiency,
and better customer experience. Dominating both tech and non-tech industries, robots can be seen greeting
customers at stores, waiting tables at restaurants, harvesting crops, or lifting heavy loads at manufacturing
plants. In industrial settings, AI-enabled robots keep workers safe by operating in shared spaces. They also
perform complex tasks such as cutting, grinding, welding, and inspection autonomously.
ChatGPT

The most popular AI tool in the current market is ChatGPT, a text-based AI model developed by
OpenAI. One of its standout features is the ChatGPT plugins, particularly designed to enhance
human productivity and efficiency. These versatile plugins find applications across a wide range of
75
domains, including coding, finance, design, and numerous others, delivering top-notch results for
humans.
ChatGPT best features
Flexibility: You can use this AI chatbot for so much more than coding. Because it’s simply a
question-and-response tool, it can streamline workflows across every role in your organization
Follow-up questions: Some AI coding generators fail at the first hurdle by not understanding the
full context of your question. Because ChatGPT asks follow-up questions, it can help you
identify the information you need to provide to get an accurate response
Code review: ChatGPT is particularly adept at identifying errors within your code and helping you
correct them
ChatGPT limitations
Limited context: Some users complain that, in longer conversations, this chatbot has a tendency to
lose the plot. It may forget the information you fed it earlier in the conversation and fail to
provide coherent answers
Generic responses: Some also say this program has a tendency to provide the same boilerplate
responses over and over again, even when the context is different
CodeT5

CodeT5 has a built-in encoder model and a decoder model that allow it to translate natural language
into code (much like ChatGPT) but also to translate code into natural language. So not only can you tell
CodeT5 what to do, but it can tell you what a particular code snippet does. It’s a two-way conversation.
CodeT5 best features
 Text-to-code generation: Much like with chatbot AI, you can give CodeT5 a prompt, and it will write
code to match your request
 Code-to-code translation: If your team works in multiple program languages, CodeT5 can take your
code in one language, like Python, and translate it into another, like JavaScript
 Code summarization: This program can explain what a piece of code does in plain language, which
can help even experienced software developers to learn new languages and frameworks
76
CodeT5 limitations
 Possible security risks: The team that designed CodeT5 says that this software might contain sensitive
personal information, like addresses and ID numbers, and it could generate vulnerable code

Google Bard
The top rival of ChatGPT is Google Bard, which is referred as a conversational generative artificial
intelligence chatbot created by Google. Google Bard can chat with people and hold interactive conversations. It
uses advanced AI technologies like LaMDA, PaLM, Imagen, and MusicLM. These technologies are being used
to come up with innovative ways to interact with information, including language, images, videos, and audio,
making the tool quite powerful.

aiXcoder
aiXcoder stands out as the best AI tool for coding, offering the capability to generate code at the method-level
directly from natural language input. It also provides intelligent code completion for entire sections or multiple
lines of code. This tool assist users to seamlessly incorporate suggested code from aiXcoder or continue writing
to receive immediate, contextually-driven feedback.

TabNine
Tabnine serves as an AI code assistant trusted by a global community of over a million developers across
numerous companies. It offers tailored code suggestions that greatly enhance efficiency, simplifying repetitive
coding tasks and yielding top-tier, industry-standard code. Tabnine utilizes a Large Language Model (LLM)
trained on reputable open-source code with permissive licenses, StackOverflow Q&A, and even your entire
codebase (Enterprise feature). This means it generates more relevant, higher quality, more secure code
than ChatGPT 4 or other tools on the market.

SecondBrain
Previously recognized as MagicChat, SecondBrain helps you to construct ChatGPT-like bots equipped with in-
depth familiarity with your business or product, bolstering your sales and customer service initiatives. By
utilizing various content sources such as webpages, files, and documents, you have the capability to train your
bot on how to provide immediate assistance to users visiting your website with inquiries about your services.

77
Lab Task:

78
79
EXPERIMENT 05

Introduction to Microsoft Visio

Objectives:

 To learn about basics of Microsoft Visio and to organize complex ideas visually.
 To design flowcharts, choice graphs and network diagrams.

Equipment / Tool:

 PC and Microsoft Visio.

Background:

Computer diagramming is the process of creating scalable diagrams on a PC that can be used in
various applications such as layout design, organization charts, timelines, floor plans and even
prototype software user interfaces. Diagrams are made of shapes, objects, and stencils, which
when combined correctly, can help project a lot of useful information.

Microsoft Visio is one of the most popular diagramming software that empowers diagramming,
data visualization, and process modelling in a familiar interface. Visio comes with an array of
templates and built-in shapes that allow creating virtually any diagram of any complexity. Visio
also allows users to define their own shapes and import them into the drawing.

Visio ─ User Interface:

The user interface of Visio is like that of other programs in the Office suite. You will be greeted
with a Start page that lists some of the recent documents you have opened along with featured
templates for creating common diagram types. You can also search for templates on the
Microsoft website right from the Start screen.

80
Fig 5.1 Start Screen

Clicking any of the above templates opens the template document.


The document interface of Visio is like other Office programs such as Word or Excel.
On the top, you have the Quick Access toolbar, which contains common commands, such as
Save, Undo, and Redo.
Below the Quick Access toolbar is the familiar Office Ribbon. The Home tab lists common
commands for working with the document.

Fig 5.2 Document Interface

81
Visio ─ Creating & Arranging Smart Shapes

Smart Shapes provide contextual shapes which relate to the selected shape.
Start with a blank document (in this case a flowchart diagram). You will notice that the
Shapes pane has different shapes that are applicable to flowcharts.
Click and drag a shape onto the empty canvas. You can resize or rotate the shape as desired.
You can even align the shape with the help of the alignment guides.

Fig 5.3 Creating Smart Shapes

When you drag a shape onto the canvas, you will notice that there are four arrows along the
shape.
Click the desired shape to create the shape.
The connections between the shapes are dynamic and they will move in relation to the
placement of the shape.

82
Fig 5.4 Connections between the shapes Fig 5.5 Arranging smart Shapes from data
base

Visio ─ Shape Formatting

To format shapes, select the shape in the diagram and format using the options available in
the Shape Styles section.
You can select predefined shape styles, or you can customize the shape using the Fill
dropdown menu.
To adjust the color of the shape border, select a color from the Line dropdown menu. The
Effects menu allows to add special effects to your shape such as drop shadows or 3D
rotations.

Fig5.6 Shape Formatting

83
To format a shape outline, click the shape or hold down the Ctrl key on the keyboard and
select multiple shapes.
Then, from the Shape Styles section of the home tab, click Line and select Line Options. This
will open a Format Shape flyout.
In the Line section, select the options you need to customize the shape outline.
You can change the color of the shape outline, increase the width to add more weight, change
the rounding, and a whole lot more. You can also create gradients for the line to suit the
diagram.

Fig 5.7 Formatting Shape Outlines

Like shape outlines, connectors can also be formatted as needed.


To format a connector, select the connector in the diagram and bring up the Format Shape
pane by going to the Line dropdown menu and clicking Line Option. In the Line section of
the Format Shapes pane, select the Dash type of your choice to change the connector pattern.
You can also change the color of the connector and adjust the transparency levels as needed.

84
Fig 5.8 Formatting Connectors

Visio ─ Re-Layout Page

Open the diagram and navigate to the Design tab on the Ribbon.
Click the Re-Layout Page dropdown menu and select a layout as needed.
You will see that the diagram now changes to the selected layout. You can also preview the
look before clicking by hovering the mouse over the layout style.

Fig 5.9 Changing the diagram layout

You can further customize the layout by clicking More Layout Option in the Re-Layout Page
dropdown menu.
This opens a dialog box in which you can configure the layout properties.

85
You can change the spacing between the shapes by manually changing the values in the
Spacing field.

Fig 5.10 Customizing the layout

Visio ─ Inserting Text

It is easy to insert text within a shape.


Just double-click within a shape to type the text.
The text automatically wraps according to the shape; however, you can also press hard
returns if you’d like to have your own wrapping.
Notice that Visio automatically zooms into the shape to enable typing and zooms out when
you click outside the shape.

Fig 5.11 Inserting Text in Shapes

86
To insert a text in a document such as a heading for the chart, click the Text Box
dropdown menu in the Insert tab on the Ribbon and select either horizontal or vertical
text box.
Then place the cursor on the document and draw a text box to start typing.

Fig 5.12 Inserting Text in a Document

Visio ─ Text Formatting

To format the text, select the text box containing the text or highlight the text itself.
Then, choose from the options available in the Font and Paragraph sections of the home tab.
You can change the font, size, color, and paragraph alignment. If you want to change the font
styles in a shape, just double-click the shape to select the text within the shape and change
the font styles as desired.

Fig 5.13 Text Formatting

87
Visio ─ Inserting Backgrounds

You can change the background of a document by choosing from preset backgrounds or
using your own background template.
To insert a background, click the Background dropdown menu from the Design tab on the
Ribbon and choose a background preset.
This creates a new page in addition to the diagram page.
You can right-click the newly created background page to rename it.
The new background will be automatically applied to all newly created pages in the
document

Visio ─ Themes

Visio allows to customize the theme and overall look of the document.
To apply a theme, go to the Design tab and choose from any of the many theme options
available. You can choose from a selection of Professional, Hand Drawn, Trendy, and
Modern themes.
Once you click any of the available themes, the theme will be applied to the document.

Fig 5.14 Selecting a Theme

88
The Variants section allows you to customize theme colors as needed.
Clicking the dropdown menu in the Variants section allows to customize the theme colors,
effects, and connectors.
To customize a theme color, go to the Colors submenu in the Variants section and click
Create New Theme Colors.

Fig 5.15 Changing Theme Color

Visio ─ Inserting Hyperlinks

To insert a hyperlink, first create a text box by going to the Insert tab in the Ribbon and
drawing a horizontal text box for the text that represents the hyperlink such as ‘Website’ or
‘Click here to visit us’.
This text now needs to be converted into a hyperlink. To do so, select the text in the text box
and in the Insert tab again.
Click Link to open the Hyperlinks dialog box. You can specify the links to websites or a
local file on your computer.
Click OK to convert the selected text into a hyperlink.

89
Fig 5.16 Inserting Hyperlink

Lab Task:

Implement following flow diagrams in Microsoft Visio.

90
Solution

Conclusion:

91
EXPERIMENT 06

Pseudocodes and Algorithm development through Visual Logic

Objectives

The purpose is to gain fundamental skills to plan the logic of a program by ways of developing
simple logical statements. Whereas ,visual logic is a tool for creating program flowcharts. It
helps to gain fundamental skills to plan the logic of a program by ways of developing an
algorithm in the form of flowchart.

Equipment /tool Used


 Computer with any version of windows installed
 MS Office (MS Word)
 Visual Logic (http://www.visuallogic.org/download).

Background
Pseudo code
Pseudo code omits programming level details (like declaration of variables, looping syntax ...)
and so it makes things very easy to understand for human being and implement it in any
programming language easily.

Rules for Pseudo-codes


• Write only one statement per line
• Each statement in your pseudo code should express just one action for the
computer.
• Capitalize initial keyword
• READ, WRITE, IF, ELSE, ENDIF, WHILE, ENDWHILE, REPEAT, UNTIL
• End multiline structures
• Use END in IF/ELSE conditions and main program
Example-1
Read a number from user and print it on console

Figure: 6.1 Pseudocode

Pseudocodes describes the logic flow in which the program is executed

92
EXAMPLE 2:

Figure: 6.2 Pseudocode with if condition

EXAMPLE 3:

Nesting if statements

Figure: 6.3 Pseudocode with nested if condition

93
Visual logic - Background
The programming process follows a program development lifecycle with its initial steps as
understanding the problem and planning the logic. This session focuses on ‘planning the logic’
where we will learn how to develop an algorithm in the form of flowchart

Symbols Used in Flowchart

Figure: 6.4 Symbols used in Flowcharts

VISUAL LOGIC
SYNTAX

The starting flowchart displays a “Begin” and “End” symbol as shown. To create a flowchart,
you add symbols between these starting symbols.
Hover your mouse over the red arrow between the Begin and End symbols. It will turn green,
indicating that you can click on it to get a popup window. This popup window has the other
symbols we will need to create programs.

94
Figure: 6.5 Visual logic options

Click on the green arrow and select the Output symbol.


This inserts the Output symbol into the flowchart as shown. The Output symbol produces output
on the display screen. Next, we will specify what the program should output.

Figure: 6.6 Basic Visual logic flowchart

Double click on the Output symbol to get the Output dialog box.

Figure: 6.7 Visual logic Output

Enter your own name and be sure to enclose it within quotes. Later, we will use variables
that don’t use quotes. Click on the “OK” button when done, and the Output symbol will

change to show your intended output. Run the program by clicking on the button on the
toolbar, or by pressing the F5 function key.

95
Example of flowcharts

Figure: 6.8 Example of Flowchart

96
Questions (Pseudocode)

1. Write a Pseudocode. Read in a number and check if the number entered by user is odd or
even.
2. Write a Pseudocode. Read in two numbers, call them A and B. If A is greater than B,
print out A, otherwise print out B.
3. Write a Pseudocode. Read in a number and display the grade of a student.
4. Write a Pseudocode. Read in three numbers, call them A, B and C
 If A is bigger than B, then if A is bigger than C, print out A, otherwise print out
C.
 If B is bigger than A, then if B is bigger than C, print out B, otherwise print out C.
5. Write a Pseudocode. Display your name and class
6. Write a Pseudocode. Read in the variables and find the area of triangle.
7. Write a Pseudocode. Read in the variables ‘x’ and ‘y’ and get their sum if x>y.

Tasks (Flowchart)

a. Develop the flowchart of a program that takes the radius and height of a cylinder and
calculate its volume
b. Draw flowchart to find the largest among three different numbers entered by user.
c. Develop the flowchart of program to check input characters as vowel or consonants.
d. Develop the flowchart to convert Fahrenheit temperature to Celsius
e. Develop the flowchart that swaps the values in two variables
f. Develop the logic of program to prints out if the number entered is negative
g. Develop a flowchart that sums all the even numbers between 1 and 20, and then
displays the sum

97
1. Write a Pseudocode. Read in a number and check if the number entered by user is odd
or even.

98
99
2. Write a Pseudocode. Read in two numbers, call them A and B. If A is greater than B,
print out A, otherwise print out B.

100
101
3. Write a Pseudocode. Read in a number and display the grade of a student.

102
103
4. Write a Pseudocode. Read in three numbers, call them A, B and C
 If A is bigger than B, then if A is bigger than C, print out A, otherwise print
out C.
 If B is bigger than A, then if B is bigger than C, print out B, otherwise print
out C.

104
105
5. Write a Pseudocode. Display your name and class

106
6. Write a Pseudocode. Read in the variables and find the area of triangle.

107
108
7. Write a Pseudocode. Read in the variables ‘x’ and ‘y’ and get their sum if x>y.

109
110
a. Develop the flowchart of a program that takes the radius and height of a cylinder
and calculate its volume (V=πr^2 h)

111
112
b. Draw flowchart to find the largest among three different numbers entered by user.

113
c. Develop the flowchart of program to check input characters as vowel or consonants.

114
115
d. Develop the flowchart to convert Fahrenheit temperature to Celsius

116
117
e. Develop the flowchart that swaps the values in two variables

118
119
f. Develop the logic of program to prints out if the number entered is negative

120
g. Develop a flowchart that sums all the even numbers between 1 and 20, and then
displays the sum

121
122
Conclusion:

123
EXPERIMENT 07

Introduction to Visual Studio and Code Debugging

Objectives

The purpose of the lab is to get started with the basics of programming language and to get
familiar with debugging the code.

Equipment /tool Used


 Computer with any version of windows installed
 Visual studio 2010/2015 Professional

Background
Introduction to C/ C++ Language
C is developed by Dennis Ritchie at AT&T Bell Labs in 1970s which used to maintain UNIX
systems. Many commercial applications are written in C.
C++ was developed by Bjarne Stroustrup at AT&T Bell Labs in the 1980s. This overcame
several shortcomings of C. It also incorporated object-oriented programming .C remains a subset
of C++. ‘++’ is an operator in C++.
The Computer Onion

Figure: 7.1 Computer Onion

Program Elements
A basic program has following elements:
1) Comments declared as //, /* */
2) Include files
3) Function including exactly one main function
4) Main function contains code or logic of your program being written in programming
language

cout and cin

124
 cout is a standard console output stream object.
 Used with insertion operator ‘<<‘ to display output on the console.
 Insertion operator sends the variable data from its right side to the left side.
 cin is a standard console input stream object
 Used with the insertion operator ‘>>’ to read any number, character from user

Variables
• Variables are used to hold values
• The values can be of certain types e.g. it can be numbers, characters etc.
• To hold each value uniquely, each variable is initialized with a data
type For example:
int a = 10;
float b = 0.5;
char c = ‘a’;

A Basic Program in C++

Figure: 7.2 Basic Program

Figure: 7.3 Basic Program

125
Output

Figure: 7.4 Output

Bugs and Debugging

The errors in programming are called bugs. The process of tracking bugs and removing them is
called debugging. Three kinds of errors can occur in a program

1) Syntax Errors

2) Semantic Errors

3) Runtime Errors

1. Syntax Errors: These errors occur when you didn’t follow the syntax of the
programming language. The program will not be compiled if you don’t remove them.
Syntax errors in English language are e.g. Hailo, haow r yeow?

2. Semantic Errors: These are also known as logical errors. The program will compile and
run successfully but it will not do the intended task. This is because there will be an error
in the logic (content) of the program. Debugging logical errors can be tricky because it
requires you to scan the code logically to look for the mistakes. With experience, you will
learn to overcome them easily.

3. Runtime Errors: These errors come at the program execution stage. They are also
known as “Exceptions”. They usually come if the program flow goes out of the expected
order. They are usually rare.

126
Code debugging: It is helpful to detect logical and run time errors from the code. It can also
provide step by step code monitoring. This requires that you add breakpoints at the desired line
of code. Press F11 key to check result at each statement. Press F10 key to execute line of codes
in the current function.

Introduction to Visual Studio

Programming IDE was developed by Microsoft. They used to implement different interactive
software. Visual Studio is an integrated development environment (IDE) that provides a mean to
tell a computer how to do something. Commonly supported languages in VS are: C, C++,
C#.NET and Visual Basic.NET, JavaScript, Python etc.

Figure: 7.5 Visual Studio Overview

127
Figure: 7.6 New Project

Figure: 7.7 New Project Screen

128
Example

Print “Hello C++ World” in Visual Studio using C++ and debug it

Example

Questions:

a. Develop a program that takes two numbers and display their multiplication and
sum.
b. Develop a program that takes two numbers and display their multiplication
c. Develop the logic and write a program that takes the radius and height of a cylinder
and calculate its volume
d. Develop a program to convert Fahrenheit temperature to Celsius

e. If the marks obtained by a student in five different subjects are input through the
keyboard, write a program to find out the aggregate marks and average marks
obtained by the student. Assume that the maximum marks that can be obtained by a
student in each subject are 100. Take the aggregate sum in ‘int’ and average in float.
Type cast from int to float to take average. Language Allowed: C++

129
1. Develop a program that takes two numbers and display their multiplication and sum.
Solution

130
2. Develop a program that takes two numbers and display their multiplication
Solution

131
132
3. Develop the logic and write a program that takes the radius and height of a cylinder
and calculate its volume
Solution

133
134
4. Develop a program to convert Fahrenheit temperature to Celsius
Solution

135
136
5. If the marks obtained by a student in five different subjects are input through the
keyboard, write a program to find out the aggregate marks and average marks
obtained by the student. Assume that the maximum marks that can be obtained by a
student in each subject are 100. Take the aggregate sum in ‘int’ and average in float.
Type cast from int to float to take average. Language Allowed: C++
Solution

137
Conclusion:

138
EXPERIMENT 08

Programming basics (operators, console input/output, logic development)

Objectives

The purpose of the lab is to get familiar with operators more thoroughly and sharpen the skill of
logic development through visual studio C++ programming.

Equipment /tool Used


 Computer with any version of windows installed
 Visual studio 2010/2015 Professional

Background
C++ Operators: An operator is simply a symbol that is used to perform operations. There can be
many types of operations like arithmetic, logical, bitwise etc. There are following types of
operators to perform different types of operations in C language.

1) Arithmetic Operators
2) Relational Operators
3) Logical Operators
4) Bitwise Operators
5) Assignment Operator
6) Unary operator
7) Ternary or Conditional Operator
8) Misc Operator

Figure: 8.1 Table of Operators

139
Task:

a. The departmental store manager wants a program that calculates and displays the sale
price of a good when its cost price is entered. Sales price is the final price that has 15%
of GST added to cost price. Develop the logic of this program. Languages Allowed: C+
+

Solution

140
b. Body mass index (BMI) is a statistical measurement that compares a person’s weight
and height. To calculate BMI, you multiply your weight in pounds by 703 and divide
the result by the square of your height in inches. Develop the logic for a BMI calculator.
Language: C++

Solution

141
142
c. Develop a program that takes a three-digit number and display the sum of these
numbers. Languages: C++

Solution

143
144
d. Write a program that asks the user to enter a US dollar amount and then shows how to
pay that amount using the smallest number of $20, $10, $5, and $1 bills.

For example, see the sample execution of program below:


Enter a dollar amount: 93
$20 bills: 4
$10 bills: 1
$5 bills: 0
$1 bills: 3
Solution

145
Conclusion:

146
EXPERIMENT 093
C/C++ Constructs ,Variable types and memory

Objective:
To familiarize students with the different constructs, variable types and memory usage.

Equipment/ Tools Used:


Microsoft Visual Studio 2022

Background:

Creating an Empty Console Project

Most of the code you encounter while learning C can be run using simple text input with text output
directly to a console window. These tutorials will use an empty project configured as a console
application. You can add new source files and code and see the results on the command line.

Here is how you create an empty console project in Visual Studio 2022:
Launch Visual Studio 2022.

On the menu bar, choose File, New, Project.


In the Visual C category, choose Empty Project and then name the project. Choose a name that gives
some indication of contents – for example, “HelloWorld” for a tutorial or “GuessTheNumber” for a
number guessing application.

In Solution Explorer, right-click Source Files then choose Add, New Item.

147
In Add New Item, choose C File (.c) and then name the file (if file extension is “.cpp” then replace it
with “.c”). Again, the name should reflect the file contents. For example, “HelloWorld” for tutorial code.
Click Add.

Hello World!

Time for the traditional first C demo, “Hello, World!”.

To create the Hello, World! application:


Create an empty console project and name it “HelloWorld”; use that name for the .c source file as well.
In the empty “HelloWorld.c” file, enter the following code:

#include <stdio.h>
int main()
{
printf("Hello World!");
return 0;
}

Press CTRL-F5 to run the program. When you are asked if you want to build it, click Yes. This is the first
time you have run the program, so Visual Studio needs to build it.

Hit a key to end the program.

Congratulations on your first C program.

Let’s take a closer look. Line numbers have been added for reference and are not part of the program code.

148
1 #include <stdio.h>
2
3 int main() {
4 printf("Hello World!");
5 return 0;
6}

Line 1: #include <stdio.h> is a header file library that lets us work with input and output functions, such
as printf(() (used in line 4). Header files add functionality to C programs.
Line 2: A blank line. C ignores white space. But we use it to make the code more readable.
Line 3: Another thing that always appear in a C program, is main(). This is called a function. Any code
inside its curly brackets {} will be executed.
Line 4: printf(() is a function used to output/print text to the screen. In our example it will output "Hello
World".
Line 5: return 0 ends the main() function. Every C statement ends with a semicolon;
Line 6: Do not forget to add the closing curly bracket } to actually end the main function.

How Code is Built


You must be thinking about why it is a 2 step process, first, we compile the code and then we run the
code. Well, the compilation is the process where the compiler checks whether the program is correct
syntax-wise, and there are no errors in the syntax, and if the code is fine converts the C language source
code into machine understandable object code.

When we run a compiled program, it is just the already compiled code that is run.

When you compile the code, a .out file is generated, which is then Run to execute the program.

Once a .out file is generated, and then you make any changes to your program in the source code file, you
will have to again compile the code, otherwise, the .out file will have the old source code and will keep
running the old program itself.

In this C tutorial, you created a Visual Studio C console project and created your first C program, Hello
World. Along the way, you learned how C code is built (preprocessor, compile, link), the basic structure
of C applications, and a little bit of C history.

Variables are containers for storing data values, like numbers and characters.

149
In C, there are different types of variables (defined with different keywords), for example:

int - stores integers (whole numbers), without decimals, such as 123 or -123
float - stores floating point numbers, with decimals, such as 19.99 or -19.99
char - stores single characters, such as 'a' or 'B'. Char values are surrounded by single quotes

Declaring (Creating) Variables

To create a variable, specify the type and assign it a value:

Syntax

type variableName = value;

Where type is one of C types (such as int), and variableName is the name of the variable (such
as x or myName). The equal sign is used to assign a value to the variable.

So, to create a variable that should store a number, look at the following example:

150
Example

Create a variable called myNum of type int and assign the value 15 to it:

int myNum = 15;

You can also declare a variable without assigning the value, and assign the value later:

// Declare a variable
int myNum;

// Assign a value to the variable


myNum = 15;

Output Variables

We can output values/print text with the printf() function:

printf("Hello World!");

In many other programming languages (like Python, Java, and C++), you would normally use a print
function to display the value of a variable. However, this is not possible in C:

Example

int myNum = 15;


printf(myNum); // Nothing happens

To output variables in C, you must get familiar with something called "format specifiers".

Format Specifiers

Format specifiers are used together with the printf() function to tell the compiler what type of data the
variable is storing. It is basically a placeholder for the variable value.

A format specifier starts with a percentage sign %, followed by a character.

For example, to output the value of an int variable, you must use the format
specifier %d or %i surrounded by double quotes, inside the printf() function:

Example

int myNum = 15;


printf("%d", myNum); // Outputs 15

151
To print other types, use %c for char and %f for float:

Example

// Create variables
int myNum = 15; // Integer (whole number)
float myFloatNum = 5.99; // Floating point number
char myLetter = 'D'; // Character

// Print variables
printf("%d\n", myNum);
printf("%f\n", myFloatNum);
printf("%c\n", myLetter);

To combine both text and a variable, separate them with a comma inside the printf() function:

int myNum = 15;


printf("My favorite number is: %d", myNum);

To print different types in a single printf() function, you can use the following:

int myNum = 15;


char myLetter = 'D';
printf("My number is %d and my letter is %c", myNum, myLetter);

User Input

You have already learned that printf() is used to output values in C.


To get user input, you can use the scanf() function:

Example

Output a number entered by the user:


// Create an integer variable that will store the number we get from the user

int myNum;

// Ask the user to type a number


printf("Type a number: \n");

// Get and save the number the user types


scanf("%d", &myNum);

// Output the number the user typed


printf("Your number is: %d", myNum);

152
The scanf() function takes two arguments: the format specifier of the variable (%d in the example above)
and the reference operator (&myNum), which stores the memory address of the variable.

Multiple Inputs

The scanf() function also allow multiple inputs (an integer and a character in the following example):

Example

// Create an int and a char variable

int myNum;
char myChar;

// Ask the user to type a number AND a character


printf("Type a number AND a character and press enter: \n");

// Get and save the number AND character the user types
scanf("%d %c", &myNum, &myChar);

// Print the number


printf("Your number is: %d\n", myNum);

// Print the character


printf("Your character is: %c\n", myChar);

C Variable Names

All C variables must be identified with unique names.


These unique names are called identifiers.
Identifiers can be short names (like x and y) or more descriptive names (age, sum, totalVolume).
Note: It is recommended to use descriptive names in order to create understandable and
maintainable code:

Example

// Good
int minutesPerHour = 60;

// OK, but not so easy to understand what m actually is


int m = 60;

The general naming rules for variables are:


 Names can contain letters, digits and underscores
 Names must begin with a letter or an underscore (_)
153
 Names are case sensitive (myVar and myvar are different variables)
 Names cannot contain whitespaces or special characters like !, #, %, etc.
 Reserved words (such as int) cannot be used as names

Data Types

A variable in C must be a specified data type, and you must use a format specifier inside
the printf() function to display it:

Example

// Create variables
int myNum = 5; // Integer (whole number)
float myFloatNum = 5.99; // Floating point number
char myLetter = 'D'; // Character

// Print variables
printf("%d\n", myNum);
printf("%f\n", myFloatNum);
printf("%c\n", myLetter);

Basic Data Types

The data type specifies the size and type of information the variable will store.
In this tutorial, we will focus on the most basic ones:

Data Type Size Description


short, int 2 , 4 bytes Stores whole numbers, without decimals
float 4 bytes Stores fractional numbers, containing one or more decimals. Sufficient for
storing 6-7 decimal digits
double 8 bytes Stores fractional numbers, containing one or more decimals. Sufficient for
storing 15 decimal digits
char 1 byte Stores a single character/letter/number, or ASCII values

Basic Format Specifiers

There are different format specifiers for each data type. Here are some of them:

Format Specifier Data Type


%d or %i int
%f float
%lf double
%c char
%s Used for strings (text), which you will learn more about in a later chapter

154
Set Decimal Precision

You have probably already noticed that if you print a floating point number, the output will show many
digits after the decimal point:

Example

float myFloatNum = 3.5;


double myDoubleNum = 19.99;

printf("%f\n", myFloatNum); // Outputs 3.500000


printf("%lf", myDoubleNum); // Outputs 19.990000

Lab Tasks:

Lab Task 1: Develop a program that takes two numbers and display their multiplication and sum.

Lab Task 2: Develop a program that takes the length, width and height of a room and calculate its
volume and total surface area and display the results.

155
Lab Task 3: Write a conclusion about what you have learned during this lab.

156
EXPERIMENT 10

Decision Structures (if, if-else, Nested if, Nested if-else, switch statement)

Objectives

The purpose of the lab is to get familiar with decision making conditions through the skill of
logic development using visual studio C++ programming.

Equipment /tool Used


 Computer with any version of windows installed
 Visual studio 2010/2015 Professional

Background
There come situations in real life when we need to make some decisions and based on these
decisions, we decide what should we do next. Similar situations arise in programming also where
we need to make some decisions and based on these decisions we will execute the next block of
code.
Decision making statements in programming languages decides the direction of flow of program
execution. Decision making statements available in C++ are:
 if statement
 if-else statements
 nested if statements
 if-else-if ladder
 switch statements

 if statement
if statement is the simplest decision-making statement. It is used to decide whether a certain
statement or block of statements will be executed or not i.e. if a certain condition is true then a
block of statement is executed otherwise not.

Syntax:
if(condition)
{
// Statements to execute if
// condition is true
}

157
if(condition)
statement1;
statement2;

// Here if the condition is true, if block


// will consider only statement1 to be inside
// its block.

Example:

/ C++ program to illustrate If


statement #include<iostream>
using namespace std;

int main()
{
int i = 10;

if (i > 15)
{
cout<<"10 is less than 15";
}

cout<<"I am Not in if";


}
Output:

I am Not in if

As the condition present in the if statement is false. So, the block below the if statement is not
executed.
 if- else
The if statement alone tells us that if a condition is true it will execute a block of statements and
if the condition is false it won’t. But what if we want to do something else if the condition is
false. Here comes the else statement. We can use the else statement with if statement to execute a
block of code when the condition is false.

158
Syntax:

if (condition)
{
// Executes this block if
// condition is true
}
else
{
// Executes this block if
// condition is false
}

Example:

// C++ program to illustrate if-else statement


#include<iostream>
using namespace std;

int main()
{
int i = 20;

if (i < 15)
cout<<"i is smaller than 15";
else
cout<<"i is greater than 15";

return 0;
}
Run on IDE
Output:

i is greater than 15

The block of code following the else statement is executed as the condition present in
the if statement is false

159
 nested-if
A nested if is an if statement that is the target of another if statement. Nested if statements mean
an if statement inside another if statement. Yes, C++ allows us to nest if statements within if
statements. i.e., we can place an if statement inside another if statement.
Syntax:
if (condition1)
{
// Executes when condition1 is true
if (condition2)
{
// Executes when condition2 is true
}
}

Example:
// C++ program to illustrate nested-if statement
int main()
{
int i = 10;

if (i == 10)
{
// First if statement
if (i < 15)
cout<<"i is smaller than 15";

// Nested - if statement
// Will only be executed if statement above
// it is true
if (i < 12)
cout<<"i is smaller than 12 too";
else
cout<<"i is greater than 15";
}

return 0;
}
Output:

i is smaller than 15

160
i is smaller than 12 too

 if-else-if ladder

Here, a user can decide among multiple options. The if statements are executed from the top
down. As soon as one of the conditions controlling the if is true, the statement associated with
that if is executed, and the rest of the ladder is bypassed. If none of the conditions is true, then
the final else statement will be executed.

Syntax:
if (condition)
statement;
else if (condition)
statement;
.
.
else
statement;

Example:
// C++ program to illustrate if-else-if ladder
#include<iostream>
using namespace std;

int main()
{
int i = 20;

if (i == 10)
cout<<"i is 10";
else if (i == 15)
cout<<"i is 15";
else if (i == 20)
cout<<"i is 20";
else
cout<<"i is not present";
}
Output:

i is 20

161
 Switch Statement in C/C++
Switch case statements are a substitute for long if statements that compare a variable to several
integral values. The switch statement is a multiway branch statement. It provides an easy way to
dispatch execution to different parts of code based on the value of the expression. Switch is a
control statement that allows a value to change control of execution.
Syntax:

switch (n)
{
case 1: // code to be executed if n = 1;
break;
case 2: // code to be executed if n = 2;
break;
default: // code to be executed if n doesn't match any cases
}

Important Points about Switch Case Statements:


 The expression provided in the switch should result in a constant value otherwise it
would not be valid.
Valid expressions for switch:
// Constant expressions allowed
switch(1+2+23)
switch(1*2+3%4)

Invalid switch expressions for switch:


// Variable expression not allowed
switch(ab+cd)
switch(a+b+c)

 Duplicate case values are not allowed.


 The default statement is optional. Even if the switch case statement does not have a
default statement, it would run without any problem.
 The break statement is used inside the switch to terminate a statement sequence. When a
break statement is reached, the switch terminates, and the flow of control jumps to the next
line following the switch statement.
 The break statement is optional. If omitted, execution will continue into the next case.
The flow of control will fall through to subsequent cases until a break is reached.

162
 Nesting of switch statements are allowed, which means you can have switch statements
inside another switch. However nested switch statements should be avoided as it makes
program more complex and less readable.

Example:
// Following is a simple program to demonstrate
// syntax of switch.
#include <stdio.h>
int main()
{
int x = 2;
switch (x)
{
case 1: printf("Choice is 1");
break;
case 2: printf("Choice is 2");
break;
case 3: printf("Choice is 3");
break;
default: printf("Choice other than 1, 2 and 3");
break;
}
return 0;
}
Output:

Choice is 2

Task

a) Write a program that displays the grade of a student where the marks are input from
the keyboard. The grading pattern is as following:

Grade Marks Range

A 85-100

A- 80-84

B+ 75-79

B 71-74

B- 68-70

163
C+ 64-67

C 60-63

C- 57-59

D+ 53-56

D 50-52

F Below 50

W Withdraw

A session of the program execution should print following:


Enter student marks: 76
The grade for 76 marks is B+. Language Allowed: C++
Solution

164
b) Write a program for a simple calculator. The program should take two float values and
the operation to be performed (char) from the user. The calculator should perform
addition, subtraction, multiplication, and division. Example execution
Enter first number: 4
Enter Second number: 10
Enter operation to be performed (Select from +, -,*, /): +
Result: 14.
Solution

165
166
c) Write a program for an insurance company that allows only people from a certain age
group to be eligible for a specific insurance scheme. If the age is greater than 45 or less
than 25 it says you are not eligible. Else it prints you are eligible. Language: C++

Solution

167
168
d) The following table shows telephone area codes in the state of Georgia along with the
largest city in each area:
Area code City
229 Albany
404 Atlanta
478 Macon
678 Atlanta
706 Columbus
770 Atlanta
912 Savannah
Write a C++ program that inputs the city area code and prints the corresponding city
name.
Solution

169
e) Write a program that determines the wages of a person based on working hours. If a
person works for less than 5 hours his wage per hour is Rs. 400. If he works for more
than 5 and less than 8 hours wage per hour increases to Rs.560. An addition of Rs. 2000
is given as overtime for workers who work up till 12 hours.

Solution

170
171
f) Use nested loop to print the truth table of three 1-bit inputs
Solution

172
173
g) Write a program that asks the user for a two-digit number (i.e. between 10-99), then
prints the English word for the number:
Enter a two-digit number: 45
You enter the number forty-
five.
Hint: Break the number into two digits. Use one switch statement to print the word for
the first digit (“twenty”, “thirty”, and so forth). Use a second switch statement to print
the word for the second digit. Don’t forget that the numbers between 11 and 19
require special treatment. This needs special attention.
Solution

174
Conclusion:

175
EXPERIMENT # 11
Iterative Structures (For, While, Do-While)

Objective:
To familiarize students with various iterative structures.

Equipment/ Tools Used:

Microsoft Visual Studio 2022

Background:

Iterative Structures:
Iterative structures or loops are used to execute multiple statements repeatedly within a program scope.
Every programming language has different set of iterative structures but the most common of them are:
for, while and do-while loops.

 While Loop:

While loop executes single or multiple statements until the underlying condition is true.

Example

int i = 0;

while (i < 5) {
printf("%d\n", i);
i++;
}

Do not forget to increase the variable used in the condition (i++), otherwise the loop will never end!

 For Loop:

For loop executes single or multiple statements for a fix number of times

176
Example

int i;

for (i = 0; i < 5; i++) {


printf("%d\n", i);
}

Statement 1 sets a variable before the loop starts (int i = 0).


Statement 2 defines the condition for the loop to run (i must be less than 5). If the condition is true, the
loop will start over again, if it is false, the loop will end.
Statement 3 increases a value (i++) each time the code block in the loop has been executed.

 Do-while Loop:

Do-while loop executes single or multiple statements at least once whether the underlying condition is
true or false.

Example

int i = 0;

do {
printf("%d\n", i);
i++;
}
while (i < 5);

Do not forget to increase the variable used in the condition, otherwise the loop will never end!

177
Lab Tasks:

Lab Task 1: Print your name for five time on console by using,

For loop
While loop

Lab Task 2: Write a C program to calculate the table of a positive number (generic) using for loop,
output should look like this for number 5.

Draw its flowchart below

178
Lab Task 3: Write a C program to calculate the power of entered number.

179
Lab Task 4: Write a C program to calculate the factorial of a number.

Lab Task 5: Write a conclusion about what you have learned during this lab.

180
EXPERIMENT 12
Single Dimension Arrays

Objective:

To familiarize students with the linear one-dimensional arrays.

Equipment/ Tools Used:

Microsoft Visual Studio 2022

Background:
Array:

An array is a linear data structure that holds a fixed number of values of a single type. The length of an
array is established when the array is created. After creation, its length is fixed.

Array indices starts from 0, so int X [4] mean: X[0], X[1], X[2], X[3]. Following code shows, how to
input data into array, and how loops help to efficiently deal with arrays. Same as printing array, loops can
also be used to input data in arrays.

Output:
int X[4] = {2,20,15,24};// array

printf("\ti\tx[i]\n");

for(int i=0; i<4; i++)


{
printf("\t%d\t%d\n",i, X[i]);
}
//code to print index and array value

181
Strings

Strings are used for storing text/characters.


For example, "Hello World" is a string of characters.
Unlike many other programming languages, C does not have a String type to easily create string
variables. Instead, you must use the char type and create an array of characters to make a string in C:

char greetings[] = "Hello World!";

Note that you have to use double quotes ("").


To output the string, you can use the printf() function together with the format specifier %s to tell C that
we are now working with strings:

Example

char greetings[] = "Hello World!";


printf("%s", greetings);

Access Strings

Since strings are actually arrays in C, you can access a string by referring to its index number inside square
brackets [].
This example prints the first character (0) in greetings:

Example

char greetings[] = "Hello World!";


printf("%c", greetings[0]);

Note that we have to use the %c format specifier to print a single character.

Modify Strings

To change the value of a specific character in a string, refer to the index number, and use single quotes:

Example

char greetings[] = "Hello World!";


greetings[0] = 'J';
printf("%s", greetings);
// Outputs Jello World! instead of Hello World!

Loop Through a String

You can also loop through the characters of a string, using a for loop:

Example
182
char carName[] = "Volvo";
int i;

for (i = 0; i < 5; ++i) {


printf("%c\n", carName[i]);
}

Take String Input

You can also get a string entered by the user:

Example

Output the name of a user:


// Create a string
char firstName[30];

// Ask the user to input some text


printf("Enter your first name: \n");

// Get and save the text


scanf("%s", firstName);

// Output the text


printf("Hello %s", firstName);

When working with strings in scanf(), you must specify the size of the string/array (we used a very high
number, 30 in our example, but atleast then we are certain it will store enough characters for the first
name), and you don't have to use the reference operator (&).
However, the scanf() function has some limitations: it considers space (whitespace, tabs, etc) as a
terminating character, which means that it can only display a single word (even if you type many words).
Example
char fullName[30];

printf("Type your full name: \n");


scanf("%s", &fullName);

printf("Hello %s", fullName);

// Type your full name: John Doe


// Hello John

From the example above, you would expect the program to print "John Doe", but it only prints "John".
That's why, when working with strings, we often use the fgets() function to read a line of text. Note that
you must include the following arguments: the name of the string variable, sizeof(string_name), and stdin:
183
Example

char fullName[30];

printf("Type your full name: \n");


fgets(fullName, sizeof(fullName), stdin);

printf("Hello %s", fullName);

// Type your full name: John Doe


// Hello John Doe

Use the scanf() function to get a single word as input, and use fgets() for multiple words.

Lab Tasks:

Lab Task 1: Write a program to copy the contents of one array into another after subtracting one from each
element value.

184
Lab Task 2: Take an array of 10 elements from user. Write a function which can sort all the elements of
the array in ascending or descending order.
Flowchart of Task 2

Lab Task 3:
Create an integer array (int data[10]) and take inputs from the user. Using pointer(or multiple pointers),
change array’s element number 5, 6 and 7 from its original value to squared value, and change array’s
element number 1, 2 and 3 from its original value to zero. Display the whole array after changing values

185
Lab Task 4: Write a conclusion about what you have learned during this lab.

186
Experiment 13

Introduction to the Robot Operating System (ROS)

Abstract:

This course lab gives an introduction to the Robot Operating System (ROS) including many of the available
tools that are commonly used in robotics. With the help of different examples, the labcourse should provide a
good starting point for students to work with robots. They learn how to create software including simulation, to
interface sensors and actuators, and to integrate control algorithms.

Objective:

 ROS architecture: Master, nodes, topics, messages, services, parameters and actions
 Console commands: Navigating and analyzing the ROS system and the catkin workspace
 Creating ROS packages: Structure, launch-files, and best practices
 ROS C++ client library (roscpp): Creating your own ROS C++ programs
 Simulating with ROS: Gazebo simulator, robot models (URDF) and simulation environments (SDF)
 Working with visualizations (RViz) and user interface tools (rqt)
 Inside ROS: TF transformation system, time, bags
 Introduction to ROS2

Content: This course consists of a guided tutorial and exercises with increasing level of difficulty when
working with an autonomous robot. You learn how to setup such a system from scratch using ROS, how to
interface the individual sensors and actuators, and finally how to implement first closed loop control systems.

What is ROS anyway?


ROS stands for Robot Operating System. Even if the name says so, ROS is not a real operating system
since it goes on top of Linux Ubuntu (also on top of Mac, and recently, on top of Windows). ROS is a
framework on top of the O.S. that allows it to abstract the hardware from the software. This means, you
can think in terms of software for
all the hardware of the robot. And that is good news for you because this implies that you can actually
create programs for robots without having to deal with the hardware. Yea!
ROS works on Linux Ubuntu or Linux Debian. Experimental support already exists for OSX., Gentoo,
and a version for Windows is under way, but we really don’t recommend for you to use them yet unless you are
an expert. Check this page for more information about how to use ROS on those systems.

ROS for service robots

ROS is becoming the standard in robotics programming, at least in the service robots sector. Initially,
ROS started at universities, but quickly spread into the business world. Every day, more and more
companies and startups are basing their businesses on ROS. Before ROS, every robot had to be
programmed using the manufacturer’s own API. This means that if you changed robots, you had to start
the entire software again, apart from having to learn the new API. Furthermore, you had to know a lot
about how to interact with the electronics of the robot in order to understand how your program was
doing. The situation was similar to that of computers in the 80s, when every computer had its own
187
operating system and you had to create the same program for every type of computer. ROS is for robots
like Windows is for PCs, or Android for phones. By having a ROSified robot, that is, a robot that runs
on ROS, you can create programs that can be shared among different robots. You can build a navigation
program, that is a program to make a robot move around without colliding, for a four-wheeled robot
built by company A and then use the same exact code to move a two-wheeled robot built by company
B… or even use it on a drone from company C, with minor modifications.

Use Cases:
ROS for industrial robots

ROS is being used in many of the service robots that are created at present. On the other side, industrial
robotics companies are still not completely convinced about using it, mainly because they will lose the
power of having a proprietary system. However, four years ago, an international group called ROS-
Industrial (https://rosindustrial.org/) was created, whose aim is to make industrial manufacturers of
robots understand that ROS is for them, since they will be able to use all the software off-the-shelf that
other people have created for other ROS robots.

ROS for agricultural robots

In the same vein as ROS-Industrial, ROS-Agriculture (http://rosagriculture.org/) is another


international group that aims to introduce ROS for agriculture robots. I highly recommend that you
follow this group if you are interested because they are a very motivated team that can do crazy things
with several tons of machine, by using ROS. Check out, for instance, this video
(https://youtu.be/obu_Ru2gDHk) about an autonomous tractor running ROS, built by Kyler Laird of the
ROS Agriculture group.

How to start learning ROS

https://www.theconstructsim.com/ros-for-beginners-how-to-learn-ros/

188
Lab Task:

189
190
Conclusion:

___________________________________________________________________________________________________________
___________________________________________________________________________________________________________
___________________________________________________________________________________________________________
___________________________________________________________________________________________________________
___________________________________________________________________________________________________________
___________________________________________________________________________________________________________
___________________________________________________________________________________________________________
___________________________________________________________________________________________________________
191
___________________________________________________________________________________________________________
__________________________________________________________

192
EXPERIMENT 14

Open Ended Lab


Lab task
Conclusion

224

You might also like