Sei sulla pagina 1di 73

TABLE OF CONTENTS

S.No 1. Introduction 1.1 Computer Hardware 1.2 MS-Office 1.3 C/C++ 2. 3. 4. 5. 6. 7. Computer Hardware MS-Office C/C++ List of Figures Glossary of Terms References Page No. 1 1 2 3 4-15 16-32 33-67 68 69 71

Univ. Roll No.: 90080819543

INTRODUCTION HARDWARE
The hardware are the parts of computer itself including the Central Processing Unit (CPU) and related microchips and micro-circuitry, keyboards, monitors, case and drives (hard, CD, DVD, floppy, optical, tape, etc...). Other extra parts called peripheral components or devices include mouse, printers, modems, scanners, digital cameras and cards (sound, colour, video) etc... Together they are often referred to as a personal computer.

2 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

INTRODUCTION TO MS-Office
Let us consider an office scene. Many letters are typed in the office. The officer dictates a letter. The typist first types a draft copy of the letter. The officer goes through it to check mistakes regarding spelling errors, missing words, etc. and suggests corrections. The typist changes the letter as suggested by the officer. This is a simple example of word processing. There are many software packages to do the job of word processing. Some of them work in DOS environment. Example are WordStar, Word Perfect and Professional Write. But in these days working in WINDOWS is becoming more and more popular. So let us consider software for word processing which works in WINDOWS. Our choice is MSWORD because it is the most popular software in these days. MS-WORD is a part of the bigger package called MS OFFICE, which can do much more than word processing. In fact when you open up MS OFFICE you will find four main components in it. They are MS-WORD (for word processing), MS EXCEL (for spreadsheet), MS ACCESS (for database management) and MS POWERPOINT (for presentation purposes). However, we will limit ourselves to MS-WORD only in this lesson.

3 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

WHAT IS "C&C++"
C is one of the most popular languages worldwide which is a programming language developed at AT&Ts Bell Laboraties of USA in 1972. It was designed and written by a man named Dennis Ritchie. C is so popular due to its reliability, simple , user friendly and easy to use.

4 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

HARDWARE
The hardware are the parts of computer itself including the Central Processing Unit (CPU) and related microchips and micro-circuitry, keyboards, monitors, case and drives (hard, CD, DVD, floppy, optical, tape, etc...). Other extra parts called peripheral components or devices include mouse, printers, modems, scanners, digital cameras and cards (sound, colour, video) etc... Together they are often referred to as a personal computer. Central Processing Unit - Though the term relates to a specific chip or the processor a CPU's performance is determined by the rest of the computer's circuitry and chips. Currently the Pentium chip or processor, made by Intel, is the most common CPU though there are many other companies that produce processors for personal computers. Examples are the CPU made by Motorola and AMD.

Fig -1.1 With faster processors the clock speed becomes more important. Compared to some of the first computers which operated at below 30 megahertz (MHz) the Pentium chips began at 75 MHz in the late 1990's. Speeds now exceed 3000+ MHz or 3 gigahertz
5 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

(GHz) and different chip manufacturers use different measuring standards (check your local computer store for the latest speed). It depends on the circuit board that the chip is housed in, or the motherboard, as to whether you are able to upgrade to a faster chip. The motherboard contains the circuitry and connections that allow the various component to communicate with each other. Though there were many computers using many different processors previous to this I call the 80286 processor the advent of home computers as these were the processors that made computers available for the average person. Using a processor before the 286 involved learning a proprietary system and software. Most new software are being developed for the newest and fastest processors so it can be difficult to use an older computer system. Keyboard - The keyboard is used to type information into the computer or input information. There are many different keyboard layouts and sizes with the most common for Latin based languages being the QWERTY layout (named for the first 6 keys). The standard keyboard has 101 keys. Notebooks have embedded keys accessible by special keys or by pressing key combinations (CTRL or Command and P for example).

6 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig: 1.2 Ergonomically designed keyboards are designed to make typing easier. Hand held devices have various and different keyboard configurations and touch screens. Some of the keys have a special use. There are referred to as command keys. The 3 most common are the Control or CTRL, Alternate or Alt and the Shift keys though there can be more (the Windows key for example or the Command key). Each key on a standard keyboard has one or two characters. Press the key to get the lower character and hold Shift to get the upper. Removable Storage and/or Disk Drives - All disks need a drive to get information off or read - and put information on the disk - or write. Each drive is designed for a specific
7 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

type of disk whether it is a CD, DVD, hard disk or floppy. Often the term 'disk' and 'drive' are used to describe the same thing but it helps to understand that the disk is the storage device which contains computer files - or software - and the drive is the mechanism that runs the disk.

Fig : 1.3 Digital flash drives work slightly differently as they use memory cards to store information so there are no moving parts. Digital cameras also use Flash memory cards to store information, in this case photographs. Hand held devices use digital drives and many also use memory cards. Mouse - Most modern computers today are run using a mouse controlled pointer. Generally if the mouse has two buttons the left one is used to select objects and text and the right one is used to access menus. If the mouse has one button (Mac for instance) it controls all the activity and a mouse with a third button can be used by specific software programs.

8 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

