0% found this document useful (0 votes)
31 views37 pages

Salihas Practical

Uploaded by

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

Salihas Practical

Uploaded by

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

Practical Notebook CS-401 2019-20

Contents
Practical No 01.............................................................................................................1
Title: Exploring the Taskbar............................................................................................1
Procedure:.......................................................................................................................1
Inserting Pictures:........................................................................................................1
Clip art:.........................................................................................................................2
Shapes:.........................................................................................................................2
Procedure:...................................................................................................................2
4. Smart Art:.................................................................................................................3
5. Charts:......................................................................................................................3
6. Screenshot:..............................................................................................................4
Practical no : 2..............................................................................................................5
Title: Functionality of Table of Content, Page Break and Section Break.........................5
 Table of Contents:.............................................................................................5
Steps:...........................................................................................................................5
 Table of Figure and Caption:.............................................................................6
Step:.............................................................................................................................6
 Page Break:........................................................................................................6
Steps:...........................................................................................................................6
 Section Break:....................................................................................................7
Practical no 03..............................................................................................................8
Title: Making the mark sheet of computer programming and its application in
engineering......................................................................................................................8
Formula for Grading........................................................................................................1
Formula for VLOOKUP.....................................................................................................1
Practical no 04:.............................................................................................................2
Title: Calculate the missing Attributes of underneath table...........................................2
Draw a Chart between March and April for 2000-2010..................................................2
Make a comparison between total and first three months rainfall................................2

i
Practical Notebook CS-401 2019-20

Check the trend between Total years rainfall and monthly rainfall on the basis of year
and avg rainfall................................................................................................................2
 Chart no.1..............................................................................................................3
 Chart no.2..............................................................................................................3
 Chart no.3..............................................................................................................4
Practical no. 05.............................................................................................................5
Title: Programs using input output functions in c++.......................................................5
 Write a program that takes radius from user and gives out the area and
circumference..............................................................................................................5
 Write a program that takes height in inches from user and gives output in cm..6
 Take temperature in Celsius from user and print in Fahrenheit..........................7
 Taking base and height of triangle from user and printing area..........................8
 Write a program that will prompt the user to enter number of hours and
display number of weeks, days, hours within the input number of hours.................9
Practicaal no. 06.........................................................................................................12
Title: Programs using loops and switches......................................................................12
 Write the program that input test scores of a student and display his grade.. .12
 Write a program that inputs a letter from the user and shows weather it is a
vowel or a consonant................................................................................................14
...................................................................................................................................14
...................................................................................................................................14
Practical no. 07...........................................................................................................16
Title: Write programs using different arithmetic operations and loops.......................16
 Write a program that inputs a number for the user and displays its table using
for loop......................................................................................................................16
 Write a program that displays a product of odd numbers from 1 to 10............17
 Write a program that displays first five numbers and their squares using do
while loop..................................................................................................................18
...................................................................................................................................18
...................................................................................................................................19
Practical no. 08...........................................................................................................20

ii
Practical Notebook CS-401 2019-20

Title: Program using arrays............................................................................................20


 Write a program that input ten numbers from the user in an array and displays
the maximum number...............................................................................................20
Syntax for Problem:...................................................................................................20
Flow Chart for Program:............................................................................................21
Practical No.:9............................................................................................................23
Title: Write a program that inputs a number and display its processor and successor
number using function..................................................................................................23
Syntax for Problem:...................................................................................................23

Figures

iii
Practical Notebook CS-401 2019-20

Figure 1: Insert Pictures.......................................................................................................1


