YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
Page 1: Fcpit File

Practical 1: Familiarization of the computer system and on hand practice on power on and power off.

Hardware (comper), equipment involved in the function of a computer. Computer hardware consists of the components that can be physically handled. The function of these components is typically divided into three main categories: input, output, and storage. Components in these categories connect to microprocessors, specifically, the computer’s central processing unit (CPU), the electronic circuitry that provides the computational ability and control of the computer, via wires or circuitry called a bus.

Software, on the other hand, is the set of instructions a computer uses to manipulate data, such as a word-processing program or a video game. These programs are usually stored and transferred via the computer's hardware to and from the CPU. Software also governs how the hardware is utilized; for example, how information is retrieved from a storage device. The interaction between the input and output hardware is controlled by software called the Basic Input Output System software (BIOS).

Although microprocessors are still technically considered to be hardware, portions of their function are also associated with computer software. Since microprocessors have both hardware and software aspects they are therefore often referred to as firmware

The main parts of a computer that we'll be focusing on are the Power Supply, Access Slots, Motherboard, Hard Drive, CPU, RAM, CD-Rom, and Floppy Drive.

First, let's look at two simple diagrams of the inside of a computer.

1

Page 2: Fcpit File

Quickly, you may recognize some parts of you computer just from these simple diagrams. The first diagram is of a tower computer, which currently is popular for the home PC. The second diagram is a desktop computer, which normally is used for space as you can easily place the monitor on top of it and have the whole computer compact in one easy spot.

POWER SUPPLYThe power supply is vital to the computer as it is the source of power. The power supply is usually a small metal box in the top corner of a case (tower).

ACCESS SLOTSAccess slots or expansion slots are openings in a computer where a circuit board can be inserted to add new capabilities to the computer. Examples of drives that may go here would be modems, USB drives, networking cards, video adapters, and sound cards. These expansions are easy to install along with being very useful to your computer to allow you to do new things, such as network computers together.

MOTHERBOARDThe motherboard has been an integral part of most personal computers for more than 20 years. The motherboard contains various circuit cards performing various functions all plug into many similar sockets on a common circuit board. Each circuit card performs a unique function in the computer and gets its power from the socket.

The motherboard contains many circuits and slots, but let's focus on some of the important ones. The motherboard is home to the processor (CPU) along with the access slots and RAM.

If we look at the diagram above I've labeled the parts of the motherboard that I wanted to discuss. The objects labeled 1 are the access slots. 2 is the processor slot and 3 are slots to hold memory (RAM).

CPUThe CPU, or processor, is the heart of your computer no matter what type (PC, Server, and Laptop). There are many brands for processors such as Intel and Athlon all with different processors for your computer. The CPU processes everything that your computer does, therefore the better the processor, the faster the computer.

2

Page 3: Fcpit File

RAMRandom Access Memory (RAM) is the form of memory contained in most computers. RAM is considered "random access" because you can access any memory cell directly if you know the row and column that intersect at that cell. When an application is running it stores its information in the RAM. When you close the application the information is deleted from the RAM. This is why you need certain amounts of RAM to run applications. The more RAM you have the faster your computer will be, and the more applications you'll be able to run without loosing speed.

HARD DRIVENearly every desktop computer and server in use today contains one or more hard-disk drives. These hard disks do one thing well - they store changing digital information in a relatively permanent form. They give computers the ability to remember things when the power goes out.

A hard drive stores all your files and information in a permanent form unlike storing it in RAM (which is temporary). The larger your hard disk (drive) the more information and files you're able to store. Today's average hard drive is 40 GB although slowly 80 GB hard drives are becoming used more often.

CD-ROMThe CD-Rom is quite simple, it reads CD's. CD-Rom completely stands for Compact Disk Read Only Memory. The revolution of CD's is that they hold much more data than a floppy disk, although are not as flexible when it comes to rewriting and storing personal data.

Using CD-RW you can make your own CD's and use them more like a floppy disk. These are becoming more and more popular although you still need a CD-Rom to read them.

FLOPPY DRIVEA floppy drive reads the popular floppy disk. Floppy disk are easy to use, rewritable, compact, and great for storing information. The floppy drive is simple and allows you to read, write to, and write over information stored on a floppy disk.

Now you have a basic knowledge of the parts of your own PC. In the future you'll be able to read more advanced articles and have an understanding of the parts of a PC.

3

Page 4: Fcpit File

STEPS TO SWITCH ON THE COMPUTER:

1) Switch on the UPS.

2) Switch on the monitor.

3) Press the power key of the CPU to start the machine.

STEPS TO SWITCH OFF THE COMPUTER:

1) Click on START.

2) Select TURN OFF YOUR COMPUTER OPTION option.

3) Click on SHUT DOWN to turn off.

4) Switch off the monitor.

5) Switch off the UPS.

4

Page 5: Fcpit File

Practical 2: Loading window, closing, maximizing, icon shifting & ordering.

To start Windows installation: Put Windows XP CD and restart your computer. You will see “Press any key to boot from CD …” so you must push any button on your keyboard to proceed.

Now Windows XP installation will start by itself. Please pay attention to the lower part of the screen. Important commands will be displayed that you need to use in installation process.

If drivers for hard disk controller (SATA, SCSI) is needed, you must press “F6” and do three following steps:1. Insert diskette and press “Enter”2. Choose adequate driver and press “Enter”

5

Page 6: Fcpit File

3. Press “Enter” to continue installation process

In this windows press “Enter” to continue the installation or press “F3” to cancel the installation

Then follows Windows Xp license, and if you agree with these rules and want to continue installation press “F8”, but if you don’t agree and want to cancel installation press “F3”

6

Page 7: Fcpit File

If you install Windows XP in computer that already have installed Windows XP, then you will see window and I recommend press “Esc” (don’t repair) in it. If you choose to press “R” than only the windows files will be rewrited and viruses will stay in your computer. So press “Esc”

In this step we can divide disk in many pieces (partitions) if you need it.1. If there is any partitions you can delete the with “D”2. With “C” you can create new partitionsChoose partition where you want to install Windows XP and press “Enter”

Choose file system what you want format your disk. I usually advise to choose NTFS. If you don’t want to wait long time you can choose NTFS (Quick) and press “Enter”

7

Page 8: Fcpit File

Your hard disk will be formatted and after that files will be copied to your hard disk. When all files will be copied, computer will restart.

After restart don’t press any key when you see “Press any key to boot from CD …” Just wait and Windows installation will continue.

After some time a windows will appear “Regional and Language Options”. Click customize if needed, but if you don’t need to customize click “Next” to continue Windows XP installation. You can customize it later after installation if you want.

8

Page 9: Fcpit File

Fill the fields Name and Organization, when it is done click “Next”

Write in your Windows XP license number (serial) and click “Next”

9

Page 11: Fcpit File

Choose your time zone and make sure that clock is correct. Then click “Next” Windows XP installation will continue after that.

If you want to configure network’s configurations you can do it here, but you can do it after installation as well. So you can choose ‘Typical settings’ and click “Next”. In next window click “Next”

11

Page 12: Fcpit File

Windows XP installation will continue and after that computer will restart again.

After booting in follow short wizard that offer you to activate windows and create user accounts.

12

Page 13: Fcpit File

Then choose “skip” and about windows registering in their site you can answer “No”

So you finally have installed Windows XP in your hard drive by now.

Important things to do after installation:1. Please install firewall and antivirus before you plug in your internet cable.2. After the installation process of Windows XP you can continue installing drivers and any software you need.

MINIMIZING & MAXIMIZING WINDOW

A window can be maximized and minimized by clicking the minimize and maximize button. are displayed on the right-top corner of the window on the title bar. A minimized button has hyphen (-) symbol when u click it, windows will be iconized and icon will be moved to the task bar of the Desktop. A maximize button is a small rectangular area (). When you click it, then your windows will occupy whole monitor screen i.e. it will cover up the whole desktop.

CLOSING WINDOW