One type of mouse has a round ball under the bottom of the mouse that rolls and turns two wheels which control the direction of the pointer on the screen. Another type of mouse uses an optical system to track the movement of the mouse. Laptop computers use touch pads, buttons and other devices to control the pointer. Hand helds use a combination of devices to control the pointer, including touch screens. Note: It is important to clean the mouse periodically, particularly if it becomes sluggish. A ball type mouse has a small circular panel that can be opened, allowing you to remove the ball. Lint can be removed carefully with a tooth pick or tweezers and the ball can be washed with mild detergent. A build up will accumulate on the small wheels in the mouse. Use a small instrument or finger nail to scrape it off taking care not to scratch the wheels. Track balls can be cleaned much like a mouse and touch-pad can be wiped with a clean, damp cloth. An optical mouse can accumulate material from the surface that it is in contact with which can be removed with a finger nail or small instrument. Monitors - The monitor shows information on the screen when you type. This is called outputting information. When the computer needs more information it will display a message on the screen, usually through a dialog box. Monitors come in many types and sizes. The resolution of the monitor determines the sharpness of the screen. The resolution can be adjusted to control the screen's display..

9 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig : 1.4 Most desktop computers use a monitor with a cathode tube or liquid crystal display. Most notebooks use a liquid crystal display monitor. To get the full benefit of today's software with full colour graphics and animation, computers need a color monitor with a display or graphics card.

10 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Printers - The printer takes the information on your screen and transfers it to paper or a hard copy. There are many different types of printers with various levels of quality. The three basic types of printer are; dot matrix, inkjet, and laser.

Dot matrix printers work like a typewriter transferring ink from a ribbon to paper with a series or 'matrix' of tiny pins.

Ink jet printers work like dot matrix printers but fires a stream of ink from a cartridge directly onto the paper.

Laser printers use the same technology as a photocopier using heat to transfer toner onto paper.

Modem - A modem is used to translate information transferred through telephone lines, cable or line-of-site wireless. The term stands for modulate and demodulate which changes the signal from digital, which computers use, to analog, which telephones use and then back again. Digital modems transfer digital information directly without changing to analog. Modems are measured by the speed that the information is transferred. The measuring tool is called the baud rate. Originally modems worked at speeds below 2400 baud but today analog speeds of 56,000 are standard. Cable, wireless or digital subscriber lines can transfer information much faster with rates of 300,000 baud and up.

11 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Modems also use Error Correction which corrects for transmission errors by constantly checking whether the information was received properly or not and Compression which allows for faster data transfer rates. Information is transferred in packets. Each packet is checked for errors and is re-sent if there is an error. Anyone who has used the Internet has noticed that at times the information travels at different speeds. Depending on the amount of information that is being transferred, the information will arrive at it's destination at different times. The amount of information that can travel through a line is limited. This limit is called bandwidth. There are many more variables involved in communication technology using computers, much of which is covered in the section on the Internet. Scanners- Scanners allow you to transfer pictures and photographs to your computer. A scanner 'scans' the image from the top to the bottom, one line at a time and transfers it to the computer as a series of bits or a bitmap. You can then take that image and use it in a paint program, send it out as a fax or print it. With optional Optical Character Recognition (OCR) software you can convert printed documents such as newspaper articles to text that can be used in your word processor. Most scanners use TWAIN software that makes the scanner accessable by other software applications.

12 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig : 1.5 Digital cameras allow you to take digital photographs. The images are stored on a memory chip or disk that can be transferred to your computer. Some cameras can also capture sound and video. Case - The case houses the microchips and circuitry that run the computer. Desktop models usually sit under the monitor and tower models beside. They come in many sizes, including desktop, mini, midi, and full tower. There is usually room inside to expand or add components at a later time. By removing the cover off the case you may find plate covered, empty slots that allow you to add cards. There are various types of slots including IDE, ASI, USB, PCI and Firewire slots. Depending on the type notebook computers may have room to expand . Most Notebooks also have connections or ports that allows expansion or connection to exterior, peripheral devices such as monitor, portable hard-drives or other devices.

13 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Cards - Cards are components added to computers to increase their capability. When adding a peripheral device make sure that your computer has a slot of the type needed by the device. Sound cards allow computers to produce sound like music and voice. The older sound cards were 8 bit then 16 bit then 32 bit. Though the human ear can't distinguish the fine difference between sounds produced by the more powerful sound card they allow for more complex music and music production. Colour cards allow computers to produce colour (with a colour monitor of course). The first colour cards were 2 bit which produced 4 colours [CGA]. It was amazing what could be done with those 4 colours. Next came 4 bit allowing for 16 [EGA and VGA ] colours. Then came 16 bit allowing for 1064 colours and then 24 bit which allows for almost 17 million colours and now 32 bit and higher allow monitors to display almost a billion separate colours. Video cards allow computers to display video and animation. Some video cards allow computers to display television as well as capture frames from video. A video card with a digital video camera allows computers users to produce live video. A high speed connection is required for effective video transmission. Network cards allow computers to connect together to communicate with each other. Network cards have connections for cable, thin wire or wireless networks. For more information see the section on Networks.
14 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Cables connect internal components to the Motherboard, which is a board with series of electronic path ways and connections allowing the CPU to communicate with the other components of the computer. Memory - Memory can be very confusing but is usually one of the easiest pieces of hardware to add to your computer. It is common to confuse chip memory with disk storage. An example of the difference between memory and storage would be the difference between a table where the actual work is done (memory) and a filing cabinet where the finished product is stored (disk). To add a bit more confusion, the computer's hard disk can be used as temporary memory when the program needs more than the chips can provide. Random Access Memory or RAM is the memory that the computer uses to temporarily store the information as it is being processed. The more information being processed the more RAM the computer needs. One of the first home computers used 64 kilobytes of RAM memory (Commodore 64). Today's modern computers need a minimum of 64 Mb (recommended 128 Mb or more) to run Windows or OS 10 with modern software. RAM memory chips come in many different sizes and speeds and can usually be expanded. Older computers came with 512 Kb of memory which could be expanded to a maximum of 640 Kb. In most modern computers the memory can be expanded by adding or replacing the memory chips depending on the processor you have and the type of
15 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