Figure 2: ClipArt...................................................................................................................2
Figure 3: Shapes..................................................................................................................2
Figure 4: Smart Art..............................................................................................................3
Figure 5: Insert Charts.........................................................................................................3
Figure 6: Insert Screen shots................................................................................................4
Figure 7: Inserting Table of content...................................................................................5
Figure 8: Inserting table of figure........................................................................................6
Figure 9: Using command of Page Break............................................................................7
Figure 10: Applying section breaks......................................................................................7
Figure 11 Total and average Rianfall..................................................................................3
Figure 12 Rainfall of March and April.................................................................................3
Figure 13 Total and First three months of Rainfall..............................................................4
Figure 14 Program in C++....................................................................................................5
Figure 15 Flow Chart for program.......................................................................................6
Figure 16 Program in C++....................................................................................................7
Figure 17 Flowchart Representation...................................................................................7
Figure 18: Program in C++...................................................................................................8
Figure 19: Flowchart Representation..................................................................................8
Figure 20: Program in C++...................................................................................................9
Figure 21: Flow chart Representation.................................................................................9
Figure 22: Program in C++.................................................................................................10
Figure 23: Flow chart Representation...............................................................................11
Figure 24: Program in C++.................................................................................................13
Figure 25:Flow chart Representation................................................................................13
Figure 26: Program in C++.................................................................................................14
Figure 27: Flow chart Representation...............................................................................15
Figure 28: Program in C++.................................................................................................16
Figure 29:Flow Chart for Problem 1..................................................................................17
Figure 30: Program in C++.................................................................................................18
Figure 31: Program in C++.................................................................................................18
Figure 32:Dev C++ Program for Problem 2........................................................................18
Figure 33 Flow chart representation.................................................................................19
Figure 34:Dev C++ Program for Problem 2........................................................................19
Figure 35: Dev C++ program for given Problem................................................................21
Figure 36: Flow Chart for Program....................................................................................22
Figure 37: Dev C++ program .............................................................................................24
iv
Practical Notebook CS-401 2019-20

v
Practical Notebook CS-401 2019-20

Practical No 01
Title: Exploring the Taskbar.
Procedure:
We can explore the insert tab by simply using
the tools like inserting pictures, clip arts, drawing different types of shapes and charts
and also we can organize the steps of some process and differentiating things and for
telling the relationship between two things by using SmartArt tool.

We can understand the following tools and there usage the simply explain them and
posting some example.

Inserting Pictures:

Figure 1: Insert Pictures

Click on the icon and dialogue box will appear and then select a required picture.

The PICTURE icon is used to insert pictures from your documents.

We can insert downloaded pictures and can format them with different properties.

Right click the mouse button and you will get following options like formatting the
picture, giving it some title or caption, set the size and position of the picture.

You can manage the text with the picture like writing behind, in front of at the back etc
of the picture.

1
Practical Notebook CS-401 2019-20

Clip art:

Figure 2: ClipArt

 Clip art is used to add online pictures by browsing within the word.
 Click on the icon and then type or search the required theme you want to add.
 You can select or search specified thing like only searching photos or some audio
or videos and you can search all of them in one search.
 If we are adding a picture we can adjust them with same properties like inserting
a picture like setting position, wrapping text and so on.

Shapes:

Procedure:
 Click on the icon and then choose the shape you want.
 Now we can change and format that shape according to our taste and
document.

Figure 3: Shapes

2
Practical Notebook CS-401 2019-20

 Lines: it consist of parallel, zigzag, straight, circular and many lines for different
purposes.
 Basic shapes: it consist of different shapes like pentagon, diamond shapes and
different brackets for different purposes.
 Rectangles: it consist of rectangles having straight and curved corners.
 Block arrows: it consist of solid arrow heads of different designs and shapes for
different purposes.
 And many other shapes like flow chat, equation shapes etc.

4. Smart Art:

1. It is the easiest way for showing relationship and differentiating things.

Figure 4: Smart Art

2. Just click on the icon of SmartArt and the dialogue box will appear.
3. In that dialogue box many shapes are present in which we can show two
different things or topics and the steps of the procedure and also a cycle.

5. Charts:

Figure 5: Insert Charts

3
Practical Notebook CS-401 2019-20

Charts are used to draw a graphs of two determined quantities showed in a table.

 Click on the icon and the dialogue box will appear showing different shapes of
charts like of line, columns, pie charts, bar, area, bubble and many others.
 We can format these shapes by giving them a title and showing their axis and
naming them.
 Charts are very easy to draw. Just give the range and limit in dialogue box of
ENTER DATA.
 If two or more quantities are to be drawn then it’s necessary to give legends.
 Bullets also give necessary information.

6. Screenshot:

Figure 6: Insert Screen shots

 This icon is used to insert already took screenshot to your page.


 Take a screenshot by using a shortcut key ALT key then press PRINTSCRN or
PRTSC key.
 Now the screenshot is copied in your clipboard.
 Now click the icon and choose the screenshot from the dialogue box appeared
and then click insert.
 Screenshot can be cropped and formatted by changing its position and size etc.

4
Practical Notebook CS-401 2019-20

Practical no : 2
Title: Functionality of Table of Content, Page Break and Section Break
The reference ribbon gives users the ability to create a Table of Content and/ or
footnotes and a bibliography for a research paper.

 Table of Contents:
Users can automatically generate a table of content for their
document provided they created headings and subheadings.

Steps:
1) Apply page break on the 1stpage on the back of heading 1.
2) Now on the new page click anywhere on the page.
3) Now go to the references tab and select the option table of content.
4) Select the type of table of content you want to add.
5) The table will be drawn on that page according to the headings.

Figure 7: Inserting Table of content.

5
Practical Notebook CS-401 2019-20

 Table of Figure and Caption:


User can apply this to add table of figure and table of
content. It shows the number of figures and table in our document and the page where
they are located.

Step:
1) Go to the reference tab.
2) Select Table of Figure from the caption bar.
3) A new dialogue box will open.
4) Select which table of content you want to enter.
5) Now if you do any changing in the figure caption.
6) Go to the reference tab again and update the table to apply the setting there.

Figure 8: Inserting table of figure.

 Page Break:
In page break we can end the page anywhere without keeping in
view there is a space for writing or not. If we want to end the current page and want to
move on next page or to leave the page empty we can simply use the page break
command.

Steps:
1) Move the blinking cursor from where you want to end the page.

6
Practical Notebook CS-401 2019-20

2) Go to Insert tool and click on it.


3) In Pages there is a command of Page Break.
4) Simply click on it and your page will be ended and new page will be started.

Figure 9: Using command of Page Break.

 Section Break:
This command allow us to create sections in already created pages.
Section break also allow us to recreate or redesign the page in the already created series
of pages. We can change the header and footer titles. We can also restart the page
numbering.

Figure 10: Applying section breaks

7
Practical Notebook CS-401 2019-20

Practical no 03
Title: Making the mark sheet of computer programming and its application in engineering

PMAS-ARID AGRICULTURE UNIVERSITY RAWALPINDI


Degree Bsc Agriculture Engineering Theory 20
Department F.A.E.T Semester: Final Section No A Practical 20
Course Titlle Engineering Drawing and Graphics MID assign
Course
SEE-301
Number Semester: Summer 6 2
Credit Hours 2(1-1) Year 2012-13
Theory Practical
Fina
l Total
Student Regd Students Assignment Grad Marks in
Mid 30% 60% Out of out
No. Name 10% out of e Words
out of (6) out (20) of(40)
(2)
of
(12)
18-ARID-3272 Asim 6 2 11 0 0 F zero
17-ARID-3272 Bilal 3 1.5 7.5 14 26 B twenty six
16-ARID-3272 Danish 5 1.5 3 18 27.5 B twenty seven
twenty
15-ARID-3272 Faisal 1 1 8.5 15 25.5 C five
14-ARID-3272 Ghayyor 2 2 6 10 20 C twenty

8
Practical Notebook CS-401 2019-20

Formula for Grading:-

Grade=IF(OR(SUM(D12:E12)<(0.4*0.2*$L$5),F12<(0.6*$L$5*0.2),G1
2<0.4*$L$6,SUM(D12:F12)<(0.4*$L$5),H12<(0.4*($L$5+
$L$6))),"F",IF(H12>=32,"A",IF(H12>=26,"B",IF(H12>=20,"C",IF(H12>=16,"D"))))).

Formula for VLOOKUP:-

VLOOKUP =VLOOKUP (H12, Sheet2! A1:B40, 2, TRUE)

1
Practical Notebook CS-401 2019-20

Practical no 04:
Title: Calculate the missing Attributes of underneath table
Draw a Chart between March and April for 2000-2010
Make a comparison between total and first three months rainfall
Check the trend between Total years rainfall and monthly rainfall on the basis of year and avg rainfall

Year 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997
Jan 29 60 41.4 9.17 119.1 28.3 34.44 24.4 70.12 29.6
Feb 24.5 15.6 104.9 110.9 83.6 46.9 46.85 60.16 108.3 17
March 158.8 75.4 170.3 91.3 108.7 144.7 24.8 72.8 98.2 93.52
April 24.2 6.1 49.8 131.1 47.13 27.84 69.95 76.14 58.5 162.2
May 16 6.6 7.7 32.3 52.5 23.6 44.03 24.5 70.34 42.8
June 66.4 56 143.7 67 23.55 0 69.1 4.97 103.3 91.2
July 718 396.8 347.6 317.4 155.6 262.54 535.06 608.9 160.62 231.1
Aug 279 161.3 548.8 186.71 182.42 198.4 578.5 214 338.21 503.75
Sep 147.5 24.6 170 208 358.4 228.8 76.6 33.55 139.4 184.4
Oct 27.5 20.59 3.3 0 12.78 0 44.52 66.72 39.46 46.27
Nov 0 2.8 1.3 1.23 28.06 8.5 2.2 21.5 2.6 27.05
Dec 5.9 49.9 171.04 25.6 6.62 0 101.56 29.7 6.4 23.56
(TOTAL mm) 1180.7
monthly 1496.8 875.69 1759.84 1 1178.46 969.58 1627.61 1237.34 1195.45 1452.45
98.392 80.7983
Avg(mm) 124.7333 72.97417 146.6533 98.205 135.6342 103.1117 99.62083 121.0375
5 3