If you do not want to work more with your opened window, then you can close it by clicking the close button, close button is next to the maximize button on the right top corner of the title bar. It has X (cross0 sign in the small rectangular box. It is also called cross icon.

ICON SHIFTING & ORDERING

Drag and Drop is an action which helps the user to copy and to move an icon or an object from one window to another, one folder to another etc. To drag & Drop an object on to another object is to move the mouse pointer onto the source icon or source object which you want to drag, the by pressing down the mouse left button, holding it down, move towards the destination object. When your dragged object moves onto destination object, then drop the source object onto the target object by removing your hands from the mouse button. So, dropping is to release of the mouse button from the target position when you completely drag an object.

Ordering of icons on the Desktop is done by right clicking the mouse on the blank area of Desktop. Then from the pop-up menu so displayed, select the ‘Arrange icons by’ option. From the further displayed menu you can choose any one option according to which you want to arrange the icons and the various options for ordering are: Arrange icon by-name, size, and type, modified.

13

Page 14: Fcpit File

Practical 3: Changing drives and searching files and understanding file extensions.

Changing Drives

Above you can see the three different types of drives, floppy drives, hard drives and network connected drives. The floppy drive is located in the front of the machine. This is where you insert your 3.5 inch disk. The hard drives are contained inside the machine. They have much more capacity than a floppy drive, and are considerably faster. The hard drives contain the local system information for the particular machine. The final type of drive is a network connected drive. These drives reside inside another computer and are accessed via the network. The network drives typically contain programs that are run by all of the machines on a network.

A directory window shows the directory structure of the current drive. The icon for the current drive is surrounded by a rectangle. You can change drives by clicking on another drive icon in the directory window. Double clicking a drive icon will display it without closing your current drive. You can also open a drive by using the Select Drive command on the disk menu. When you change to a different drive, the names of the files and directories on that drive are displayed in the directory window.

This is file manager with multiple drives being displayed:

14

Page 15: Fcpit File

Moving or Copying Files and Directories

To move files and folders from one folder to another, simply select the files hat are going to be moved. Then hold down the left mouse button and 'drag' the files to the destination folder. The folder with become highlighted when you have placed the mouse in the correct location. Once you have highlighted the destination, release the mouse button. The system will ask if you want to move the files. If you are certain that this is what you want to do, then click on the yes button. Otherwise click on the no button.

Copying files works the same as moving the files, with a few small differences. First of all, you must hold down the SHIFT key when copying files. This will cause a '+' to appear in the pointer. This indicates that you are going to copy files, not move them. To copy files, follow the same steps as above, but hold the SHIFT key while releasing the mouse button.

15

Page 16: Fcpit File

It is possible to copy and move files from one drive to another. To do this, simply make certain that the files you want to copy and the destination folder are both visible on the screen. You then select the files to move or copy, and drag them to the destination. When moving files between drives, you must hold down the CTRL key. NOTE: The default action for operations on the same drive is to move the files. The default action for operations between drives is to copy the files.

16

Page 17: Fcpit File

Searching for files

If you don't remember which folder you saved a file in, you can search for it. To search for a file

Click Start, and then click Search.

In the left pane, click the type of file you want to search for, or click All files and folders.

Based on the type of file you chose to search for, specify your criteria. If you know part of the file

17

Page 18: Fcpit File

name, type it. Then click Search.

Windows XP searches your computer, which may take several minutes. Windows XP then displays

the search results, which you can browse just like files in a folder. Once you are done searching, click

Yes, finished searching.

If you want to view any of the search results, double-click the file and it will open in the relevant

application. You can do this as many times as necessary to find the file you need.

`

18

Page 19: Fcpit File

Practical 4: Saving files protecting and unprotecting.

Saving Files

When you save a file, you must pay close attention to several things at once. You must first notice which disk drive you are saving to. Secondly, you must be concerned with which folder you are saving to within that drive. Finally, you must give the file a meaningful filename and let the application handle the extension for you.

Save As

When you first save a file, you are presented with a “Save As” dialog box. This box gives you all the controls you need to specify exactly where and under what name your file is saved. Windows itself provides a generic Save As dialog that can be used by applications, such as that from Notepad as shown below.

Selecting a Drive

Perhaps the most important new feature is the buttons on the left-hand side that permit easy selection of the saving location. “My Documents” is the most common location, If you are working directly off removable media such as a Zip drive, or looking for a particular area, it is best to click on the button labeled with the machine name, e.g., CTLdev in the above graphic.

19

Page 20: Fcpit File

While picking a saving location is easier with Windows 2000 than before, it is well to realize that the “Save As” dialogs always have some default drive, folder and filename to which, if you simply click the “Save” button, they will save your file. The problem is they only give you a clear look at the filename and folder portion. They don’t immediately indicate where the folder is located. It could be on any drive, and it could be at the root of that drive or in some folder or sub-folder. Since, for example, you could have any number of “Scratch” folders, even on a single drive (provided they were in separate folders themselves), it becomes very important to know which “Scratch” you are viewing.

An attempt has been made to configure the lab’s applications to automatically select the My Documents (i.e., H:\My Documents) by default. However, many programs insist on defaulting to whatever drive and folder was used last. So, unless you are sure, you need to check; otherwise, you may end up saying, “The computer lost my file!”

There are two basic methods of determining the location to which you are saving. One method uses the mouse and the other the keyboard; once you know them both, you may use whichever suits your situation, or even some combination of the two.

How to Password Protect Files in Windows

It's too bad there is no obvious method to add a password to a file on a Windows XP system. But

there are several ways to get the job done, with varying levels of inconvenience. Let's look at a

few ways to do password protection:

If you have Microsoft Office, you can protect your documents with a password. To do so, first

open the document. In Office 2007, click the Office button, move the cursor down toPrepare,

then click Encrypt Document. (In older Office versions: Click Tools, thenProtect Document.)

Now enter a password in the dialog box and press OK. Re-enter the password and press OK

again. The next time you try to open the document, you will be prompted for this password.

So what if you don't have MS Office, or you want to protect something that's not an Office

document? There are hidden files in Windows, but anyone with a mouse and a few brain cells to

rub together can easily find hidden files.

20

Page 21: Fcpit File

Password Protection Via Compressed Files

There is another way to add password protection to any file on a Windows XP system. It

involves using compressed (zipped) folders, and it a little clunky, but it works for all files, not

just Office documents.

To begin, open Windows Explorer and navigate to the file you want to protect. Right-click on the

file, select Send To, then select Compressed (zipped) Folder.

A new folder will be created, with an icon showing a zipper on a file. Double-click to open the

zipped folder, clickFile, then Add a Password. Enter the password twice and press OK. You're

done, except that you now have the original file, and the zipped file with password. So delete the

original file. From now on, when you open the zipped folder, Windows will prompt you for the

password.

21

Page 22: Fcpit File

This way, you can have one password   protected  folder for all your sensitive files, instead of

creating a zipped folder for each file. To do so, right-click in the empty space on thedesktop (or

in any open folder), select New, and then click Compressed (zipped) Folder. Enter a name for the

compressed folder, press ENTER, and you'll see a new folder icon marked with a zipper. Add a

password like we did above. Now you can use drag and drop to move one or many files to the

password protected folder.

22

Page 23: Fcpit File

Practical 5: Formatting floppies and practice on virus recognition and protection.

How to format a floppy in windows

Step 1: Insert the floppy you would like to erase into the floppy drive of your computer.

Step 2: Click on the Start button, then click on run.

Step 3. The run dialog box should now be shown. Type explorer in the Open: field and press the OK button. Alternatively, you can press down on the Windows key on your keyboard, which is generally located between your left Control and Alt keys and looks like a small flag, and while holding that key down press once on the letter E.

Both methods will open Windows Explorer . After Windows Explorer is opened you should see a screen similar to Figure 1 below.

Step 3: Click once on My Computer as show in Figure 1 above to highlight it.

Step 4: Click once on the Floppy Drive, usually the A: drive. It should now be highlighted.

Step 5: Click on the File menu and then click on the Format option as shown in Figure 2 below.

23

Page 24: Fcpit File

Step 6: After you click once on Format as shown in Figure 2 above. You will see a screen similar to Figure 3 below.

Step 7: Type in a descriptive name in the Volume Label field for this floppy or leave it blank. This is optional, so it is up to you.

Step 8: Place a checkmark in the Quick Format box designated by the red box in Figure 3 above.

Step 9: Press the Start button. You will get a confirmation box as shown in Figure 4 below.

24

Page 25: Fcpit File

Step 10: If you want to continue formatting this floppy press the OK button, otherwise press Cancel.

Step 11: Windows will now format your floppy. If it has problems Quick Formatting the floppy, then it will tell you so, you should tell it continue formatting the floppy. When it is done formatting, you will be presented with a screen as shown in Figure 5 below telling you the format is complete.

Step 12: Press OK and then Close.

Your floppy is now ready to be used.

Virus Recognition and Protection

Virus (computer), a self-duplicating computer program that spreads from computer to computer, interfering with data and software. Just as biological viruses infect people, spreading from person to person, computer viruses infect personal computers (PCs) and servers, the computers that control access to a network of computers. Some viruses are mere annoyances, but others can do serious damage. Viruses can delete or change files, steal important information, load and run unwanted applications, send documents via electronic mail (e-mail), or even cripple a machine’s operating system (OS), the basic software that runs the computer.

25

Page 26: Fcpit File

HOW INFECTIONS OCCUR

A virus can infect a computer in a number of ways. It can arrive on a floppy disk or inside an e-mail message. It can piggyback on files downloaded from the World Wide Web or from an Internet service used to share music and movies. Or it can exploit flaws in the way computers exchange data over a network. So-called blended-threat viruses spread via multiple methods at the same time. Some blended-threat viruses, for instance, spread via e-mail but also propagate by exploiting flaws in an operating system.

Traditionally, even if a virus found its way onto a computer, it could not actually infect the machine—or propagate to other machines—unless the user was somehow fooled into executing the virus by opening it and running it just as one would run a legitimate program. But a new breed of computer virus can infect machines and spread to others entirely on its own. Simply by connecting a computer to a network, the computer owner runs the risk of infection. Because the Internet connects computers around the world, viruses can spread from one end of the globe to the other in a matter of minutes.

TYPES OF VIRUSES

There are many categories of viruses, including parasitic or file viruses, bootstrap-sector, multipartite, macro, and script viruses. Then there are so-called computer worms, which have become particularly prevalent. A computer worm is a type of virus. However, instead of infecting files or operating systems, a worm replicates from computer to computer by spreading entire copies of itself.

Parasitic or file viruses infect executable files or programs in the computer. These files are often identified by the extension .exe in the name of the computer file. File viruses leave the contents of the host program unchanged but attach to the host in such a way that the virus code is run first. These viruses can be either direct-action or resident. A direct-action virus selects one or more programs to infect each time it is executed. A resident virus hides in the computer's memory and infects a particular program when that program is executed.

Bootstrap-sector viruses reside on the first portion of the hard disk or floppy disk, known as the boot sector. These viruses replace either the programs that store information about the disk's contents or the programs that start the computer. Typically, these viruses spread by means of the physical exchange of floppy disks.

Multipartite viruses combine the abilities of the parasitic and the bootstrap-sector viruses, and so are able to infect either files or boot sectors. These types of viruses can spread if a computer user boots from an infected diskette or accesses infected files.

Other viruses infect programs that contain powerful macro languages (programming languages that let the user create new features and utilities). These viruses, called macro viruses, are written in macro languages and automatically execute when the legitimate program is opened.

26

Page 27: Fcpit File

Script viruses are written in script programming languages, such as VBScript (Visual Basic Script) and JavaScript. These script languages can be seen as a special kind of macro language and are even more powerful because most are closely related to the operating system environment. The 'ILOVEYOU' virus, which appeared in 2000 and infected an estimated 1 in 5 personal computers, is a famous example of a script virus.

Strictly speaking, a computer virus is always a program that attaches itself to some other program. But computer virus has become a blanket term that also refers to computer worms. A worm operates entirely on its own, without ever attaching itself to another program. Typically, a worm spreads over e-mail and through other ways that computers exchange information over a network. In this way, a worm not only wreaks havoc on machines, but also clogs network connections and slows network traffic, so that it takes an excessively long time to load a Web page or send an e-mail.

ANTI-VIRAL TACTICS

Preparation and Prevention

Computer users can prepare for a viral infection by creating backups of legitimate original software and data files regularly so that the computer system can be restored if necessary. Viral infection can be prevented by obtaining software from legitimate sources or by using a quarantined computer—that is, a computer not connected to any network—to test new software. Plus, users should regularly install operating system (OS) patches, software updates that mend the sort of flaws, or holes, in the OS often exploited by viruses. Patches can be downloaded from the Web site of the operating system’s developer. However, the best prevention may be the installation of current and well-designed antiviral software. Such software can prevent a viral infection and thereby help stop its spread.

Virus Detection

Several types of antiviral software can be used to detect the presence of a virus. Scanning software can recognize the characteristics of a virus's computer code and look for these characteristics in the computer's files. Because new viruses must be analyzed as they appear, scanning software must be updated periodically to be effective. Other scanners search for common features of viral programs and are usually less reliable. Most antiviral software uses both on-demand and on-access scanners. On-demand scanners are launched only when the user activates them. On-access scanners, on the other hand, are constantly monitoring the computer for viruses but are always in the background and are not visible to the user. The on-access scanners are seen as the proactive part of an antivirus package and the on-demand scanners are seen as reactive. On-demand scanners usually detect a virus only after the infection has occurred and that is why they are considered reactive.

27

Page 28: Fcpit File

Antivirus software is usually sold as packages containing many different software programs that are independent of one another and perform different functions. When installed or packaged together, antiviral packages provide complete protection against viruses. Within most antiviral packages, several methods are used to detect viruses. Checksumming, for example, uses mathematical calculations to compare the state of executable programs before and after they are run. If the checksum has not changed, then the system is uninfected. Checksumming software can detect an infection only after it has occurred, however. As this technology is dated and some viruses can evade it, checksumming is rarely used today.

Most antivirus packages also use heuristics (problem-solving by trial and error) to detect new viruses. This technology observes a program’s behavior and evaluates how closely it resembles a virus. It relies on experience with previous viruses to predict the likelihood that a suspicious file is an as-yet unidentified or unclassified new virus.

Other types of antiviral software include monitoring software and integrity-shell software. Monitoring software is different from scanning software. It detects illegal or potentially damaging viral activities such as overwriting computer files or reformatting the computer's hard drive. Integrity-shell software establishes layers through which any command to run a program must pass. Checksumming is performed automatically within the integrity shell, and infected programs, if detected, are not allowed to run.

Containment and Recovery

Once a viral infection has been detected, it can be contained by immediately isolating computers on networks, halting the exchange of files, and using only write-protected disks. In order for a computer system to recover from a viral infection, the virus must first be eliminated. Some antivirus software attempts to remove detected viruses, but sometimes with unsatisfactory results. More reliable results are obtained by turning off the infected computer; restarting it from a write-protected floppy disk; deleting infected files and replacing them with legitimate files from backup disks; and erasing any viruses on the boot sector.

VIRAL STRATEGIES

The authors of viruses have several strategies to circumvent antivirus software and to propagate their creations more effectively. So-called polymorphic viruses make variations in the copies of themselves to elude detection by scanning software. A stealth virus hides from the operating system when the system checks the location where the virus resides, by forging results that would be expected from an uninfected system. A so-called fast-infector virus infects not only programs that are executed but also those that are merely accessed. As a result, running antiviral scanning software on a computer infected by such a virus can infect every program on the computer. A so-called slow-infector virus infects files only when the files are modified, so that it appears to checksumming software that the modification was legitimate. A so-called sparse-infector virus infects only on certain occasions—for example, it may infect every tenth program executed. This strategy makes it more difficult to detect the virus.

28

Page 29: Fcpit File

By using combinations of several virus-writing methods, virus authors can create more complex new viruses. Many virus authors also tend to use new technologies when they appear. The antivirus industry must move rapidly to change their antiviral software and eliminate the outbreak of such new viruses.

VIRUS-LIKE COMPUTER PROGRAMS

There are other harmful computer programs that can be part of a virus but are not considered viruses because they do not have the ability to replicate. These programs fall into three categories: Trojan horses, logic bombs, and deliberately harmful or malicious software programs that run within a Web browser, an application program such as Internet Explorer and Netscape that displays Web sites.

A Trojan horse is a program that pretends to be something else. A Trojan horse may appear to be something interesting and harmless, such as a game, but when it runs it may have harmful effects. The term comes from the classic Greek story of the Trojan horse found in Homer’s Iliad.

A logic bomb infects a computer’s memory, but unlike a virus, it does not replicate itself. A logic bomb delivers its instructions when it is triggered by a specific condition, such as when a particular date or time is reached or when a combination of letters is typed on a keyboard. A logic bomb has the ability to erase a hard drive or delete certain files.

Malicious software programs that run within a Web browser often appear in Java applets and ActiveX controls. Although these applets and controls improve the usefulness of Web sites, they also increase a vandal’s ability to interfere with unprotected systems. Because those controls and applets require that certain components be downloaded to a user’s personal computer (PC), activating an applet or control might actually download malicious code.

29

Page 30: Fcpit File

Practical 6: Practice with file manager & control panel.

The control panel is required to customize Windows based Operating systems environment by doing some settings like adjusting screen display and its color settings, modem adjustment, increasing/decreasing the speed of mouse, set/reset password, set key repeat rate, enhance the fonts and their size etc.

Control panel is a Windows based operating systems application used for maintenance of your system. The control panel is a folder full of icons. To operate any operation, control panel should be opened. In the Control Panel, you can do the following operations:

(i) Add new hardware i.e. Plug and Play.(ii) Add/remove programs(iii) Setting the date and time(iv) Customizing your screen display(v) To set the font(vi) To set Keyboard, Joystick, mouse, Modem and Printers.(vii) To set multimedia and sound system.(viii) To set Regional Setting(ix) To set the passwords(x) To set network and ODBC or 32 bit ODBC.(xi) To set the system properties.(xii) To set the power of your system.

30

Page 31: Fcpit File

Practical 7: Practice with MS-Word, operating and closing document, Preparation of document, setting of document, familiarization with various tools, mail-merge practice.

Introduction to MS-Word:

History-Evolution of Word:

Many concepts and ideas of word were brought from bravo, the original GUI word processor developed at Xerox PARC. Bravo’s creator Charles Simonyi left Xerox PARC to work for Microsoft in 1981. Simonyi hired Richard Brodie, who had worked with him on Bravo, away from PARC that summer. On February 1, 1983, development on what was originally named Multi-Tool Word began.

Having renamed it Microsoft Word, Microsoft released the program October 25, 1983, for the IBM PC. Free demonstration copies of the application were bundled with the November 1983 issue of PC World, making it the first program to be distributed on-disk with a magazine. However, it was not well received, and sales lagged behind those of rival products such as WordPerfect.

Word featured a concept of “What You See Is What You Get”, or WYSIWYG, and was the first application with such features as the ability to display bold and italics text on an IBM PC. Although MS-DOS was a character based system, Microsoft Word was the first word processor for the IBM PC that showed actual line breaks and typeface markups such as bold and italics directly on the screen while editing, although this was not a true WYSIWYG system because available displays did not have the resolution to show actual typefaces. Other DOS word processors, such as WordStar and WordPerfect, used simple text-only display with markup codes on the screen or sometimes, at the most, alternative colors.

Word 2007 is the most recent version of Word. This release includes numerous changes, including a new XML-based file format, a redesigned interface, an integrated equation editor, bibliographic management, and support for structured documents. It also has contextual tabs, which are functionally specific only to the object with focus, and many other features like Live Preview (which enables you to view the document without making any permanent change(s), Mini Toolbar, Super-tooltips, Quick Access toolbar, SmartArt, etc.

File Formats:

Word document formats (.DOC) as of early 2000s were a de facto standard of document file formats due to their popularity. Though usually just referred to as “Word document format”, this term refers primarily to the range of formats used by default in Word version 2-2003. In addition to the default Word binary formats, there are actually a no of optional alternate file formats that Microsoft has used over the years. Rich Text Formats (RTF) was an early effort to

31

Page 32: Fcpit File

create a format for interchanging formatted text between applications. RTF remains an optional format for word that retains most formatting and all content of the original document.

Later, after HTML appeared, Word supported an HTML derivative as an additional full-fidelity roundtrip format similar to RTF, with the additional capability that the file could be viewed in a web browser. Word 2007 uses the new Microsoft Office Open XML format as its default format, but retains the older Word 97-2003 format as an option. It also supports (for output only) PDF and XPS format.

COMPONENTS OF WORD WINDOW

When user opens a Microsoft Word window on the screen, it has number of different parts. These parts are given as under:

(a) Title Bar(b) Menu Bar(c) Tool Bar(d) The Ruler(e) Status Area or Status Bar(f) Scroll Bar(g) Frame (h) Working Area or Document Window Area(i) View Button Bar

32

Page 33: Fcpit File

The main ones are explained as below:

(a) Title Bar: The title bar of the MS-Word window displays the name of the program as “Microsoft Word”. It also displays the name of the document, which is currently opened. If we are creating a new document, then it will be “document1” in the title bar with the “Microsoft Word”. When after typing the textual information you save the document by pressing the Ctrl+S key combination from the keyboard, it will ask you for the name of the document. When you assign the name of the document, it will replace “Document1” with your entered name. You can move the window anywhere on the screen by moving the mouse to title bar. Here click the left mouse button once and by holding the mouse, you drag it anywhere.

(b) Menu Bar: The next line or bar of the Word window contains the menu bar. Word’s menus are pulled down from the Menu Bar, located across the top of the screen. The menu bar contains several menu items on the menu pads. Various menus are File, Edit, View, Insert, Format, Tools, Table, and Window and Help having menu pads. Menus are accessed by picking a menu name from the menu pad with the mouse pointer or by pressing Alt+X key combination from the keyboard, where X is the underlined letter in the menu name. On selecting a particular menu pad, Word displays the corresponding pull-down menu. Once a menu is pulled down, you can pick one of the selections with the mouse pointer or again by typing the underlined letter of the desired selection. These various types of menu selections on the pull down menu are also called Menu commands. When a menu command is highlighted, you can get Help information about that selected command by pressing the Function key F1. Now we will study various Pull-down menus as:

1. File: The File menu displays 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, Close, Save, Save As…, Save All, Properties…, Templates…, Page setup…, Print Preview, Print, Send, Exit and some currently used and saved document files.

We can create a new document by selecting New command or pressing the Ctrl+N key combination from the keyboard. You can open an existing document by clicking the open menu command and close it by selecting and clicking the close menu command or menu option. You can save your text or document by clicking the Save Command. If you want to save your document in another drive or directory, then click the Save As command. If you want to save all opened documents then select the Save All command. The properties selection displays information about the current document. You can set the templates by clicking the Templates command. You can set the size, margins and orientation of a page by selecting Page setup command. You can print the document and also take print preview before printing by selecting Print and Print Preview Commands respectively. You can send your document to E-mail by selecting Send to command or option. Ellipses (…) following a menu items or commands

33

Page 34: Fcpit File

indicate that dialogue boxes appear after the menu selection that performs an operation. Exit selection will quit the user from MS-Word. Word also displays recently saved files at the bottom of the file menu. You can open a recently used file by picking it with mouse pointer or by typing the corresponding number.

2. Edit: The Edit menu displays several menu selections as Undo, Clear, Repeat, Cut, Copy, Paste, Paste Special, Select all, Find, replace, Go to, Auto text, and Book mark. The Edit Menu is used to delete, Copy and move blocks of the text. It also includes Undo (to cancel last executed command) and Repeat the selection (i.e. redo operation). It will also find and replace the text. The paste special selections used to link pasted objects from other applications. You can move to any page with the help of Go to command. The Bookmark selection inserts reference points within a document. Auto text does the alignment of the text.

3. View: The View menu displays the menu commands such as Normal, Outline, Page Layout, Footer, Footnotes, Annotations, and Zoom. The view menu lets you to display your document in no. of ways including Normal, Outline, Page layout, Master Document(which gives you the document’s underlying structure) and Full screen. You can select any one of these views and take the decision which is better for the viewing the information or textual data. View can also turn off and on the display of the tool bars, the ruler, footnotes and annotations. It can also zoom the page size to different percentages. View is used to create, edit header and footers and also set.

4. Insert: The Insert menu displays the several menu commands of Break, Page Number, Annotations, Date and Time, Field, Symbol, Form Field, Footnote, Caption, Cross-Reference, Index and Tables, File, Frame, Picture, Object and Database. Insert selection gives you the ability to insert a variety of things into your document. This menu is used to insert page and section breaks, page numbers, the current date and time, footnotes, annotations, special symbols, forms, files, pictures, frames, objects, including equations, databases and captions for figures, tables or equations. You can also identify text for an index or table of contents.

5. Format: The Format menu displays menu commands like Font, Paragraph, Tabs, Bullets and Numbering, Heading Numbering, Auto format, Style gallery, Style, Frame, Picture and Drawing objects. The format menu lists options for setting and modifying various fonts, one or all paragraphs formats, to set the borders and apply shading on Borders, to insert or delete columns, to set Bullets and set the Numbers, to set heading numbering, to do auto formation, to apply various style settings, set picture in text and apply drawing objects.

6. Tools: The Tool menu has the main selections as Spelling, Grammar, Thesaurus, Hyphenation, Language, Word count, Auto correct, Mail Merge, Envelopes and Labels, Protect Document, Revisions, Macro, Customize, and Options. In this the user can use the built in spelling checker, grammatical error remover and Thesaurus. User can count the words in the document, set the special characters corresponding to different languages, turns hyphenation on or off, prepares the envelopes and labels, mail merge the documents, create and run macros, customize the various toolbars menus and shortcut keys. It can also protect and unprotect document and set the many Word options.

34

Page 35: Fcpit File

7. Table: The Table menu displays the selections of Insert row, Delete row, Merge cells, Split cells, Select row, Select column, Select table, Table Autoformat, Cell height and width, Headings, Convert table or text, Sort, Formula, Split Table, and Gridlines.

8. Window: The window menu displays several menu commands like New Window, Arrange All, Split, and some document filenames. The window menu is used to create, arrange and select document windows when more than one document is open.

9. Help: The Help menu comprises of Microsoft Word Help topics, Answer Wizard, The Microsoft Network, Word perfect Help, and about Microsoft Word. By using the help menu option, one can review the information about Word operations. You can press F1 at any selection and get the required help. We can use the Help index and search features to locate specific information. The Answer Wizard can be useful for direct Help.

(c) Tool bars: Each Office application comes with a set of tool bars. Word 6.0 and its advanced versions come with several predefined toolbars. Each tool bar has a set of tools that are appropriate for a particular type of task. By default, the standard and Formatting toolbars are displayed but you can display other toolbars at any time by selecting these from the View menu. You can also hide all the toolbars if you want to see more of your document on the screen. The main toolbars in Word 6 for Windows 3.x (3.0/3.1/3.11) are standard, formatting, Border, Database, Drawing, Forms, Microsoft, Word for Windows 2.0 and Tip Wizard .

PAGE SETUP (MARGINS AND GUTTERS):

Clicking the file menu displays the page setup command. The page setup command will set the margins (top, bottom, left, right, set gutter), define the paper size and its orientations (portrait or landscape), and find the paper source (tray and others) and set the page layout. To work with page setup, first of all click the file menu and select page setup command. When you click this command, a page setup dialog box will be displayed.

35

Page 36: Fcpit File

CHANGING STYLE, FONTS AND FONT STYLE:

Styles: Ms-Word comes with a number of built in styles (several paragraph styles and flow character styles) that can be applied to both the document heading and normal text. A style is a named set of formatting characteristics which can quickly and easily paragraph and character formatting to text. You define the style by giving it a name and various paragraphs or character formatting properties. The paragraph or selected text automatically takes on the formatting characteristics assigned to the style. The primary purpose of style is to simplify and standardize formatting. You can create any number of styles according to your requirement. Ms-Word has mainly two types of styles as: Paragraph style and character styles. A paragraph style applies to an entire paragraph and improves the paragraph’s appearance. Some common paragraph formatting characters are line spacing, Indent icon, Tab stops, Border and Font properties. Every paragraph has a style. The default paragraph style is called normal. Character style applies only to selection of text rather than the entire paragraph but you can apply it to whole paragraph. Some common character Paragraph styles are Type face, Face size, Bold, Italics and Underline.Applying style to a text: You can apply a style to a paragraph before or after you type the text in the paragraph. To apply style to a paragraph or character move the mouse pointer to the desired location and highlight the text to which you want to apply style if text is already

36

Page 37: Fcpit File

written otherwise when you type the text, it will automatically take the selected style. Now select the style from the style drop-down list in the Formatting toolbar. This list provides you a preview of each style within the list including the type face and font characteristics. You can also apply style by pressing the Ctrl+Shift+N key combination and to activate the Font drop-down list press the Ctrl+Shift+F key combinations. Also we can apply style by selecting the style command from the Format menu.

PAGE BREAKS :

MS-Word automatically warps text to the following page based on page margins, paragraphs indents and other criteria. 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. Now there are two ways to set page breaks between the continuous texts. First you can select Break Command from the Insert menu and click the break command. If it is not selected then you can click the Page Break radio button and click the ok button form the break dialog box.

37

Page 38: Fcpit File

HEADERS AND FOOTERS:

Header and Footer appear at the top and bottom respectively of a document. Header is a special text, which is often used for repeating the title of document from a page to page and entering page numbers at the top of the document. Also graphics symbol can be displayed at Header. Title of the book is shown on every page of the book work as Header. Footers are often used for the same purpose but at the bottom of a document. You have to enter the text for a header or footer only once. Headers and Footers are also useful for placing backgrounds and watermarks on a page.

Auto text:

Cut and Copy both store information on the Clipboard. Each time you store new information on the Clipboard, the old information is lost. If you wish to store text permanently so you can use it repeatedly, use Auto text. For this purpose following are the steps:

a. Type the following:Auto text information is stored permanently.

b. Highlight “Auto text information is stored permanently.”c. Choose Insert> Auto text> New from the menu.d. Microsoft Word suggests a name. The suggestion displays in the dialogue box. Change the

name by typing AT in the Please Name Your Auto text Entry Field.e. Click OK.f. Click anywhere in the text area to remove the highlighting.g. Place the cursor between the period in the sentence you just typed and the paragraph marker.h. Press the spacebar twice to leave two blank spaces.i. Type AT.j. Press F3.k. Your text should now read:

“Auto text information is stored permanently. Auto text is stored permanently.”

The Tab Key:The default tab setting for Microsoft Word is .5 inches. When you press the Tab Key, the cursor moves ½ inches across the page and an arrow appears on the screen. The arrow is a non printing character, when you print your document the arrow does not print. Press the Tab key a few times. Note how the cursor moves across the page.

Printing the document file:We can print a document, table, chart or any text or graphics materials from the document file. Note that before using the Print command, document should be opened. Also note that before using the Print command, you should take the view of your printed document using the print preview facility.

38

Page 39: Fcpit File

PREVIEWING Documents:

Previewing is the procedure to view the document before printing i.e. in other words Previewing a document means viewing a screen representation of one or more pages before you print them. To print preview a document, the procedure can be taken as:

a. Select the Print Preview option from the file menu. Alternatively, click on the Print Preview button on the standard toolbar.

b. Use the magnifier button or select the Zoom options from the view menu to enlarge the document. When you use Print Preview, several preview buttons are displayed on the Print Preview toobar

Background printing:

Some printing jobs take hours to complete. In such situations, you can use the background printing utility offered by Word. Background printing enables you to do other things while the printer prints in the background. You can also check and control the status of multiple print jobs. In background printing, the system sends the print jobs to a file on the hard disk rather than directly to the printer. It then sends it to the printer in the background.

MAIL MERGE

The term mail merge is typically used to describe the process of merging some form of address data base with a form of letter to create a group of individual letters. It is a good feature of the Microsoft Word. Mail merge is used to print letters, envelopes, mailing labels etc.

Mail merging uses two files. Actually Mail merging means to combine two different files in one at the time of printing. Mail merge uses the main file or main document and picks the first Name, address from the data files or label files and combine these file into one. Similarly it picks the second address and combines it with general letter and creates the second letter. Again similarly it will continue this process until last address in the data file.

39

Page 40: Fcpit File

How to create a mail merge file:

Mail merge list summarizes the steps involved in performing a mail merge operation:a) Create the Main letter: It has the general body of letter.b) Create the Data source: It has the label address of the letter.c) Define merge files in the main document: User defines merge fields in the main document. These

fields tell the Ms-Word where to insert specific data items from the data source.d) Merge the data with the Main document: when the main document and the data source are ready,

you can merge two. The result is a single document containing all the personalized documents with page break separating one document from another.

e) Print the document: as all personalized documents are placed in a single document file, you can print all documents in one operation.

Types of documents you can create:

The main document in a mail merge operation is the one that contains the boilerplate text and graphics, which are the same in all resulting documents. There are few types of main documents used in Mail merge:-

40

Page 41: Fcpit File

i. Form letter: when you want to create a form letter, Ms-Word merges the main document and the data source to create a single document that contains all he personalized letters, with each letter in its own section.

ii. Envelopes: Ms-Word automates the process of creating envelopes, enabling you to specify the envelope type, print options and other variables.

iii. Labels: Word allows you to specify the type of label having size, number per page etc. and then creates a main document consisting of page label. Each label cell contains the fields to insert the address information. The resulting merged document contains multiple pages of labels all in one section.

iv. Catalog: a catalog is much like a form letter which has resulting merged document contains all the data in one section instead of individual sections.

41

Page 42: Fcpit File

Practical 8: Practice with C++ with the help of simple exercises giving on hand practice and understanding of various features.

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features.[1] It was developed by Bjarne Stroustrup starting in 1979 at Bell Labs as an enhancement to the C programming language and originally named "C with Classes". It was renamed to C++ in 1983.

C++ is widely used in the software industry. Some of its application domains include systems software, application software, device drivers, embedded software, high-performance server and client applications, and entertainment software such as video games. Several groups provide both free and proprietary C++ compiler software, including the GNU Project, Microsoft, Intel, Borland and others.

The language began as enhancements to C, first adding classes, then virtual functions, operator overloading, multiple inheritance, templates, and exception handling among other features. After years of development, the C++ programming language standard was ratified in 1998 as ISO/IEC 14882:1998. That standard is still current, but is amended by the 2003 technical corrigendum, ISO/IEC 14882:2003. The next standard version (known informally as C++0x) is in development.

C++ is a statically typed, free-form, multi-paradigm, compiled language where compilation creates machine code for a target machine hardware.

Stroustrup began work on 'C with Classes' in 1979. The idea of creating a new language originated from Stroustrup's experience in programming for his Ph.D. thesis. Stroustrup found that Simula had features that were very helpful for large software development, but the language was too slow for practical use, while BCPL was fast but too low-level to be suitable for large software development. When Stroustrup started working in AT&T Bell Labs, he had the problem of analyzing the UNIX kernel with respect to distributed computing. Remembering his Ph.D. experience, Stroustrup set out to enhance the C language with Simula-like features. C was chosen because it was general-purpose, fast, portable and widely used. Besides C and Simula, some other languages that inspired him were ALGOL 68, Ada, CLU and ML. At first, the class, derived class, strong type checking, inlining, and default argument features were added to C via Cfront. The first commercial release occurred in October 1985.[2]

In 1983, the name of the language was changed from C with Classes to C++ (++ being the increment operator in C and C++). New features were added including virtual functions, function name and operator overloading, references, constants, user-controlled free-store memory control, improved type checking, and BCPL style single-line comments with two forward slashes (//). In 1985, the first edition of The C++ Programming Language was released, providing an important reference to the language, since there was not yet an official standard. In 1989, Release 2.0 of C++ was released. New features included multiple inheritance, abstract

42

Page 43: Fcpit File

classes, static member functions, const member functions, and protected members. In 1990, The Annotated C++ Reference Manual was published. This work became the basis for the future standard. Late addition of features included templates,exceptions, namespaces, new casts, and a Boolean type.

As the C++ language evolved, a standard library also evolved with it. The first addition to the C++ standard library was the stream I/O library which provided facilities to replace the traditional C functions such as printf and scanf. Later, among the most significant additions to the standard library, was the Standard Template Library.

C++ continues to be used and is still one of the preferred programming languages to develop professional applications. The language has gone from being mostly Western, to attracting programmers from all over the world.[3]

Language standard

In 1998, the C++ standards committee (the ISO/IEC JTC1/SC22/WG21 working group) standardized C++ and published the international standard ISO/IEC 14882:1998 (informally known as C++98[4]). For some years after the official release of the standard, the committee processed defect reports, and published a corrected version of the C++ standard, ISO/IEC 14882:2003, in 2003. In 2005, a technical report, called the "Library Technical Report 1" (often known as TR1 for short), was released. While not an official part of the standard, it specified a number of extensions to the standard library, which were expected to be included in the next version of C++. Support for TR1 is growing in almost all currently maintained C++ compilers.

While the C++ language is royalty-free, the standard document itself is not freely available.

According to Stroustrup: "the name signifies the evolutionary nature of the changes from C".[5] During C++'s development period, the language had been referred to as "new C", then "C with Classes". The final name is credited to Rick Mascitti (mid-1983) and was first used in December 1983. When Mascitti was questioned informally in 1992 about the naming, he indicated that it was given in a tongue-in-cheek spirit. It stems from C's "++" operator (which increments the value of a variable) and a common naming convention of using "+" to indicate an enhanced computer program. There is no language called "C plus".ABCL/c+ was the name of an earlier, unrelated programming language.

Standard library

The 1998 ANSI/ISO C++ standard consists of two parts: the core language and the C++ standard library; the latter includes most of the Standard Template Library (STL) and a slightly modified version of the C standard library. Many C++ libraries exist which are not part of the standard, and, using linkage specification, libraries can even be written in languages such as C, Fortran, Pascal, or BASIC. Which of these are supported is compiler dependent.

The C++ standard library incorporates the C standard library with some small modifications to make it optimized with the C++ language. Another large part of the C++ library is based on the

43

Page 44: Fcpit File

STL. This provides such useful tools as containers (for example vectors and lists), iterators to provide these containers with array-like access and algorithms to perform operations such as searching and sorting. Furthermore (multi)maps (associative arrays) and (multi)sets are provided, all of which export compatible interfaces. Therefore it is possible, using templates, to write generic algorithms that work with any container or on any sequence defined by iterators. As in C, the features of the library are accessed by using the #include directive to include a standard header. C++ provides 69 standard headers, of which 19 are deprecated.

The STL was originally a third-party library from HP and later SGI, before its incorporation into the C++ standard. The standard does not refer to it as "STL", as it is merely a part of the standard library, but many people still use that term to distinguish it from the rest of the library (input/output streams, internationalization, diagnostics, the C library subset, etc.).

Most C++ compilers provide an implementation of the C++ standard library, including the STL. Compiler-independent implementations of the STL, such as STLPort, also exist. Other projects also produce various custom implementations of the C++ standard library and the STL with various design goals.

Language features

C++ inherits most of C's syntax and the C preprocessor. The following is a Hello world program which uses the C++ standard library stream facility to write a message to standard output:[6][7]

#include <iostream> int main(){

std::cout << "Hello, world!";}

Operators and operator overloading

C++ provides more than 30 operators, covering basic arithmetic, bit manipulation, indirection, comparisons, logical operations and more. Almost all operators can be overloaded for user-defined types, with a few notable exceptions such as member access (. and .*). The rich set of overloadable operators is central to using C++ as a domain specific language. The overloadable operators are also an essential part of many advanced C++ programming techniques, such as smart pointers. Overloading an operator does not change the precedence of calculations involving the operator, nor does it change the number of operands that the operator uses (any operand may however be ignored).

TemplatesSee also: generic programming and template metaprogramming

44

Page 45: Fcpit File

C++ templates enable generic programming. C++ supports both function and class templates. Templates may be parameterized by types, compile-time constants, and other templates. C++ templates are implemented by instantiation at compile-time. To instantiate a template, compilers substitute specific arguments for a template's parameters to generate a concrete function or class instance. Templates are a powerful tool that can be used for generic programming, template metaprogramming, and code optimization, but this power implies a cost. Template use may increase code size, since each template instantiation produces a copy of the template code: one for each set of template arguments. This is in contrast to run-time generics seen in other languages (e.g. Java) where at compile-time the type is erased and a single template body is preserved.

Templates are different from macros: while both of these compile-time language features enable conditional compilation, templates are not restricted to lexical substitution. Templates are aware of the semantics and type system of their companion language, as well as all compile-time type definitions, and can perform high-level operations including programmatic flow control based on evaluation of strictly type-checked parameters. Macros are capable of conditional control over compilation based on predetermined criteria, but cannot instantiate new types, recurse, or perform type evaluation and in effect are limited to pre-compilation text-substitution and text-inclusion/exclusion. In other words, macros can control compilation flow based on pre-defined symbols but cannot, unlike templates, independently instantiate new symbols. Templates are a tool for static polymorphism (see below) and generic programming.

In addition, templates are a compile time mechanism in C++ which is Turing-complete, meaning that any computation expressible by a computer program can be computed, in some form, by a template metaprogram prior to runtime.

In summary, a template is a compile-time parameterized function or class written without knowledge of the specific arguments used to instantiate it. After instantiation the resulting code is equivalent to code written specifically for the passed arguments. In this manner, templates provide a way to decouple generic, broadly-applicable aspects of functions and classes (encoded in templates) from specific aspects (encoded in template parameters) without sacrificing performance due to abstraction.

Objects

C++ introduces object-oriented (OO) features to C. It offers classes, which provide the four features commonly present in OO (and some non-OO) languages: abstraction, encapsulation, inheritance, andpolymorphism. Objects are instances of classes created at runtime. The class can be thought of as a template from which many different individual objects may be generated as a program runs.

Encapsulation

Encapsulation is the hiding of information. C++ implements encapsulation by allowing all members of a class to be declared as either public, private, or protected. A public member of the class is accessible to any function. A private member is accessible only to functions that are

45

Page 46: Fcpit File

members of that class and to functions and classes explicitly granted access permission by the class ("friends"). A protected member is accessible to members of classes that inherit from the class in addition to the class itself and any friends.

The OO principle is that all of the functions (and only the functions) that access the internal representation of a type should be encapsulated within the type definition. C++ supports this (via member functions and friend functions), but does not enforce it: the programmer can declare parts or all of the representation of a type to be public, and is allowed to make public entities that are not part of the representation of the type. Because of this, C++ supports not just OO programming, but other weaker decomposition paradigms, like modular programming.

It is generally considered good practice to make all data private or protected, and to make public only those functions that are part of a minimal interface for users of the class. This hides all the details of data implementation, allowing the designer to later fundamentally change the implementation without changing the interface in any way.[8][9]

Inheritance

Inheritance allows one data type to acquire properties of other data types. Inheritance from a base class may be declared as public, protected, or private. This access specifier determines whether unrelated and derived classes can access the inherited public and protected members of the base class. Only public inheritance corresponds to what is usually meant by "inheritance". The other two forms are much less frequently used. If the access specifier is omitted, a "class" inherits privately, while a "struct" inherits publicly. Base classes may be declared as virtual; this is called virtual inheritance. Virtual inheritance ensures that only one instance of a base class exists in the inheritance graph, avoiding some of the ambiguity problems of multiple inheritance.

Multiple inheritance is a C++ feature sometimes considered controversial. Multiple inheritance allows a class to be derived from more than one base class; this can result in a complicated graph of inheritance relationships. For example, a "Flying Cat" class can inherit from both "Cat" and "Flying Mammal". Some other languages, such as Java or C#, accomplish something similar (although more limited) by allowing inheritance of multiple interfaces while restricting the number of base classes to one (interfaces, unlike classes, provide only declarations of member functions, no implementation or member data).

PolymorphismPolymorphism enables one common interface for many implementations, and for objects to act differently under different circumstances.

C++ supports several kinds of static (compile-time) and dynamic (run-time) polymorphisms. Compile-time polymorphism does not allow for certain run-time decisions, while run-time polymorphism typically incurs a performance penalty.

46

Page 47: Fcpit File

Static polymorphism

Function overloading allows programs to declare multiple functions having the same name (but with different arguments). The functions are distinguished by the number and/or types of their formal parameters. Thus, the same function name can refer to different functions depending on the context in which it is used. The type returned by the function is not used to distinguish overloaded functions.

When declaring a function, a programmer can specify default arguments for one or more parameters. Doing so allows the parameters with defaults to optionally be omitted when the function is called, in which case the default arguments will be used. When a function is called with fewer arguments than there are declared parameters, explicit arguments are matched to parameters in left-to-right order, with any unmatched parameters at the end of the parameter list being assigned their default arguments. In many cases, specifying default arguments in a single function declaration is preferable to providing overloaded function definitions with different numbers of parameters.

Templates in C++ provide a sophisticated mechanism for writing generic, polymorphic code. In particular, through the Curiously Recurring Template Pattern it's possible to implement a form of static polymorphism that closely mimics the syntax for overriding virtual functions. Since C++ templates are type-aware and Turing-complete they can also be used to let the compiler resolve recursive conditionals and generate substantial programs through template metaprogramming.

Dynamic polymorphism

Inheritance

Variable pointers (and references) to a base class type in C++ can refer to objects of any derived classes of that type in addition to objects exactly matching the variable type. This allows arrays and other kinds of containers to hold pointers to objects of differing types. Because assignment of values to variables usually occurs at run-time, this is necessarily a run-time phenomenon.

C++ also provides a dynamic_cast operator, which allows the program to safely attempt conversion of an object into an object of a more specific object type (as opposed to conversion to a more general type, which is always allowed). This feature relies on run-time type information (RTTI). Objects known to be of a certain specific type can also be cast to that type with static_cast, a purely compile-time construct which is faster and does not require RTTI.

Virtual member functions

Ordinarily when a function in a derived class overrides a function in a base class, the function to call is determined by the type of the object. A given function is overridden when there exists no difference, in the number or type of parameters, between two or more definitions of that function. Hence, at compile time it may not be possible to determine the type of the object and therefore the correct function to call, given only a base class pointer; the decision is therefore put off until runtime. This is called dynamic dispatch. Virtual member functions or methods[10] allow

47

Page 48: Fcpit File

the most specific implementation of the function to be called, according to the actual run-time type of the object. In C++, this is commonly done using virtual function tables. If the object type is known, this may be bypassed by prepending a fully qualified class name before the function call, but in general calls to virtual functions are resolved at run time.

In addition to standard member functions, operator overloads and destructors can be virtual. A general rule of thumb is that if any functions in the class are virtual, the destructor should be as well. As the type of an object at its creation is known at compile time, constructors, and by extension copy constructors, cannot be virtual. Nonetheless a situation may arise where a copy of an object needs to be created when a pointer to a derived object is passed as a pointer to a base object. In such a case a common solution is to create a clone() (or similar) function and declare that as virtual. The clone() method creates and returns a copy of the derived class when called.

A member function can also be made "pure virtual" by appending it with = 0 after the closing parenthesis and before the semicolon. Objects cannot be created of a class with a pure virtual function and are called abstract data types. Such abstract data types can only be derived from. Any derived class inherits the virtual function as pure and must provide a non-pure definition of it (and all other pure virtual functions) before objects of the derived class can be created. An attempt to create an object from a class with a pure virtual function or inherited pure virtual function will be flagged as a compile-time error.

48

Page 49: Fcpit File

Practical 9: Implementation of simple programs.

1. WAP to print hello on screen#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

cout<<"HELLO";

getch();

}

output

49

Page 50: Fcpit File

2. WAP to find sum of two numbers#include<iostream.h> #include<conio.h>

void main()

{

int a,b,c;

clrscr();

cout<<"enter first number : ";

cin>>a;

cout<<"enter second number : ";

cin>>b;

c=a+b;

cout<<"sum of two numbers is : "<<c;

getch();

}

output

50

Page 51: Fcpit File

3. WAP to find product of two numbers#include<iostream.h>

#include<conio.h>

void main()

{

int a,b,c;

clrscr();

cout<<"enter first number : ";

cin>>a;

cout<<"enter second number : ";

cin>>b;

c=a*b;

cout<<"product of numbers is : "<<c;

getch();

}

output

51

Page 52: Fcpit File

4. WAP to swap two numbers using third variable#include<iostream.h>

#include<conio.h>

void main()

{

int a,b,c;

clrscr();

cout<<"enter first number : ";

cin>>a;

cout<<"enter second number : ";

cin>>b;

c=a;

a=b;

b=c;

cout<<a<<endl<<b;

getch();

}

output

52

Page 53: Fcpit File

5. WAP to find area of circle#include<iostream.h>

#include<conio.h>

void main()

{

float r,a;

clrscr();

cout<<"enter radius of circle : ";

cin>>r;

a=3.14*r*r;

cout<<"area of circle is : "<<b;

getch();

}

output

53

Page 54: Fcpit File

6. WAP to find square root of any number #include<iostream.h>

#include<conio.h>

#include<math.h>

void main()

{

long float a,b;

clrscr();

cout<<"enter any number : ";

cin>>a;

b=sqrt(a);

cout<<"square root of number is : "<<b;

getch();

}

output

54

Page 55: Fcpit File

7. WAP to find area of triangle using hero`s formula#include<iostream.h>

#include<conio.h>

#include<math.h>

void main()

{

long float a,b,c,s,area;

clrscr();

cout<<"enter the value of three sides of triangle : ";

cin>>a>>b>>c;

s=(a+b+c)/2;

area=sqrt(s*(s-a)*(s-b)*(s-c));

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

getch();

}

output

55

Page 56: Fcpit File

8. WAP to swap two numbers without using third variable#include<iostream.h>

#include<conio.h>

void main()

{

long int a,b;

clrscr();

cout<<"enter first number : ";

cin>>a;

cout<<"enter second number : ";

cin>>b;

a=a+b;

b=a-b;

a=a-b;

cout<<a<<endl<<b;

getch();

}

output

56

Page 57: Fcpit File

9. WAP to find area & circumference of circle, volume & circumference of sphere and average of three numbers

#include<iostream.h>

#include<conio.h>

void main()

{

long float r,r1,a,c,v1,c1,x,y,z,average;

clrscr();

cout<<"enter radius of circle : ";

cin>>r;

cout<<"enter radius of sphere : ";

cin>>r1;

cout<<"enter any three numbers : ";

cin>>x>>y>>z;

a=3.14*r*r;

c=2*3.14*r;

v1=(4/3)*3.14*r1*r1*r1;

c1=4*3.14*r1*r1;

average=(x+y+z)/3;

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

cout<<"cirumference of circle is : "<<c<<endl;

cout<<"volume of sphere is : "<<v1<<endl;

cout<<"cirumference of sphere is : "<<c1<<endl;

cout<<"average of three numbers is : "<<sum;

getch();

}

57

Page 58: Fcpit File

output

58

Page 59: Fcpit File

10. WAP to print 5 on screen

10

9

#include<iostream.h>

#include<conio.h>

void main()

{

int a=5,b,c;

clrscr();

cout<<a<<endl;

b=a*2;

c=b-1;

cout<<b<<endl<<c;

getch();

}

output

59

Page 60: Fcpit File

11. WAP to find reverse of any number#include<iostream.h>

#include<conio.h>

void main()

{

long int r,s,n;

clrscr();

cout<<endl<<"enter any number : ";

cin>>n;

s=0;

while(n>0)

{

r=n%10;

s=s*10+r;

n=n/10;

}

Cout<<reverse :<<s;

getch();

}

60

Page 61: Fcpit File

output

61

Page 62: Fcpit File

12. WAP to print 4 on screen

20

22

#include<iostream.h>

#include<conio.h>

void main()

{

int a=5,b,c;

clrscr();

cout<<a<<endl;

b=a*2;

c=b-1;

cout<<b<<endl<<c;

getch();

}

output

62

Page 63: Fcpit File

13. WAP to convert integer number to float number#include<iostream.h>

#include<conio.h>

void main()

{

int a;

float b,c;

clrscr();

cout<<"enter any two numbers not completely divisible : ";

cin>>a>>b;

c=a/b;

cout<<"output :"<<c;

getch();

}

output

63

Page 64: Fcpit File

14. WAP to find greatest of three numbers using nested if statement

#include<iostream.h>

#include<conio.h>

void main()

{

int a,b,c;

clrscr();

cout<<"enter first number a : ";

cin>>a;

cout<<"enter second number b : ";

cin>>b;

cout<<"enter third number c : ";

cin>>c;

if(a>b&&b>c)

cout<<"a is greatest";

else if(b>a&&b>c)

cout<<"b is greatest";

else

cout<<"c is greatest";

getch();

}

output

64

Page 65: Fcpit File

65

Page 66: Fcpit File

15. WAP to find total marks and percentage #include<iostream.h>

#include<conio.h>

void main()

{

float a,b,c,d,e,t,p;

clrscr();

cout<<"enter marks in engg. mathematics : ";

cin>>a;

cout<<"enter marks in FCPIT : ";

cin>>b;

cout<<"enter marks in EME : ";

cin>>c;

cout<<"enter marks in chemistry : ";

cin>>d;

cout<<"enter marks in E.D. : ";

cin>>e;

t=a+b+c+d+e;

p=(t/150)*100;

cout<<"total marks : "<<t<<endl;

cout<<"pecentage of marks : "<<p<<"%";

getch();

}

66

Page 67: Fcpit File

output

67

Page 68: Fcpit File

16. WAP to print 12 as 1

2

#include<iostream.h>

#include<conio.h>

void main()

{

int a,b,c;

clrscr();

cout<<"enter any two digit number : ";

cin>>a;

b=a/10;

c=a%10;

cout<<b<<endl<<c;

getch();

}

output

68

Page 69: Fcpit File

17. WAP to calculate sum of values enter to corresponding years

#include<iostream.h>

#include<conio.h>

void main()

{

long int a,b,c,d,e,t;

clrscr();

cout<<"enter value corresponding to year 1992 : ";

cin>>a;

cout<<"enter value corresponding to year 1994 : ";

cin>>b;

cout<<"enter value corresponding to year 1996 : ";

cin>>c;

cout<<"enter value corresponding to year 2000 : ";

cin>>d;

cout<<"enter value corresponding to year 2007 : ";

cin>>e;

t=a+b+c+d+e;

cout<<"sum of all corresponding value are : "<<t;

getch();

}

69

Page 70: Fcpit File

output

70

Page 71: Fcpit File

18. WAP to caluclate bonus of employee using nested if statement

# include <iostream.h>

# include <conio.h>

void main()

{

clrscr();

int code;

float salary, bonus;

cout<<" enter the code of employee =";

cin>>code;

cout<<" enter the salary of employee =";

cin>>salary;

if(code==1)

{

if(salary>5000)

{

bonus=.05*salary;

}

else

{

bonus=0.02*salary;

}

}

else

{

bonus=0.10*salary;

}

cout<<" bonus is:"<<bonus;

71

Page 72: Fcpit File

getch();

}

output

72

Page 73: Fcpit File

19. WAP to find grade of student using switch case statement

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int p,c,m,t,per;

char g;

cout<<"enter the marks of 3 subjects: ";

cin>>p>>c>>m;

t=p+c+m;

per=t/3;

switch(per/10)

{

case 10:

case 9:

case 8:

g='A';

cout<<"distinction";

break;

case 7:

case 6:

g='B';

cout<<"first division";

break;

case 5:

case 4:

73

Page 74: Fcpit File

g='C';

cout<<"second division";

break; ;

default:

g='F';

cout<<"fail";

}

cout<<" grade is = "<<g;

getch();

}