memory your computer uses. Memory chips range in size from 1 Mb to 4 Gb. As computer technology changes the type of memory changes as well making old memory chips obsolete. Check your computer manual to find out what kind of memory your computer uses before purchasing new memory chips.

16 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

INTRODUCTION TO MS-OFFICE
Let us consider an office scene. Many letters are typed in the office. The officer dictates a letter. The typist first types a draft copy of the letter. The officer goes through it to check mistakes regarding spelling errors, missing words, etc. and suggests corrections. The typist changes the letter as suggested by the officer. This is a simple example of word processing. There are many software packages to do the job of word processing. Some of them work in DOS environment. Example are WordStar, Word Perfect and Professional Write. But in these days working in WINDOWS is becoming more and more popular. So let us consider software for word processing which works in WINDOWS. Our choice is MSWORD because it is the most popular software in these days. MS-WORD is a part of the bigger package called MS OFFICE, which can do much more than word processing. In fact when you open up MS OFFICE you will find four main components in it. They are MS-WORD (for word processing), MS EXCEL (for spreadsheet), MS ACCESS (for database management) and MS POWERPOINT (for presentation purposes). However, we will limit ourselves to MS-WORD only in this lesson.

17 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

OBJECTIVES
After going through this lesson you should be in a position to

start the MS-WORD package be familiar with the MS-WORD screen advantages and Features of Word Processing some common Word Processing Packages how to invoke Ms-Word learn the capabilities of Ms-Word

WHAT IS WORD-PROCESSING
Word Processor is a Software package that enables you to create, edit, print and save documents for future retrieval and reference. Creating a document involves typing by using a keyboard and saving it. Editing a document involves correcting the spelling mistakes, if any, deleting or moving words sentences or paragraphs. (a) Advantages of Word Processing One of the main advantages of a word processor over a conventional typewriter is that a word processor enables you to make changes to a document without retyping the entire document.
18 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

(b) Features of Word Processing Most Word Processor available today allows more than just creating and editing documents. They have wide range of other tools and functions, which are used in formatting the documents. The following are the main features of a Word Processor i. ii. iii. iv. v. vi. vii. Text is typing into the computer, which allows alterations to be made easily. Words and sentences can be inserted, amended or deleted. Paragraphs or text can be copied /moved throughout the document. Margins and page length can be adjusted as desired. Spelling can be checked and modified through the spell check facility. Multiple document/files can be merged. Multiple copies of letters can be generated with different addresses through the mail-merge facility. (c) Some Common Word Processing Packages The followings are examples of some popular word processor available

Softword WordStar
19 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Word perfect Microsoft word

IMPORTANT FEATURES OF MS-WORD


Ms-Word not only supports word processing features but also DTP features. Some of the important features of Ms-Word are listed below: i. Using word you can create the document and edit them later, as and when required, by adding more text, modifying the existing text, deleting/moving some part of it. ii. iii. Changing the size of the margins can reformat complete document or part of text. Font size and type of fonts can also be changed. Page numbers and Header and Footer can be included. iv. Spelling can be checked and correction can be made automatically in the entire document. Word count and other statistics can be generated. v. Text can be formatted in columnar style as we see in the newspaper. Text boxes can be made. vi. Tables can be made and included in the text.
20 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

vii.

Word also allows the user to mix the graphical pictures with the text. Graphical pictures can either be created in word itself or can be imported from outside like from Clip Art Gallery.

viii. ix.

Word also provides the mail-merge facility. Word also has the facility of macros. Macros can be either attached to some function/special keys or to a tool bar or to a menu.

x.

It also provides online help of any option.

GETTING STARTED WITH MS-WORD


We have already told you that for working in Ms-Word you should be familiar with WINDOWS. If you have not covered WINDOWS so far then read that first and then go through MS-WORD. By now you must be aware of the fact that a software package is improved from time to time. These improvements are sold in the market as new versions of the same software. Thus you will find many versions of MS-WORD being used in different offices. In this lesson we will cover the version MS-WORD 97, which is latest in the market and contain many improvements over the older versions. However, you do not have to worry if you have an older version such as WORD 6.0 or WORD 95. All the commands available in these older versions are also available in WORD 97 and they are compatible.

21 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

While working in MS-WORD you have to work with a mouse. Also one can work, to some extent, through the keyboard. The use of mouse is simpler as it is fully menu driven. In MS-WORD every command is available in the form of icons. You can go inside MS-WORD by the following way 1. Take the mouse pointer to START button on the task bar. Click the left mouse button. The monitor will show like as follows:

22 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

23 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig. 2.1 2. Move the pointer to programs. You will notice another menu coming up to the right. 3. In that menu identify where Microsoft word is placed. Move the cursor horizontally to come out of programs. 4. Move into the rectangular area meant for Microsoft word. Click the left mouse button there. The computer will start MS-WORD. You will find the screen as follows.

24 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig. 2.2 Let us discuss the important components of the screen.

a. Title Bar The title bar displays the name of the currently active word document. Like other WINDOWS applications, it can be used to alter the size and location of the word window. b. Tool Bars Word has a number of tool bars that help you perform task faster and with great ease. Two of the most commonly tool bars are the formatting tool bar and the standard tool bar. These two toolbars are displayed just below the title bar. At any point of time any tool bar can be made ON or OFF through the tool bar option of View Menu. (c) Ruler Bar The Ruler Bar allows you to format the vertical alignment of text in a document. (d) Status Bar