2
Practical Notebook CS-401 2019-20

 Chart no.1

Figure 11 Total and average Rianfall

 Chart no.2

Figure 12 Rainfall of March and April

3
Practical Notebook CS-401 2019-20

 Chart no.3

Figure 13 Total and First three months of Rainfall

4
Practical Notebook CS-401 2019-20

Practical no. 05
Title: Programs using input output functions in c++.

 Write a program that takes radius from user and gives out the area and
circumference.

#include <iostream>

# define PI 3.141

using namespace std;

int main ( )

{ float radius, area, circumference;

cout<<"enter radius of the circle:"<<endl;

cin>>radius;

area=PI*(radius*radius);

circumference=2*PI*radius;

cout<<"the area of the circle is:"<<area<<endl;

cout<<"the circumference of circle is:"<<circumference;

return 0; }

Figure 14 Program in C++

5
Practical Notebook CS-401 2019-20

Start

Enter radius

Area=3.14*radius*radius

Circum=2*3.14*radius

Print
radius,cicum

End

Figure 15 Flow Chart for program

 Write a program that takes height in inches from user and gives output
in cm.
#include<iostream>

using namespace std;

main()

{float inch, cm;

cout<<"enter height in inches:";

cin>>inch;

cm=2.54*inch;

cout<<"height in cm is:"<<cm;}

6
Practical Notebook CS-401 2019-20

Figure 16 Program in C++

Start

Enter height in
inches

cm=2.54*inch

Print height in cm

End

Figure 17 Flowchart Representation

 Take temperature in Celsius from user and print in Fahrenheit.


#include <iostream>

using namespace std;

main()

float celsius, fahrenheit;

cout<<"enter temperature in celsius:";

cin>>celsius;

fahrenheit=(9/5)*celsius+32;

7
Practical Notebook CS-401 2019-20

cout<<"the tmperature in fahrenheit is :"<<fahrenheit; }

Figure 18: Program in C++

start

Enter
temperature in
celsius

Fahrenheit=(9/5)*Celsius+32

Print
temperature in
fahrenheit

end

Figure 19: Flowchart Representation

 Taking base and height of triangle from user and printing area.
#include <iostream>

using namespace std;

main()

float base,height,area;

8
Practical Notebook CS-401 2019-20

cout<<"enter base of the triangle:";

cin>>base;

cout<<"enter height of the triangle:";

cin>>height;

area=(height*base)/2;

cout<<"the area of triangle is :"<<area; }

Figure 20: Program in C++

Start

Enter base,
height

Area=05*base*height

Print area

End

Figure 21: Flow chart Representation

 Write a program that will prompt the user to enter number of hours
and display number of weeks, days, hours within the input number of
hours.

9
Practical Notebook CS-401 2019-20

#include<iostream>

using namespace std;

int main()

float ho,m,hr,d;

float w;

cout<<"Enter no. of hours : ";

cin>>ho;

w=ho/168;

d=ho/24;

hr=ho/24;

cout<<"week:"<<w<<"\nDay: "<<d<<"\nhours: "<<hr;

return 0;

system("pause");

Figure 22: Program in C++

10
Practical Notebook CS-401 2019-20

Start

Enter number of
hours

w=ho/168

d=ho/24

hr=ho/24

Print
w(weeks),d(day),
hr(hours)

End

Figure 23: Flow chart Representation

11
Practical Notebook CS-401 2019-20

Practicaal no. 06
Title: Programs using loops and switches.

 Write the program that input test scores of a student and display his
grade.
#include <iostream>

using namespace std;

int main()

int a;

cout<<"enter number:";

cin>> a;

if (a>=100){

cout<<"Your grade is A"<<endl;}

else if (a>=90){

cout<<"Your grade is B"<<endl;}

else if (a>=80){

cout<<"Your grade is B-"<<endl;}

