Fundamentals of computer applications and information technology PTU

54
1 Usman Ghani Chapter 1 Familiarization of computer system Computer:- A Computer is an electronis device that can perform a variety of operations in accordance with the set of instructions called program. Functioning of computer :- The computer consists of mainly three parts namely Input system, Central Processing Unit & Output Unit. As shown in figure1 Figure 1 Input Unit :- The input unit is formed by the input devices attached to the computer. Examples of Input media are: keyboard, mouse, magnetic ink character reader, optical mark reader, optical character reader, joystick etc. An input unit takes the input and converts it into binary form so that it can be understood by the computer.

description

FCPIT File for PTU first year B.Tech.

Transcript of Fundamentals of computer applications and information technology PTU

Page 1: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Chapter 1

Familiarization of computer system

Computer:- A Computer is an electronis device that can perform a variety of operations in accordance with the set of instructions called program.

Functioning of computer:- The computer consists of mainly three parts namely Input system, Central Processing Unit & Output Unit. As shown in figure1

Figure 1

Input Unit:- The input unit is formed by the input devices attached to the computer. Examples of Input media are: keyboard, mouse, magnetic ink character reader, optical mark reader, optical character reader, joystick etc.

An input unit takes the input and converts it into binary form so that it can be understood by the computer.

Central Processing Unit(CPU):- The CPU is the control centre for the compuetr. It guides and governs the performance. It Consists of Arithmatic Logic Unit (ALU) & Control Unit (CU).

Output Unit:- The output unit is formed by the output units connected to the computer. It converts the computer understandable language into the human understandable language.

How To Powere On a PC:-

1. Switch on the main supply.

Page 2: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

2. Switch on the UPS3. Press the power button of CPU.4. On the Monitor.5. Enter the password6. Now your computer is ready to Use.

How To Powere Off a PC:-

1. Click the start Button as shown in figure 22. Then Clich the shut down button as shown in figure 33. Then your compuetr is turned off.

Figure 2

Page 3: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Figure 3

Page 4: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Chapter 2

Loading window,closing , maximising

Closing window:-To close the window which in front of you have to move the mouse to the cross button(Figure 4) then click it, window will closed.

Figure 4

Maximising:-To maximise the icon you have to click the maximise button shown in Figure 4 at no. 2. The window will fit to screen.

Icon Shifting:-The icons can be shifted from one place to another by dragging and dropping them to other place.

Ordering:-Ordering of icons can be done by following method:-

1. Right click on the desktop at blank space the screen comes as show in Figure 5

2. Select the view.

3. Selct auto arrange from the sub menu.

The icons have been arranged.

Page 5: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Figure 5

Chapter 3

Saving file protecting unprotectingSaving Files:-When we made a file we must have to save it . Because if we do not save it it will be erased from the RAM .When we save the file it goes to the main memory of the computer. For example if we want to save the document in the word then we first select file and then save option, then select the location in the drive and click the save button.(Figure 6).

Protecting document:- To protect we have to follow the following steps (Figure 6):-

1. Select the file button

2. Select the save as option

3. Select the tools

4. Select the general options

5. Then write the password

Your document as been password protected.

Figure 6

Page 6: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Unprotecting document:-To unprotect the document open the security options and remove the password as shown in Figure 6.

Chapter 4

Formatting floppies and practice on virus recognition and protectionFormatting floppy drive:-To format the floppy drive follow the following steps:-

1. Insert floppy into drive

2. Open the my computer

3. Right click on the floppy icon

4. Select the format option

5. Now select the type of format which you want

6. Click O.K.

Page 7: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Chapter 5

Practice with control panel

Control Panel:- It is the functioning part of computer which operates the settings of computer, in it we can set all the computer peripherals according to our need. To open the control panel follow simple steps:-

1. Click the START button

2. Click on the control panel.

3. Now u can manage the things shown in the control panel window(Figure 7).

Figure 7

Page 8: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Chapter 6MS WORD