output

74

Page 75: Fcpit File

20. WAP to check number is palindrome or not#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a,b,c=0,temp;

cout<<"enter the number : ";

cin>>a;

temp=a;

while(temp>0)

{

b=temp%10;

temp=temp/10;

c=c*10+b;

}

cout<<"reverse : "<<c<<endl;

if(a==c)

cout<<"palindrome";

else

cout<<"not palindrome";

getch();

}

75

Page 76: Fcpit File

output

76

Page 77: Fcpit File

21. WAP to show the working of a preliminary calculator:

#include<iostream.h>

#include<conio.h>

#include<math.h>

void main()

{

int n, n1, n2, c, x;

float r=0;

xyz:

clrscr();

gotoxy(36,2);cout<<"CALCULATOR";

cout<<"\n1.Addition\n2.Subtraction\n3.Multiplication\n4.Division\n5.Exit";

cout<<"\nEnter Choice(1,2,3,4,5) :";

cin>>c;

switch(c)

{

case 1 :cout<<"How many numbers?\n";cin>>n;

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

{ cout<<"\nEnter value :";cin>>n1;

r = r+n1; }

cout<<"\nSum is :"<<r;

getch();

goto xyz;

case 2 :cout<<"Enter first number :";cin>>n1;

cout<<"\nEnter second number :";cin>>n2;

r = n1 - n2;

cout<<"\nDifference :"<<abs(r);

77

Page 78: Fcpit File

getch();

goto xyz;

case 3 :r = 1;

cout<<"How many numbers?\n";cin>>n;

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

{ cout<<"Enter Value :";cin>>n1;

r = r*n1; }

cout<<"Product :"<<r;

getch();

goto xyz;

case 4 :cout<<"Enter first value :";cin>>n1;

cout<<"\nEnter second value :";cin>>n2;

r = n1/n2;

cout<<"Result is :"<<r;

getch();

goto xyz;

case 5 :break;

default :cout<<"\nYou have entered a Wrong Choice!";

getch();

goto xyz;

}

}