25 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

The Status Bar displays information about the currently active document. This includes the page number that you are working, the column and line number of the cursor position and so on. (e) Scroll Bar The Scroll Bar helps you scroll the content or body of document. You can do so by moving the elevator button along the scroll bar, or by click in on the buttons with the arrow marked on them to move up and down and left and right of a page. (f) Workspace The Workspace is the area in the document window were you enter/type the text of your document. (g) Main Menu The Word main menu is displayed at the top of the screen as shown in the Fig. 9.1. The main menu further displays a sub menu. Some of the options are highlighted options and some of them appear as faded options. At any time, only highlighted options can be executed, faded options are not applicable. Infect if the option is faded you will not be able to choose it. You may not that any option faded under present situation may become highlighted under different situations. MAIN MENU OPTIONS
26 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

The overall functions of all the items of main menu are explained below. (a) File You can perform file management operations by using these options such as opening, closing, saving, printing, exiting etc. It displays the following sub menu.

Fig :- 2.3 File Sub menu (b) Edit Using this option you can perform editing functions such as cut, copy, paste, find and replace etc. It displays the following sub menu.
27 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig:-2.4 Edit Sub menu (c) View Word document can be of many pages. The different pages may have different modes. Each mode has its limitations. For example in normal mode the graphical picture cannot be displayed. They can only be displayed in page layout mode. Using the option "View" you can switch over from one mode to other. It displays the following Sub menu.

28 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig. 2.5 View Sub menu (d) Insert Using this menu, you can insert various objects such as page numbers, footnotes, picture frames etc. in your document. It displays the following Sub menu.

29 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig. : 2.6 Insert Submenu (e) Format Using this menu, you can perform various type of formatting operations, such as fonts can be changed, borders can be framed etc. It displays the following Sub menu.

30 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig. :2.7 Format Submenu (f) Tools Using this menu, you can have access to various utilities/tools of Word, such as spell check, macros, mail merge etc. It displays the following Sub menu.

31 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig. 2.8 Tool Submenu (g) Table This menu deals with tables. Using this menu you can perform various types of operations on the table. It displays the following Sub menu.

32 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Fig. 2.9 Table Sub menu (h) Window This menu allows you to work with two documents simultaneously. This would require two windows to be opened so that each one can hold one document. Using this menu, you can switch over from one window to another. It displays the following Sub menu.

Fig : 2.10 Window Sub menu


33 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

(i) Help Using this menu, you can get on-line help for any function.

Fig-2.11 help menu

34 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

INTRODUCTION TO C++
WHAT IS "C&C++" C is one of the most popular languages worldwide which is a programming language developed at AT&Ts Bell Laboraties of USA in 1972. It was designed and written by a man named Dennis Ritchie. C is so popular due to its reliability, simple , user friendly and easy to use.

Fig : 3.1 Understanding C++

HISTORY OF "C&C++"
In 1960 many languages came into existence but almost for a specific purpose. For e.g. COBOL was used for the commercial applications and FORTRAN for the engineering and scientific applications then the idea came to the languages users of that time why to learning and use so many languages then should use only one language which is able to
35 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

program all applications. Thus an international committee was set to develop a such a language. This committee came out with a language named ALGOL 60. But did not become so popular because it seemed too abstract, too general to reduce this a new language called CPL (Combined Programming Language) was developed at Cambridge University. It was an attempt to bring ALGOL 60 down to earth but CPL turned out to be so big, having so many features, that it was hard to learn and difficult to use. Basic Combined Programming Language (BCPL), developed by Martin Richards at Cambridge University aimed to solve this problem by bringing CPL down to its basic good features. But unfortunately it turned out to be too less powerful and too features. In the same time a language known as "B" was introduced by Ken Thompson at AT&T's Bell Labs, as a further simplification of CPL. But like BCPL, B too turned out to be very specific. Ritchie brought some features of B and added some of his own and developed C language. C++'s compactness and logically connectivity is mainly due to the fact that it's a one man language. Other examples of one man languages are PASCAL and APL.

WHERE C++ STANDS :


All programming languages divided into two categories. C++ when compared with other programming languages. a. Problem Oriented or High Level Languages : These languages have been designed to give a programming efficiency i.e. faster program developed example : FORTRAN, BASIC, PASCAL etc.
36 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

b. Machine Oriented or Low Level Languages : These languages have been designed to give a better machine efficiency i.e. faster program access.

Due to these features C++ not placed in these categories. That is why it is often called Middle Level Language. Since it designed to have both a relatively good programming efficiency (as an problem oriented language) and relatively good machine efficiency machine oriented language.

DATA TYPES IN "C++"


C++ has several different types of data, each of which can be represented differently within computers memory but memory may the different for one C++ compiler to other. The basic types of data are as follows: a. int :- An int requires 2 bytes by most compilers, and the minimum and maximum numbers that these 2 bytes can hold is -32767 and 32767 respectively. An int is used to stored whole integer numbers and cannot have fractional values or a decimal point. b. char :- It represents single character i.e. an alphabet. Its typical memory requirement is 1 byte. c. float :- It presents floating point number (i.e. a number containing a decimal point and/or an exponent). The minimum and maximum numbers that it can hold is approx. 1.0E-37 and 1.0E+37 (i.e. 1.0-37 and 1.0+37) its memory requirement is 4 bytes.

37 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