Word Processors are the class of software application that is designed for generating various

documents like letter, faxes, resume, memorandum and notices etc. Word Processing software provides

a set of tools and utilities for entering, editing and formatting text. In addition to typical word processing

tasks, modern word processors like MS Word, offer many interesting features like drawing various

objects, creating tables, inserting pictures and many more.

Features of MS word

MS word having following features: -

1. Microsoft Word offers easy editing of text.

2. Microsoft Word includes mail merge to create letters and labels.

3. Microsoft Word has a powerful spell checking facility.

4. Microsoft Word supports a wide number of paper sizes.

5. Microsoft Word has support for wizards and templates for automating tasks.

6. Microsoft Word has port for graphics and drawing objects.

Starting Word

To start word click once on the Start button, Choose Programs and click once on Microsoft

Office and then once on Microsoft Word.

Start Programs Microsoft Office Microsoft Word

Page 9: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Parts of MS-Word Window

TITLE BAR : It is the horizontal bar at the top of the window. It contains the name of the

current document. Until you save the document, WORD automatically assigns a name. The title

bar contains three buttons at its right end. These are the buttons to minimize, restore and close

the current window.

MENU BAR : It is a horizontal bar, below the title bar that contains several menus. Each of

these menus contains several MS WORD commands and utilities.

File: - the file menu displays the several menu commands .The file menu is used to perform a

variety of file and printing operations. The main menu selections or commands in the file pull

down menu are: - New, Open, save, Save as, Properties, Templates, Page setup, Print Preview,

print, send, Exit and some currently used and saved document files.

Page 10: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Edit: -The edits menu displays several menu commands like: -Cut, Copy, Paste, Clear, select all,

Find, Replace, Goto, Bookmark.

Window: - The window menu displays these commands: -New window, arrange all, split, and

some document filename.

Help: - Help menu displays: -Microsoft word help topics, Answer wizards,

STANDARD TOOL BAR : It is a horizontal bar that appears below the menu bar. It contains

shortcut command buttons. These buttons are the shortcuts to access standard menu

commands.

RULERS : Horizontal and vertical rulers appear on the top and left hand side of the page. They

help us to create and move the objects with accuracy.

PAGE AREA : The rectangular white area is the page of the document.

SCROLL BARS : Horizontal and vertical scrollbars are used to scroll the document to the left,

right, up and down.

DRAWING TOOLBAR : A horizontal bar at the bottom is called drawing toolbar. It contains

the several drawing tools.

STATUS BAR : Below the drawing toolbar, status bar is located. This bar depicts the status of

the current document. It displays the current page number, section number, and page

number/total number of pages in the document.

There are two types of windows:

(i) Application window: The area from the title bar till status bar.

Page 11: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

(ii) Document window: The area between the ruler bar and the scroll bar

Opening an existing document

Go to file menu and click the open command or click on the open button of the standard toolbar

or press Ctrl+O from the keyboard.

Saving a Document

For this purpose either click the save command from the file menu or press Ctrl+S or move the

mouse pointer to the save button on the standard toolbar. A save as dialog box will be shown in which

type the file name in the filename box and click OK button. The word document is saved with .doc

extension.

Closing a current document

Page 12: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Go to file menu and click the Close command or press Alt+F+C from the keyboard.

Deleting a character

You can delete a character by moving the cursor to the desired location and press the Del key.

The del key deletes the character to the of cursor position. There is another key backspace key, which is

used to delete the character to left of the cursor position.

Inserting a character

You can insert a character by moving the cursor to the desired location with mouse or

keyboard so that the insert mode becomes on.

Cut, Copy, Paste Text (Moving and copying text):

To cut the text click the cut button from the standard toolbar or select the cut command from

the edit menu or press Ctrl+X key combination. To cut the desired text highlight the text by selecting it

and use any cut way. To copy the text by highlighting it then click the copy button from the standard

toolbar or select the copy command from the edit menu or press the Ctrl+C key combination from the

keyboard. Now you can paste the text by copy command. To paste the text move the cursor to the