78

Page 79: Fcpit File

Output:

79

Page 80: Fcpit File

22. WAP to print Fibonacci series

#include<conio.h>

#include<iostream.h>

void main()

{

clrscr();

int n;

cout<<"enter the last limit for the series(>2)";

cin>>n;

int a=1,b=1,c=0;

cout<<a<<"\n"<<b<<"\n";

for(int i=1;i<=n-2;i++)

{

c=a+b;

cout<<c<<"\n";

a=b;

b=c;

}

getch();

}

80

Page 81: Fcpit File

output:

23. WAP to print table of a number:

81

Page 82: Fcpit File

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int n,i;

cout<<"\nEnter a Number :";

cin>>n;

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

cout<<"\n "<<n<<”*”<<I<<”= ”<<n*i;

getch();

}

Output:

24. WAP to print the following pattern for n rows82

Page 83: Fcpit File

* * * * * * * * *

#include<conio.h>

#include<iostream.h>

void main( )

{

int i,j,x,u,k,l;

clrscr( );

for(i=1;i<=5;i++)

{

for(j=40-i;j>=1;j--)

{

cout<<" ";

}

for(x=1;x<=i;x++)

{

cout<<"*"<<" ";

}

cout<<"\n";

}

for(u=4;u>=1;u--)

{

for(k=40-u;k>=1;k--)

{

cout<<" ";

}

for(l=1;l<=u;l++)

83

Page 84: Fcpit File

{

cout<<"*"<<" ";

}

cout<<"\n";

}

getch( );

}