d. double :- A double data type is also used to store floating point numbers, but which can give a greater precision, of about 15 digits. Most compilers require 8 bytes to store a double. The minimum and maximum numbers that can be represented using a double are 2.2E-308 and 2.2E+308 respectively. The basic data types can be argumented by using of data type qualifiers short, long , signed and unsigned. The other data types are : i. short : The short modifier is used to modify the int data type. Compilers which have the same memory requirement e.g. 4 bytes ( or 32 bits) for int as well as long int, will generally have half the size i.e. 2 bytes for a short int. In such a case, if an int is defined as, short int, then it will occupy only 2 bytes as against 4 bytes had it been defined as an ordinary int. But if the compiler requirement is the same for an ordinary int as well as short int e.g. 2 bytes then it makes no difference whether it is defined as a short int or just an int. The range of numbers that it can store in either case will be the same. ii. long : - The long modifier can be applied to int and double data types. It can store numbers upto a maximum and minimum of 2,147,483,647 and - 2,147,483,647 respectively. iii. unsigned : - It represents unsigned (positive) integer quantity maximum permissible quantity is approximately twice as large as int. Its memory requirement is 2 bytes or 1 word.

38 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

iv.

signed char :- It represents single character with numerical values ranging from -128 to +127. Its memory requirement is 1byte.

v.

unsigned char :- It represents single character with numerical ranging from 0 to 255, its memory requirement is 1 byte.

vi.

long double :-

Double precision floating point number( It may be higher

precision than double). Its memory requirement is 2 or more words. vii. viii. void :- It is a special data type for function that do not return any value. enum :It represents enumeration constant. ( It is special type of int). Its

requirement is 2 bytes or 1 word.

VARIABLES :
A variable is an identifier that is used to represent some specified type of information within a designated portion of the program or in other words variable is an identifier that is used to represent a single data item i.e. a numerical quantity or a character constant. The contents of a variable can change for e.g. in equation 3x+y=20 since 3 and 20 cannot change, they are constants whereas x and y change or vary they are called variable.

VARIABLE DECLARATION :
A variable declaration associates a group of commands with a specific data type. All variables must be declared before they appear in executable statement. A declaration consists of a data type, followed by one or more variable names, ending with a semi-colon.
39 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Rules of Naming Variables : a. A variable name is any combination o 1 to 8 alphabets digits or underscore(_). b. The first character in variable name must be an alphabet. c. No special characters such as commas, period, blank spcace or slash are permitted in variable name. d. Uppercase and lowercase variables are treated as different usually C++ variables are in lowercase. e. No variable name may be a keyword. This means that we cannot give a variable reserved name such as int.

CONSTANTS
A constant refers to quantity that does not change its value. There are four basic types of constants in C++. They are : a. Integer constant b. Real constant c. Character constant C++ KEYWORDS Keywords are the words whose meaning has already been explained to the C++ compiler ( or in a broad sense to the computer). The keywords cannot be used as variable names because if we do so we are trying to assign a new meaning to the keyword, which is not allowed by the computer. So it would be good to not mixup the variable names and
40 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

keywords. Keywords are just like "Reserve Words". There are only 32 keywords available in C++. Following is the list of keywords.

auto case const default

double enum float for

if long register short

static switch union void

break char

else extern

int near return signed

struct typedef unsigned while

continue far do goto

THE C++ CHARACTER SET :


C++ uses the uppercase letters A to Z, the lower case letters a to z, the digits 0 to 9, and certain special characters as building blocks to form basic program elements (e.g. constants, variables, operators, expressions). The special characters are listed below :

! % &

* ) _

+ ~ ]

\ ; '

" } .

< /

# ^