desired location where you want to paste and click the paste button from the standard toolbar or select

the paste command from the edit menu or press Ctrl+V combination from the keyboard.

Centering the Text

Highlight the text by selecting it and click center button on the formatting toolbar or press Ctrl+E

combination from the keyboard.

Page 13: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Left Alignment of Text

If you want to set the selected text or paragraph or whole document at the left margin

alignment then first highlight the required text by selecting it, now either move the mouse pointer to

Align left button on the formation toolbar or press Ctrl+L key combination from the keyboard.

Right Alignment Of Text

First highlight the required text by selecting it. Now either move the mouse printer to Align right

button or the formatting toolbar or press Ctrl+R key combination from the keyboard.

Justify the Text

First highlight the required text by selecting it. Now either move the mouse pointer to the justify

button on the formatting toolbar or press Ctrl+J key combination from the keyboard.

Page Breaks

You can insert a manual page break any time you want to force Word to start a new page. To

insert a page break, move the cursor where you want to set the page break. You can select Break

command from the insert menu and click the break command.

Page 14: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Chapter 8

Programming in C++

1.Write a program to print some word:-

#include<iostream.h>

#include<conio.h>

void main()

{

cout<<"Bismillah Hirahman Nir Rahim";

getch();

}

Output:-

Page 15: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

2. Write a program to Add, Subtract, Multiply, Divide & find remainder of two no.s:-

#include<iostream.h>

#include<conio.h>

void main()

{

int a,b,c,d,e,f,g;

cout<<"Enter the value of a=";

cin>>a;

cout<<"Enter the value of b=";

cin>>b;

c=a+b;

cout<<"The Addition is="<<c<<endl;

Page 16: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

d=a-b;

cout<<"The Substraction is="<<d<<endl;

e=a*b;

cout<<"The Multiplication is="<<e<<endl;

f=a/b;

cout<<"The Division is="<<f<<endl;

g=a%b;

cout<<"The Remainder is="<<g<<endl;

getch();

}

Output:-

Page 17: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

3.Write a program to find the Area of Square, Triangle, Rectangle & Circle:-

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

float a,b,c,d,e,f,g,h,i,j;

cout<<"Enter the Side of Square=";

cin>>a;

b=a*a;

cout<<"The area of the square is="<<b<<endl;

Page 18: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

cout<<"Enter the base of the triangle=";

cin>>c;

cout<<"Enter the altitude of the triangle=";

cin>>d;

e=(c*d)/2;

cout<<"Te area of triangle is="<<e<<endl;

cout<<"Enter the length of rectangle=";

cin>>f;

cout<<"Enter the breadth of rectangle=";

cin>>g;

h=f*g;

cout<<"The area of rectangle is="<<h<<endl;

cout<<"Enter the radius of the circle=";

cin>>i;

j=3.14*i*i;

cout<<"The area of circle is"<<j<<endl;

getch();

}

Output:-

On next page

Page 19: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

4.Write a program to find the greatest of two no.s by ternary operator:-

#include<iostream.h>

#include<conio.h>

void main()

{

int a,b,c;

cout<<"Enter first no.";

cin>>a;

cout<<"Enter the second no.";

cin>>b;

c=a>b?a:b;

Page 20: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

cout<<"The gratest no. is"<<c;

getch();

}

Output:-

5.Write a program to find the average of three no.s:-

#include<iostream.h>

#include<conio.h>

void main()

{

float a,b,c,d;

cout<<"Enter the first no.";

cin>>a;

Page 21: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

cout<<"Enter the second no.";

cin>>b;

cout<<"Enter the third no.";

cin>>c;

d=(a+b+c)/3;

cout<<"The average of three no.s is"<<d;

getch();

}

Output:-

Page 22: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

7.Write a program to interchange the value of two no.s:-

#include<iostream.h>

#include<conio.h>

void main()