Output:

25. WAP to calculate factorial of a no.

84

Page 85: Fcpit File

#include<conio.h>

#include<iostream.h>

void main( )

{

clrscr( );

float fac=1;int n;

cout<<"enter number";

cin>>n;

for(int i=n;i>=1;i--)

{

fac=fac*i;

}

cout<<"\n the fatorial of "<<n<<" is "<<fac;

getch( );

}

Output:

85

Page 86: Fcpit File

26. WAP to do addition of matrix:

#include<iostream.h>

#include<conio.h>

#include<iomanip.h>

void main()

{

clrscr();

int m[3][3] = {{1,1,1},{2,2,2},{3,3,3}}, n[3][3] = {{1,1,1},{2,2,2},{3,3,3}};

int r, c;

cout<<"Matrix M\n--------\n";

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

{

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

{

cout<<setw(3)<<m[r][c];

}

cout<<"\n";

}

cout<<"\nMatrix N\n--------\n";

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

{

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

{

cout<<setw(3)<<n[r][c];

}

cout<<"\n";

}

cout<<"\nSum of Matrices\n--------\n";

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

86

Page 87: Fcpit File

{

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

{

cout<<setw(3)<<m[r][c] + n[r][c];

}

cout<<"\n";

}

getch();

}

Output:

27. WAP for multiplication of matrix:

87

Page 88: Fcpit File

#include<iostream.h>

#include<conio.h>

#include<stdlib.h>

#include<iomanip.h>

void main()

{

clrscr();

int x[20][20], y[20][20], z[20][20], m, n, p, q, k, r, c;

cout<<"Enter size of matrix X (for row and column) :";

cin>>m>>n;

cout<<"\n\nEnter size of matrix Y (for row and column) ;";

cin>>p>>q;

if (n!=p)

{

cout<<"\n\nMultiplication is not possible.";

getch();

exit(0);

}

else

{

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

{

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

{

cout<<"Enter value of matrix X : ";

cin>>x[r][c];

88

Page 89: Fcpit File

}

}

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

{

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

{

cout<<"Enter value for matrix Y : ";

cin>>y[r][c];

}

}

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

{

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

{

z[r][c] = 0;

for (k=0; k<n; k++)

{

z[r][c] = z[r][c] + x[r][k]*y[k][c];

}}}

clrscr();

cout<<"Matrix X\n--------\n\n";

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

{

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

{

cout<<setw(5)<<x[r][c];

}

cout<<"\n";}

89

Page 90: Fcpit File

cout<<"\n\nMatrix Y\n--------\n\n";

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

{

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

{

cout<<setw(5)<<y[r][c];

}

cout<<"\n";

}

cout<<"\n\nMatrix Z\n--------\n";

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

{

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

{

cout<<setw(5)<<z[r][c];

}

cout<<"\n";

}

getch();

}

}