( -

= [

| :

{ ,

> ?

[blank]

41 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

FORMAT SPECIFIES
Some of the different format specifiers that can be used with the printf() statement are listed below : Code %c %d, %i %f %s %u %x %p %% Format character signed decimal integers decimal floating point string of characters unsigned decimal integers unsigned hexadecimal displays a pointer prints a % sign

ESCAPE SEQUENCES
In addition to the format specifiers, escape sequences can also be used with the printf(). These are specified in the first argument of the printf() and are used mainly for screen formatting of the output. They are always preceded with a backslash (\), and since this
42 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

backslash is considered an "escape" character, these sequences are called escape sequences. They cause an escape from the normal interpretation of a string, so that the next character (after backslash) is recognized as having a special meaning. An example will make this more clear. The following table lists the different codes that can be used with the printf() function. Code meaning \b \r \\ backspace carriage return backslash \v Code meaning \f form feed \t Code meaning \n new line Code meaning \' single quote null

horizontal tab\" \a alert

double quote \0

vertical tab

OPERATORS
Relational Operators : Relational Operators are symbols that are used to test the relationship between two variables, or between a variable and a constant. The test for equality for example , is made by means of two adjacent equal signs with no space separating them. Six relational operators in C++ are :-

==

equal to
43 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

> < >= <= !=

greater than less than greater than or equal to less than or equal to not equal to.

These six operators are used to form logical expressions which represent condition that states true or false. Logical Operators : Logical operators are symbols that are used to combine or negate(disprove) expression having logical operators. For example :- we want a program to perform certain steps if n is equal to 7 and x is greater than 5. In order to code this type of expression, we use one of logical operators called AND, in conjunction(connection) with relational operators. The AND operator is represented by symbol &&. Another logical operator called OR is used when atleast one of two conditions must be true. In order for compound condition to be true. The OR operator in C++ is represented two vertical bars | | .

44 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

The third logical separated called NOT represented by single exclamation point (!). This operator has effect of reversing the value of the expression. It operates on; it makes a true expression false and false expression true. Arithmetic Operators : In C++ there are five major arithmetic operation that of addition, subtraction, multiplication, division and modulus. Each of five arithmetic operators is sometimes called unary operator because it operates on two terms or two values at a time. + Addition, - Subtraction, * multiplication, / division, % modulus.

HIERARCHY OF OPERATIONS
Priority 1st 2nd 3rd */% += Operators Description multiplication, division, modular division. addition, subtraction. assignment.

45 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

HOW TO WRITE A C++ PROGRAM


Each instruction in a C++ program is written as a separate statement. Thus a complete C+ + program will comprise of series of statements. These statements should in order in which we want them to be executed. Rules for writing a C++ program : a. Blank spaces may be inserted between two words to improve readability of the statement. But no blank spaces are allowed within a variable constant or keyboard. b. Usually all statements are entered in small case letters. c. In C++ there is no specific rule for position at which a statement is to be written so it is often called a free form language. d. Any C++ statement always end with Semi-colon. e. Comments about a program should be enclosed within /* . */. f. The number of comments can be given at one place in program. g. Comments cannot be nested. h. Any variable used in a program must be declared before using it. i. Cout is function to print on screen the value contained in a variable. j. \n is called newline and its takes cursor to next line. k. Cin is used to read value assigned to variable and & (ampersand) is used for address of variable.

46 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

THE DECISION CONTROL STRUCTURE


THE IF STATEMENT : C++ uses the keyword if to implement the decision control instruction. The simplest form of if statement is If (expression) Statement 1; The keyword if must be followed by set of parenthesis containing expression to be tested. The statement will be executed only if expression has a non-zero value (i.e. if expression is true). If the expression has value zero (i.e. if expression is false) then the statement will be ignored. If we want more than one statement to be executed then they may be grouped together to form a compound statement surrounded by paired curly bracket. THE IF-ELSE STATEMENT The general form of if-else statement is : If (expression) Statement 1; else Statement 2;

47 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

This permits a programmer to write single comparison and then execute one of two statements depending upon whether expression is true or false. In other words if the expression has non-zero value (i.e. true value) then statement will be executed otherwise if value is zero (i.e. false value) then statement 2 will be executed. These statements can also be made compound by use of curly bracket i.e. can execute more than one statement in as well as else clauses.

48 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

INCREMENT AND DECREMENT OPERATORS :


C++ includes two useful operators which are generally not found in other computer languages. These are the increment operator (++) and the decrement operator (--). The operator ++ adds 1 to its operand, whereas the operator -- subtract 1 from its operand. To be precise, x =x +1 ; Can be written as x++; and x =x - 1; can be written as : x - -; Both these operators may either precede or follow the operand , i.e. x= x +1; can be represented as x++ or
49 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

++x; Similar operations hold true for -- operator.

THE WHILE STATEMENT


The while statement is used to carry outgoing operators, in which a group of statements executed repeatedly with some condition has been satisfied. The general form of the while statement is While (expression) statement; The value of test expression enclosed in parentheses is evaluated. The statement will be executed repeatedly, as long as expression is true ( i.e. as long as it has non-zero value) i..e if result is true the program statement( the body of the loop is executed). The statement can be simple or compound, though it is usually a compound statement. Then the test expression is evaluated again, if it is again true then the statement is executed once more. In this way process continues until the expression becomes false. At that point loop is terminated and program execution continues with the statement (if any) following while loop.

THE DO-WHILE STATEMENT


The general form of do-while statement is :do statement while (expression);

50 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

The included statement will be executed repeatedly as long as value of expression is true. Thus the statement will always be executed atleast once. The test for repetition does not occur until the end of first pass through loop. The statement can be simple or compound. But usually it is compound. It must include some feature that may alter the value of expression so that the looping action can terminate.

DIFFERENCE BETWEEN WHILE AND DO-WHILE LOOP :


There is a minor difference between the working of while and do-while loops. This difference is the place where the condition is tested. The while tests the condition before executing any of the statements within the while loop. As against this, the do-while tests the condition after having executed the statements within the loop.

THE FOR LOOP:


The for allows us to specify three things about a loop in single line : a. Setting a loop counter to an initial value. b. Testing the loop counter to determine whether its value has reached the number of repetitions desired. c. Increasing the value of loop counter each time the program segment within the loop has been executed. The general form of for statement is as under :for (initialise counter; test counter; increment counter)
51 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

{ do this; and this; and this; } Initialise Counter : is the initialization expression, usually assignment expression or initialization expression. It is performed once before the loop actually begins execution. Test Counter : is the test expression i.e. it represents a condition that must be satisfied for the loop to continue execution. It determines whether the loop should continue or be terminated. Increment Counter : is the modifying expression or the modifier statement, which changes value of the variable used in test. This expression is executed at the end of each iteration, after the body of the loop is executed. Statement is the body of the loop which can be simple or compound. The three loop expressions are separated by two semi-colons. No semi-colon should be placed after increment counter. The advantage of for loop is that it gathers the important parts of loop constructs into one place.

52 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

THE ODD LOOP


The loops that we have used so far executed the statements within them a finite number of times. However, in real life programming one comes across a situation when it is not known beforehand how many times the statements in the loop are to be executed.

NESTING OF LOOPS
Nesting of if and if else : The second if-else construct is nested in the first else statement. If the condition in the first if statement is false, then the condition in the second if statement is checked. If it is false as well, the final else statement is executed. For e.g. If (condition) do this; else { if (condition) do this; else
53 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

{ do this; and this; } }

NESTING OF FOR LOOP


The nested for loops be of two types: 1 The while loop followed by a for loop: e.g. while(expression) { for (expression1;expression2;expression3) statement 1; statement 2; } 2 The for loop followed by a for loop e.g. for(I=0;I<=5;I++) {
54 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

printf("Input the integer"); scanf("%d", &n); sum=0; } for(j=0;j<=5;j++) { sum=sum+j; }

THE SWITCH STATEMENT


The switch statement causes a particular group of a statement to be chosen from several available group. The selection is based upon the current value of an expression which is included within the switch statement. The general form of switch statement is: switch (expression) statament; Here expression refers to any integer or constant value. Expression can also be of type char. The embedded statement is generally a compound statement that specifies alternate courses of action. It uses integers and constants given in expression . Case labels: These are usually followed by C++ statements.

55 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

switch( ) case expression; statement 1; statement2; . . statement n;

THE BREAK STATEMENT


The break statement is used to terminate loops or to exit from a switch. It can be used within a for, do-while, while or switch statement. The break statement is written simply as: break; without any embedded expression or statements.

56 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

THE CONTINUE STATEMENT:


The continue statement is used for bypass the remainder of the current pass through a loop. The loop does not terminate when a continue statement is encountered. The continue statement can be included within a while , do-while, or a for statement. It is simply written as continue; without any embedded statement or expression.

57 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

FUNCTION
A function is a self contained block of statements that perform a coherent task of some kind. Every C++ program can be thought of as a collection of these functions. As we noted earlier, using a function is something like hiring a person to do a specific job for you. Sometimes the interaction with this person is very simple, sometimes it's complex.

WHY USE FUNCTIONS


a. Writing functions avoids rewriting the same code over and over. Suppose you have a section of code in your program that calculates area of triangle. If , later in the program, you want to calculates area of a triangle. If, later in the program, you want to calculate the area of a different triangle, you won't like it if you are required to write the same instructions all over again. Instead , you would prefer to jump to a "section of code" that calculates area and then jump back to the place from where you left off. This section of code is nothing but a function. b. Using functions it becomes easier to write programs and keep track of what they are doing. If the operation of a program can be divided into separate activities, and each activity placed in a different function, then each could be written and checked more or less independently. Separating the code into modular functions also makes the program easier to design and understand.

58 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

POINTS KEEP IN MIND


Any C++ program contains at least one function. If a program contains only one function, it must be main(). In a C++ program if there are more than one functions present, then one (and only one) of these functions must be main(), because program execution always begins with main(). There is no limit on the number of functions that might be present in a C++ program. Each function in a program is called in the sequence specified by the function calls in main(). After each function has done its thing, control returns to main(). When main() runs out of function calls, the program ends.

ACCESSING A FUNCTION
A function can be accessed (i.e. called) by specifying its name, followed by a list of arguments enclosed in parentheses and separated by commas. If it does not require any arguments , empty pair of parentheses must follow name of the function. If function returns a value, the function access is often written as an assignment statement Y = polynomial (x); This function access causes the value returned by the function to be assigned to the variable y.
59 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

RETURN TYPES
A major advantage of a function is that they can return a value to the calling function. Thus function generally will process information passed to it from the calling portion of the program and return a single value. This information will be passed to function via special identifiers called arguments(also called parameters) and return via the return statement. Its syntax return expression; The value of the expression is returned to the calling portion of the program. This value may be an expression, variable, constant or even another function call. A function can return only a single value each time it is called. However the expression is optional and a return statement can be written without it. If the expression is omitted the return statement simply causes the control of return back to the calling portion of the program without any information transfer. /* Program of a function using return statement */ # include <stdio.h> main() { int length, breadth; printf("enter length of rectangle");

60 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

length=get_value(); printf("enter breadth of rectangle"); breadth=get_value(); printf("The area of rectangle is %d \n", length*breadth) } get_value() { int a; scanf("%d",&a); return(a); }

ADVANCED FEATURES OF FUNCTIONS :


With a sound basis of the preliminaries of C++ functions, let us now get into their intricacies. Following advanced topics would be considered here. a. Function Declaration and Prototypes b. Calling functions by value or by reference c. Recursion
61 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Let us understand these features one by one. a. Function Declaration and Prototypes : Any C++ function by default returns an int value. Whenever a call is made to a function, the complier assumes that this function would return a value of the type int. If we desire that a function should return a value other than an int, then it necessary to explicitly mention so in the calling function as well as in the called function. b. Call by Value and Call by Reference : In call by value, a variable is passed as an argument to a function, which inturn creates another copy of it in the memory. In this case any change made to this variable in the child function is not reflected back in the parent function. The change remains local to the child function. But in a call by reference, instead of the variable, its address is passed as an argument, and any changes made to the value at this address in the child function is instantly reflected back in the parent function.

POINTERS
A pointer is a variable that represents the location (rather than value) of a data item, such as a variable or an array element. Pointers can be used to pass information back and forth between a function and its reference point.

62 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Within computers memory, every data item occupies one or more contiguous memory cells (i.e. adjacent words or bytes). The number of memory cells required to store a data item depends upon type of data item. For e.g. a single character will be stored in one byte (8 bits) of memory, an integer in two bytes and a floating point number in 4 bytes. Suppose v is a variable that represents some particular data item. The compiler will automatically assign memory cells for this data item. The data item can be accessed if we know the location (i.e. the address) of the first memory cell. The address of v's memory can be determined by &v, where & is a unary operator, called address operator that evaluate address of its operand. Let us address of v be assigned to another variable pv . Thus Pv - &v This new variable is called a pointer to v, since it "points" to the location where v is stored in memory. But here pv represented v's address, not its value. Thus pv is referred to as a pointer variable.

Address of v (pv)

value of v v

63 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

The data item represented by v can be accessed by the expression *pv where * is a unary operator called indirection operator that operates only an single variable. This * is also called asterisk and it is not a variable name rather, (read as pointer to data type) is type of variable. Thus *pv and pv both represent same data item(i.e. contents of same memory cells). Also, if we write pv=&v and v=*pv then v and *pv represent same value pf v is indirectly assigned to v. POINTER DECLARATION : Pointer variables, like all other variables, must be declared before they are used in a C++ program. When a pointer variable is declared, the variable name must be preceded by an asterisk(*). This identifies the fact that the variable is a pointer. The data type that appears in declaration refers to the object of the pointer, i.e. the data item that is stored in the address represented by the pointer, rather than the pointer itself. In general pointer is declared a data type * ptvar; Where ptvar is name of pointer variable and data type refers to the data type of the pointers object. Always, an asterisk (*) must precede ptvar.

64 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

POINTER AND FUNCTION: Pointers are often passed to a function as arguments. This allows data items within the calling portion of the program to be accessed by the function and then returned to calling portion of the program in the altered form.

ARRAYS
It may be convenient to store a collection of similar data elements in different variable. For example, if the scores of 11 cricketers were to be stored in variables with unique names, it certainly would be cumbersome. Imagine your plight if you were to store 100 different values! You would have to come up with 100 unique names.

Any array certainly solves this problem because basically the variable name is the same. We differentiate among the values in an array by its unique subscripts. Array is a collection of similar elements. These similar elements could be all ints, or all floats, or all chars etc. POINTS KEEP IN MIND :a. An array is a collection of similar elements. b. The first element in the array is numbered 0, so the last element is 1 less than the size of the array. c. An array is also known as subscripted variable.
65 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

d. Before using an array its type an dimension must be declared. e. However big an array its elements are always stored in contiguous memory locations.

ONE DIMENSIONAL ARRAY :In one dimensional array there is only one row which may have several columns. For e.g. Per={48,88,34,23,96} MULTI DIMENSIONAL ARRAY :Multi Dimensional Arrays are defined in much the same manner as one dimensional arrays, except that a separate pair of square brackets is required for each subscript. Thus two-dimensional array requires two pairs of square brackets, a three dimensional will require three pair of square brackets and so on. In general terms a multi dimensional array definition can be written as data_type array_name[expression 1] [expression 2] .. [expression n] ; data_type refers to the data type of the array e.g. char, int, float etc. Array is the name of the array expression1, expression2 expression n are positive valued integer expressions that indicate the number of array element associated with each subscript.

66 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

STRINGS Character arrays are many times also called strings. A string constant is a one

dimensional array of characters terminated by a null ('\0'). For e.g. char name[] = {'H','A','E','S','L','E','R','\0'}; STRING FUNCTIONS : String.h is a library in which string function are present. Some of the string functions are a. strlen() :- The strlen function takes as its argument a string and returns an integer specifying the number of characters in thestring excluding the null character., e.g. length = strlen (name); name="computer"; Output is length = 8 b. strlwr() :- This function converts a string into lower case e.g. name="FIRST"; strlwr(name); Output is "First". c. strupr():- This function converts a string into upper case e.g. name="first" strupr=(name);
67 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

Output is "FIRST". d. strcpy() :This function strcpy copies the string pointed by its second

argument(original) into the argument pointed to by its first argument(copy). Thus the copy is performed in same direction as in assignment statement: transfer the value on the right to location on the left. e.g. name[ ] = "computer" strcpy(name1,name); Where name is array from which string has to be copied and name is array into which string has to be copied.

e. strcmp() :-

Two string functions can be compared using the library function

strcmp(string comparison). This function returns an integer. If the first string argument is less than the second, strcmp returns a value less than zero. If the first argument is equal to the second, function returns a value equal to zero, if first is greater than second than the number greater than zero is returned. The value returned by strcmp is usually the difference in the ASCII values of the unequal character.

f. strcat():- The operation of joining two string to form a third is known as concatenation. name1="Printer" name= " Computer" strcat(name1,name)
68 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

The function strcat is called to concatenate the value of name("Printer") with name (" Computer") which starts with blank space to separate it from "Printer".

69 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

LIST OF FIGURES
COMPUTER HARDWARE
Fig: 1.1 Fig : 1.2 Fig : 1.3 Fig: 1.4 Fig : 1.5 Central Processing Unit Keyboard Mouse Monitor Scanner

MS WORD
Fig: 2.1 Fig: 2.2 Fig : 2.3 Fig:-2.4 Fig. 2.5 Fig. : 2.6 Fig. :2.7 Fig. 2.8 Fig. 2.9 Fig : 2.10 Fig-2.11 Start Menu Word Sheet File Sub menu Edit Sub menu View Sub menu Insert Submenu Format Submenu Tool Submenu Table Sub menu Window Sub menu Help menu

C++
Fig : 3.1 Understanding C++

70 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

GLOSSARY OF TERMS
LAN DVD CD LCD RAM ROM MS WORD : : : : : : : Local Area Network Digital Versatile Disc Compact Disc Liquid Cristal Display Random Access Memory Read only Memory Microsoft Word

71 Baba Farid College of Engineering & Technology

Univ. Roll No.: 90080819543

REFERENCES

www.scribd.com/doc/.../Introduction-to-Microsoft-Office

www.nos.org/htm/ms-word1.htm www.desy.de/gna/html/cc/Tutorial/tutorial.html

www.cplusplus.com/doc/tutorial/

72 Baba Farid College of Engineering & Technology

Potrebbero piacerti anche