{

int a,b;

cout<<"Enter the value of a";

cin>>a;

cout<<"Enter the value of b";

cin>>b;

b;

cout<<"The interchanged value of a is "<<b<<endl;

a;

cout<<"The interchanged value of b is "<<a<<endl;

getch();

}

Output:-

Page 23: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

8.Write a program to find the greatest of two no.s using if else:-

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a,b;

cout<<"Enter the value of a=";

cin>>a;

cout<<"enter the value of b=";

cin>>b;

if (a>b)

Page 24: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

{

cout<<"The value of a is greatest";

}

else

{

cout<<"The value of b is greatest";

}

getch();

}

Output:-

Page 25: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

9.Write a program to print 1-10 numbers:-

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int n,j;

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

{

cout<<n<<endl;

}

Output:-

Page 26: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

10.Write a program to find the greatest of three o.s using nested if else:-

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a,b,c;

cout<<"Enter the value of A";

cin>>a;

cout<<"Enter the value of B";

cin>>b;

cout<<"Enter the value of C";

Page 27: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

cin>>c;

if(a>b)

{

if(b>c)

cout<<"The value of A is greatest";

else

cout<<" ";

}

else

{

if(b>c)

cout<<"The value of B is greatest";

else

cout<<"The value of C is greatest";

}

getch();

}

Output:-

Page 28: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

11.Write a program to enter ten no.s using array:-

#include<iostream.h>

#include<conio.h>

void main()

{

int a[10],i;

a[0]=10;

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

{

cin>>a[i];

}

cout<<a[i];

getch();

Page 29: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

}

Output:-

12.Write a program to check equality of two matrices:-

#include<iostream.h>

#include<conio.h>

void main()

{

int A[2][2],B[2][2],r,c,flag=0;

cout<<"Enter the Elements of first matrix";

for(r=0;r<2;r++)

{

for(c=0;c<2;c++)

cin>>A[r][c];

Page 30: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

}

cout<<"Enter the elements of second matrix";

for(r=0;r<2;r++)

{

for(c=0;c<2;c++)

cin>>B[r][c];

}

for(r=0;r<2;r++)

{

for(c=0;c<2;c++)

{

if(A[r][c]!=B[r][c])

{

flag=1;

break;

}

if(flag==1)

break;

}

}

if(flag==1)

cout<<"Matrices are unequal";

else

cout<<"Matrices are equal";

getch();

Page 31: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

}

Output:-

13.Write a program to add to matrices:-

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a[2][2],b[2][2],r,c,e[2][2];

cout<<"Enter elements of first matrix";

Page 32: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

for(r=0;r<2;r++)

{

for(c=0;c<2;c++)

cin>>a[r][c];

}

cout<<"Enter the elements of second matrix";

for(r=0;r<2;r++)

{

for(c=0;c<2;c++)

cin>>b[r][c];

}

for(r=0;r<2;r++)

{

for(c=0;c<2;c++)

e[r][c]=a[r][c]+b[r][c];

}

for (r=0;r<2;r++)

{

for(c=0;c<2;c++)

cout<<"The sum of matrices is"<<e[r][c];

}

getch();

}

Page 33: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Output:-

14.Write a program to multiply two matrices:-

Erroeeee15Write a program to add odd terms:-

#include<iostream.h>

#include<conio.h>

void main()

{ clrscr();

int n,sum=0,i=1;

cout<<"Enter a term till which you want to add odd no.s";

cin>>n;

do

Page 34: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

{ sum=sum+i;

i=i+2;

}

while(i<=n);

{

cout<<"1+3+5+...""is"<<n<<sum; }

getch();

}

Output:-

16.Write a program to do division of two no.s using for:-

#include<iostream.h>

#include<conio.h>

Page 35: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

void main()

{

clrscr();

float a,b,c,i;

for (i=0;i<=2;i++)

{

cout<<"Enter no.s";

cin>>a>>b;

if (b==0)

{

cout<<"The denomirator can't be zero";

}

else

{

c=a/b;

}

cout<<c;

}

getch();

}Output:-