Output:

90

Page 91: Fcpit File

28. WAP to find the sum of rows and columns of a matrix:

91

Page 92: Fcpit File

#include<iostream.h>

#include<conio.h>

#include<iomanip.h>

void main()

{

clrscr();

int a[4][4]= {{1,5,6,3},{5,2,6,3},{3,4,1,7},{6,8,2,0}}, r, c, tr=0, tc=0;

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

{

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

{

cout<<setw(4)<<a[r][c];

tr = tr + a[r][c];

}

cout<<" "<<tr<<'\n';

tr=0;

}

cout<<"-----------------\n";

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

{

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

{

tc = tc + a[c][r];

}

cout<<setw(4)<<tc;

tc=0;

}

getch();

92

Page 93: Fcpit File

}

Output:

29. WAP to input 2 numbers and swap them(application of call by reference method of functions)

#include<iostream.h>

93

Page 94: Fcpit File

#include<conio.h>

void swap_ref (int &a, int &b)

{

int t=0;

t=a;

a=b;

b=t;

}

void main()

{

int x,y;

cout<<"Enter Values for x and y :\n";

cin>>x>>y;

swap_ref(x,y);

cout<<"x="<<x<<" y="<<y;

getch();

}

Output:

94

Page 95: Fcpit File

30. WAP to illustrate the working of structures.

95

Page 96: Fcpit File

#include<iostream.h>

#include<conio.h>

struct distance

{

int feet;

int inches;

};

int main()