else if (a>=70){

cout<<"Your grade is C "<<endl;}

lse if (a>=60){

cout<<"Your grade is D-"<<endl;}

else cout<<”Your grade is F”; }

12
Practical Notebook CS-401 2019-20

Figure 24: Program in C++

yes
Score>=100 Print A

Score>=90
yes
Print B

yes
Score >=80

Print B-
yes
Score>=70
Print C

Score >=60

no

Print F

End

Figure 25:Flow chart Representation

13
Practical Notebook CS-401 2019-20

 Write a program that inputs a letter from the user and shows weather it
is a vowel or a consonant.
#include <iostream>

using namespace std;

main()

char c;

cout<<"enter any latter: ";

cin>> c;

switch(c)

case 'a': cout<<"vowel"; break;

case 'e': cout<<"vowel"; break

case 'i': cout<<"vowel"; break;

case 'o': cout<<"vowel"; break;

case 'u': cout<<"vowel"; break;

default: cout<<"error"; }}\

Figure 26: Program in C++

start

Enter any letter

14
Practical Notebook CS-401 2019-20

yes

Is c=a vowel

yes

Is c=e
vowel

yes

Is c=i
vowel

yes

Is c=o vowel

yes

Is c=u vowel

no

consonent

End
Figure 27: Flow chart Representation

15
Practical Notebook CS-401 2019-20

Practical no. 07
Title: Write programs using different arithmetic operations and loops.

 Write a program that inputs a number for the user and displays its table
using for loop.
#include <iostream>

using namespace std;

main()

int len,tab,a;

cout<<"enter no.of table: ";

cin>> tab;

cout<<"enter length of table: ";

cin>> len;

for (a=1;a<=10;a++)

cout<<tab<<"*"<<a<<"="<<tab*a<<endl; }

Figure 28: Program in C++

16
Practical Notebook CS-401 2019-20

A=1
number A
Input
A<=10

Start
End

C=A*B
Print
A*B=C

Figure 29:Flow Chart for Problem 1

 Write a program that displays a product of odd numbers from 1 to 10.


#include <iostream>

using namespace std;

main()

int c,a;

for(c=1;c<=10;c=c+2){

cout<<c<<endl;

a*=c;}

cout<<"product is: "<<a<<endl;

17
Practical Notebook CS-401 2019-20

Figure 30: Program in C++

 Write a program that displays first five numbers and their squares
using do while loop.
#include <iostream>

using namespace std;

int main()

{ int a;

int j=1;

int c;

do

{ c=j*j;

cout<<"Value of variable j is:"<<j <<"the square is ="<<c<<endl;

j++;

}while (j<=5);

return 0; }

Figure 31: Program in C++

18
Practical Notebook CS-401 2019-20
Print J

Start

Input A
N=0

Yes
A=A+1
N<5 Print B=A 2
Print B
A N=N+1

No

End

Figure 33:Dev C++ Program for Problem 2.


Figure 34 Flow chart Representation

19
Practical Notebook CS-401 2019-20

Practical no. 08
Title: Program using arrays.

 Write a program that input ten numbers from the user in an array and
displays the maximum number.
Syntax for Problem:

#include<iostream>

using namespace std;

main()

int array[10],a,b;

for(a=0;a<10;a++)

cout<<"Kindly fill the array ";

cin>>array[a];

b=array[0];

for (a=0;a<10;a++)

if (b<array[a])

b=array[a];

cout<<"maximum number is "<<b<<endl;

20
Practical Notebook CS-401 2019-20

Figure 35: Dev C++ program for given Problem

Flow Chart for Program:

Start

Array [10], a,b

A=0,A<10,
A++

Input Array

b=Array[0] A=0,A<10,
A++

21
Practical Notebook CS-401 2019-20

b=Array[a]

b<Array[a]

Print b

End

Figure 36: Flow Chart for Program

22
Practical Notebook CS-401 2019-20

Practical No.:9
Title: Write a program that inputs a number and display its processor
and successor number using function.

Syntax for Problem:


#include<iostream>

using namespace std;

void value(int);

main()

int x;

cout<<"Enter an integer: ";

cin>>x;

value(x);

void value(int x)

int p,n;

p=x-1;

n=x+1;

cout<<"The number before "<<x<<" is "<<p<<endl;

cout<<"The number after "<<x<<" is "<<n<<endl;

23
Practical Notebook CS-401 2019-20

Figure 37: Dev C++ program .

24

You might also like