Page 36: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

17.Write a program to find length, compare and concatenate two strings:-

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

#include<string.h>

void main()

{

clrscr();

char s1[40],s2[20];

cout<<"Enter the first string";

gets(s1);

cout<<"Enter the second string";

Page 37: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

gets(s2);

cout<<"The length of first string is"<<strlen(s1)<<endl;

cout<<"The length of second string is"<<strlen(s2)<<endl;

if(strcmp(s1,s2)<0)

cout<<"S1 is greater";

else

{

if(strcmp(s1,s2)>0)

cout<<"S2 is greater";

else

cout<<"S1=S2"<<endl;

}

strcat(s1,s2);

cout<<"The concatenated string is "<<s1;

getch();

}

Output:-

Page 38: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

18.Write a program to divide string into two parts:-

#include<iostream.h>

#include<conio.h>

#include<string.h>

void main()

{

char srcstr[30],str[30],str2[10];

int i,n,j;

clrscr();

cout<<"\nenter the string\n";

cin>>srcstr;

n=strlen(srcstr);

for(i=0,j=(n/2);srcstr[j]!=0;i++,j++)

Page 39: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

{

str[i]=srcstr[i];

//cout<<str[];

str2[i]=srcstr[j] ;

} str[i]='\0';

str2[i]='\0';

cout<<"\nfirst part of string is\n";

for(i=0;str[i]!='\0';i++)

{

cout<<str[i]; }

cout<<"\n2nd part of string is\n";

for(i=0;str2[i]!='\0';i++)

{

cout<<str2[i]; }

getch();

}

Output:-

Page 40: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

19.Write a program to multiply twomo.s using fnctions:-

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a,b,c;

int multiply (int,int);

cout<<"Enter value of a";

cin>>a;

cout<<"Enter value of b";

cin>>b;

Page 41: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

c= multiply(a,b);

cout<<"Multiplication is "<<c;

getch();

}

int multiply(int x,int y)

{

int m;

m=x*y;

return m;

}

Output:-

20.Write a program to swap two no.s using functions:-

Page 42: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

#include<iostream.h>

#include<conio.h>

void main()

{

int x,y;

void swap(int,int);

clrscr();

cin>>x;

cin>>y;

swap(x,y);

cout<<"x="<<x<<endl;

cout<<"y="<<y<<endl;

getch();

}

void swap(int a,int b)

{

int temp;

temp=a;

a=b;

b=temp;

cout<<"a="<<a<<endl;

cout<<"b="<<b<<endl;

}

Output:-

Page 43: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

21.Write a program to find factorial of two no.s using recursion:-

#include<iostream.h>

#include<conio.h>

void main()

{

int fact(int);

int f,n;

cout<<"Enter the value to find factorial";

cin>>n;

f=fact(n);

cout<<"Factorial is"<<f<<endl;

getch();

Page 44: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

}

int fact (int n)

{

int value=1;

if (n==1)

return value;

else

{

value=n*fact(n-1);

return value;

}}

Output:-

Page 45: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

22.Write a program to enter and print biodata of student:-

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

class student

{

private:

char name[20];

int age;

public:

void getdata()

{

cout<<"Enter the name"<<endl;

cin>>name;

cout<<"Enter age"<<endl;

cin>>age;

}

void showdata()

{

cout<<"Name:"<<name<<endl;

cout<<"Age:"<<age<<endl;

}

Page 46: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

};

void main();

{

student std;

std.getdata();

std.showdata();

getch();

}}

Output:-

23.Write a program to use Virtual function:-

#include<iostream.h>

#include<conio.h>

Page 47: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

void main()

{

clrscr();

class b

{

public:

void show()

{

cout<<"This is class b";

}};

class d:virtual public b

{

public:

void show()

{

cout<<"This is class d";

}};

void main();

{

b obj;

d obj1;

obj.show();

obj1.show();

}}

Page 48: Fundamentals of computer applications and information technology PTU

1

Usman Ghani

Output:-