{

clrscr();

distance length1,length2;

void prnsum(distance l1, distance l2);

cout<<"Enter length 1:"<<"\n";

cout<<"feet:";

cin>>length1.feet;

cout<<"\n"<<"inches:";

cin>>length1.inches;

cout<<"\n\n enter length 2: "<<"\n";

cout<<"feet:";

cin>>length2.feet;

cout<<"\n"<<"inches:";

cin>>length2.inches;

prnsum(length1, length2);

}

96

Page 97: Fcpit File

void prnsum(distance l1, distance l2)

{

distance l3;

l3.feet=l1.feet+l2.feet+(l1.inches+l2.inches)/12;

l3.inches=(l1.inches+l2.inches)%12;

cout<<"\n\n Total Feet:"<<l3.feet<<"\n";

cout<<"Total Inches:"<<l3.inches;

getch();

}

97

Page 98: Fcpit File

31. WAP to illustrate single level inheritance.

#include<iostream.h>

#include<stdio.h> //for gets

#include<conio.h> //for clrscr

const int LEN = 25;

class employee

{

char name[LEN];

long enumb;

public:

void getdata()

{

cout<<"Enter Name pleez : ";

gets(name);

cout<<"Enter Employee No.:" ;

cin>>enumb;

}

void putdata()

{

cout<<"Name is :"<<name<<"\t";

cout<<"Employee no. is :"<<enumb<<"\t";

cout<<"Basic Salary is :"<<basic;

}

protected:

float basic;

void getbasic()

{cout<<"Please enter Basic Pay :"; cin>>basic; }

98

Page 99: Fcpit File

};

class Manager : public employee //manager is derived

{

private :

char title[LEN];

public :

void getdata()

{

employee :: getdata();

getbasic();

cout<<"Enter Title : ";

gets(title); cout<<"\n";

}

void putdata()

{

employee::putdata();

cout<<"\nTitle is : "<<title<<"\n";

}

};

void main()

{

clrscr();

Manager m1,m2;

cout<<"Manager1\n"; m1.getdata();

cout<<"Manager2\n"; m2.getdata();

cout<<"\t\tManager1 Details\n"; m1.putdata();

cout<<"\t\tManager2 Details\n"; m2.putdata();

99

Page 100: Fcpit File

getch();

}

output:

100

Page 101: Fcpit File

32. WAP using classes and objects to simulate result preparation system for 20 students. the data for each student include roll no, name and marks in 3 subjects. the percentage marks and grade are to be calculated from the above info. the percentage marks are the average marks and the grade system is calculated as follows:

percentage marks grade

<50 F

>50<60 D

>60<75 C

>75<90 B

>90<100 A

#include<iostream.h>

const int obj=2;

const int size=3;

class student

{

int rollno;

char name[21];

float marks[size];

float perc;

char grade;

public:

void getval(void)

{

char ch;

cout<<"enter data";

101

Page 102: Fcpit File

cout<<"\n"<<"roll no:";

cin>>rollno;

cin.get(ch);

cout<<"\n"<<"Name:";

cin.getline(name,21);

for(inti=0,i<size,i++)

{

cout<<"\n"<<"enter marks for subject"<<(i+1)<<":";

cin>>marks[i];

}

cout<<"\n";

}

void calculate(void);

void prnresult (void);

};

void student::calculate(void)

{

float total;

total= marks[0]+marks[1]+marks[2];

perc=total/3;

if(perc<50)

grade='F';

else if(perc<60)

grade='D';

else if(perc<75)

102

Page 103: Fcpit File

grade='C';

else if(perc<90)

grade='B';

else

grade='A';

}

void student:: prnresult(void)

{

cout<<"\n"

cout<<"rollno: "<<rollno<<"\n";

cout<<"name: ";

cout.write(name,21);

cout<<"\n";

cout<<"marks in subject 1: "<<marks[0]<<"\n";

cout<<"marks in subject 2: "<<marks[1]<<"\n";

cout<<"marks in subject 3: "<<marks[2]<<"\n";

cout<<"total marks: "<<(marks[0]+marks[1]+marks[2])<<"\n";

cout<<"percentage marks:"<<perc<<"\n";

cout<<"grade:"<<grade<<"\n";

cout<<"\n";

}

student std10[obj];

int main()

{

int i=0;

for(i=0;i<obj,i++)

103

Page 104: Fcpit File

{

cout<<"student"<<(i+1)<<"\n";

std10[i].getval();

}

for(i=0,i<obj.i++)

{

std10[i].calculate();

cout<<"result of students "<<(i+1)<<"\n";

std10[i].prnresult();

}

return 0;

}

104

Page 105: Fcpit File

output:

105

Page 106: Fcpit File

10. Internet Browsing

I nternet:

The internet is a network of computer networks that makes it possible for any computer connected to it to send and receive data from any other computer connected to it. America Online, CompuServe, etc. are examples of Internet service providers. They make it physically possible for users to send and access data from the Internet. They allow you to send and receive data to and from their computers or routers which are connected to the Internet. It supports:

Multimedia Information (text, movies, pictures, sound, programs…). Hypertext Information (information that contains link to other information resources). Graphic user Interface (so users can point and click to request information instead o

typing in text commands).

The server software for the World Wide Web is called HTTP server (or informally a Web server). Examples are Mac HTTP, CERN HTTP, and NCSA HTTP. The client software for World Wide Web is called a Web Browser. Examples are: Netscape, Internet Explorer, and Lynx. These examples are particular “brands” of software that have a similar function, just like Lotus 123 and Excel are both spreadsheet software packages.

There are many different information protocols/services besides HTTP (HyperText Transfer Protocol).

Some of these are:

E-mail (STMP) - for sending information electronic mail messages. Usenet News (NNTP) – for having electronic group discussions. File Transfer Protocol (FTP) – for transferring files between computers. Telnet – for running programs on remote computers. WAIS – for searching remote collections of indexed information Gopher – for browsing remote text information through a menu interface.

The internet has actually redefined the concept of information resources and the process of conducting research. Today, the term information resource encompasses not only materials available in libraries such as books, periodicals, and audiovisual materials, but also includes e-mail messages stored in discussion group archives, electronic books, online magazines, journals and encyclopedia articles from Internet-accessible databases or research services, sound files, maps, digital photographs, streaming audio or video files that can be downloaded to your home computer, interactive tutorials offering a variety of multimedia features, or a new type of resource that may be created tomorrow.

Although computers are now the primary means of accessing the Internet, other devices are being used, such as cell phones, personal digital assistants, and pagers, which can send and

106

Page 107: Fcpit File

receive e-mail and access the Web. Soon, a variety of appliances, including your car on your TV set, may be connected to the network, communicating with each other, and providing access to information. The internet has expanded at a very fast pace in the past few couple of years.

Internet connectivity:

To have a dial up connection, following are required:

Computer Modem. Configuration: 28.8 kbps TCP/IP software, e.g. Win95 Dial-up Networking, Trumpet Winsock Internet application software, e.g. Netscape Navigator, Internet Explorer ISP dial-up telephone number. ISP DNS name-server address. ISP mail-server address.

To go online your computer must be equipped with a modem a device that translates the digital signals from your computer into analog signals that travel over a standard phone line. Those are the scratchy sounds you hear from a modem’s speaker. A modem on the other end of the line understands it and converts it sounds back into digital information. Modems come in different speeds and are measured in bps or bits per second. A 28.8 Kbps modem transmits data at speeds upto 28,800 bits per second. A 56 Kbps modem is twice as fast, sending and receiving data at a rate of upto 56000 bits per second.

To connect an external modem to your computer, you’ll need a serial modem cable. Most likely, your computer will have a connector on the back labelled serial. This connector comes in two varieties : 9-pin(male) or 25-pin (female). If you have only one of these ports, it will probably be COM1. If you have two, one will be COM1, and the other will be COM2. After you plug in your modem, you can sign up for Internet service.

Usually your setup program will try and find your modem and its COM port. If it can’t , it will ak you which COM port your modem is attached to. If you don’t know, the easiest thing to do is try them all. Even if you have all serial ports, you may be able to select one of the four COM ports. Also, there are some other devices that use the COM ports. In some computers, the mouse is plugged into a serial port. This is known as a serial mouse. If you’ve got a serial mouse plugged into COM1, then just plug the modem into COM2. If you don’t have a second COM port, you can purchase a card that goes inside your computer that will give you a second COM port. If this is necessary, you should check with the manufacturer of your computer.

Working of Internet: PROTOCOLS

107

Page 108: Fcpit File

You might take for granted that when you retrieve a file of information or send an e-mail message across the Internet it will always reach its destination. But sometimes it doesn’t, because the process for sending information is extremely complex.

In order for the Internet to work in connecting many different types of computers, software and files together, standardized rules called protocols must be used, that define how computers communicate. A good example of an early communications protocol was Morse Code. The protocol for Morse Code used standardized dots and dashes to communicate over telegraph lines by transmitting electrical impulses. These connections are made with a series of protocols called TCP/IP. The TCP/IP protocols define the Internet a packet switched network. With a packet switched conection, there is no single, unbroken connection between sender and receiver, like there is with the telephone system.

A packet –switched network does not require two computers to establish a dedicated, unbroken connection for data transfer. It instead breaks the data into small units or packets and transfer the packets over any phone or data lines that are currently available.

When you ask your browser to go to a specific Internet address, or when yo click on a hyperlink, the sending computer breaks the data you have asked for into packets. Each packet contains a piece of the data. Each packet is labeled with the addresses of the sending and receiving computers along with some instructions on how to put the data back together again once it has reached its destination.

The data in these small packets is transferred over phone lines or data lines. The packets take different routes through a complex series of routes. Each router examines the destination address and decides the best way to get the packets to their destination.

The packets eventually all reach their destination, your computer, and are put back together again, using the instructions they have been labeled with. This is why sometimes takes a while to load the data, before information appears on your screen. Of course, the speed of the data transfer depends on the type of network connection or modem you use.

All Internet functions depend on Protocols, which standardize how the data for those functions are transferred. Such protocols include :

HTTP- Hypertext Transfer Protocol

Protocol for accessing World Wide Web documents

FTP- File Transfer Protocol Protocol for transferring files from one computer to another

108

Page 109: Fcpit File

GOPHER Protocol for accessing documents via Gopher Menus (archiac,no longer widely used)

Telnet Protocol that allows user to logon to a remote computer

109


Related Documents