Saturday, July 23, 2011

Sun Microsystem - Star Office



CONTENTS
SECTION A

Problem No.
Problem Description
Page no.
1.
StarOffice Writer – Text Editing and Formatting
1
2.
StarOffice Writer – Page Formatting
6
3.
StarOffice Writer – Table Creation
9
4.
StarOffice Calc–Creating Worksheet –Using FILL Command
11
5.
StarOffice Calc–Creating Worksheet – Using PIE Chart
13
6.
StarOffice Calc– Generating Series
18
7.
StarOffice Base – Student Database –Using FILTER
20
8.
StarOffice Base – Mark list Database – FORM Designing
22
9.
StarOffice Base – Mark list Database – SORTING
25
10.
StarOffice Impress – Presentation about School
28
11.
StarOffice Impress – Presentation using Templates- Using Bullets
30
12.
StarOffice Impress – Days of the Week with Picture and Sound.
32
STAR OFFICE
STAROFFICE
 



1. TEXT EDITING AND FORMATTING

QUESTION:
Enter the given text (for example).
            Heaven from all creatures hides the book of fate
            All but the page prescribe the present state
A hero perishes or a sparrow fall.                                                                                                                            
Apply the following commands to the text given above,
a)      Cut, Copy, Paste using mouse and keyboard shortcut keys
b)      Find “Heaven” and Replace with “God”.
c)      Change the font style and colour.
d)      Align the first line by left, right, center and justify alignments.
e)      Align the second line by bulleted or numbered lists.
f)        Correct typographical mistake using autocorrect option.

AIM:
1.                  Enter the given text.
2.                  Cut, Copy, Paste using mouse and keyboard shortcut keys
3.                  Find “Heaven” and Replace with “God”.
4.                  Change the font style and colour.
5.                  Align the first line by left, right, center and justify alignments.
6.                  Align the second line by bulleted or numbered lists.
7.                  Correct typographical mistake using autocorrect option.


PROCEDURE:
Enter the given text using StarWriter

            To Cut and Paste using mouse.
            Select the text you want to cut using mouse.
            Select Edit  Cut from menu.
Place the insertion point at the destination place.
Select Edit  Paste from menu.

            To Cut and Paste using Keyboard.
            Select the text you want to cut using keyboard.
            Press “Ctrl+X” keys.
Place the insertion point at the destination place.
Press “Ctrl+V” keys.

            To Copy and Paste using mouse.
            Select the text you want to copy using mouse.
            Select Edit   Copy from menu.
Place the insertion point at the destination place.
Select Edit   Paste from menu.

To Copy and Paste using Keyboard.
            Select the text you want to copy using keyboard.
            Press “Ctrl+C” keys.
Place the insertion point at the destination place.
Press “Ctrl+V” keys.

To Search word “Heaven” and Replace by “God”.
Select Edit   Find & Replace from menu or press “Ctrl+F” keys.
Type the word “Heaven” in Search for dialog box.
Type the word “God” in Replace with text box.
Click “Replace” or “Replace All” button in the dialog box.      




To change the Font & Colour
            Select a paragraph.
Select Format  Character, from menu.
Select “Arial” from font list box.
Click on “Font Effect” tab
Select “Red” from colour Drop down list box.
Press “OK” button.
















To aligning the paragraph using icons & shortcut keys.
            Select a paragraph
            Press “Ctrl + L” for Left align or click on the icon  .
            Press “Ctrl + E” for Center align or click on the icon  .
            Press “Ctrl + R” for Right align or click on the icon  .
            Press “Ctrl + J” for Justified align or click on the icon  .
To add Bullets and Numbers.
            Select the paragraph.
            Press Numbered list icon  and Bulleted list icon .
Correct typographical mistake using Autocorrect option.
            Select Tools  Autocorrect option from menu.   
            Type the mistakable of replaceable text in the Replace text box.
            Type the correct text in With text box.
            Press New button.
            Finally press OK button in the dialog box.


Execution & Result:
      1.   God from all creatures hides the book of fate
            All but the page prescribe the present state
            A hero perishes or a sparrow fall.         
  1. Cut, Copy and Paste using mouse and keyboard shortcut have been executed.
  2. Found the word “Heaven” and replaced with the “God”.
  3. Changing the font style and colour has been applied.
  4. The first line of the text is aligned by left, right, center and justified.
  5. The second line of the text is applied with Bullets and numbered list.
  6. A commonly misspelled word is corrected using Autocorrect option.





2. PAGE FORMATTING
QUESTION:
Create a text with four lines. To the text increase or decrease the margin by ½ inch. Change to original setting using ruler option. Change the page orientation. Insert topic name as Header and page number a Footer.             

AIM:
1.                  To enter four line of text.     
2.                  To increase or decrease the margin by ½ inch.
3.                  To change original setting using ruler option.
4.                  To change the page orientation.
5.                  Insert a topic name in the header and the page number in the footer.

PROCEDURE:
For Changing Page Orientation and Margins.

  1. Enter the text with four lines
  2. Select Format  Page, option (to get page style dialog box)
  3. Select “Page” tab.
  4. Change Left Margin by 1.75” and Right Margin by 1.75”.
  5. Select Landscape radio button to change the page orientation.
  6. Click “OK” button.
Now the margin is changed from 1.25” to 1.75” and the page orientation from Portrait to Landscape.

For adding Header and Footer.

            Select Format  Page, option (to get page style dialog box)
            Select “Header” tab.
            Check the “Header on” Check box.
Select “Footer” tab.
Check the “Footer on” Check box and click “OK” button.
Now the Header and Footer areas in separated from the rest of the text by thin line.

                                                                                                                              

For adding Text in the Header and Footer area.

            Click the mouse pointer in Header Area.
Type Header (eg. Student Mark).
Click the mouse pointer in footer area.
Click Insert  Field  Page numbers (Page number is the footer).

Execution and Result:
1. Entered the following text,
All the character, which is typed, appears on the screen. If mistake is identified, it can     be corrected by either using the Backspace key or the Delete key. Backspace key deletes the character to the left of the insertion point. Delete key deletes the character to the right of the insertion point.
2. To the text, Margin has been increased and decreased by ½ inch.
3. The selected text had been changed to its original setting using ruler option.
4. The page orientation is changed to Landscape.
5. The topic name is inserted as “Computer Science Practical” into the Header and the page   number into the footer.
                                                                   
                                                         3. TABLE CREATION

QUESTION:
Create a table and enter the names of the five students and the mark in three subjects. Change the borders, line style and back ground colour of table. Add two more names and marks respectively.                                                                                                                                     

AIM:
1.                  To create a table to enter five names of students and marks in three subjects.
2.                  To change the border, line style and background colour of table.
3.                  Add two more names and marks.

PROCEDURE:
To create table with 6 rows and 4 columns
Ø      Select Table  Insert  Table, from menu.
Ø      In the Name text box enter “Marks”.
Ø      Enter 4 in columns spin box.
Ø      Enter 6 in rows spin box.
Ø      Press “OK” button.
After entering data the table look like this
Name
Maths
Physics
Computer
Sriram
187
168
197
Saravanan
178
175
187
Selvakumar
145
146
157
Senthil kumar
168
157
154
Sivasankar
135
147
148

To change the Border, Line Style, Background Colour.
Ø      Select the table or required cells (Now the Table Formatting Toolbar will appear).
Ø      To change the border click Border icon from the Table Formatting Toolbar. Select any one of the border styles from the list.
Ø      To change the line style, click Line style icon from the Table Formatting Toolbar. Select any one of the line styles from the list.
Ø      To change the background colour, click Background Colour icon from the Table Formatting Toolbar. Select any one of the colour from the colour palette.
Ø      To add two more rows, select Table  Insert  Row, from the menu and enter 2 in Amount spin box, and click “OK” button.



Ø      Enter the following,
Janani
175
156
145
Abinaya
157
187
175
Now the table looks like this,

RESULT:
Name
Maths
Physics
Computer
Sriram
187
168
197
Saravanan
178
175
187
Selvakumar
145
146
157
Senthil kumar
168
157
154
Sivasankar
135
147
148
Janani
175
156
145
Abinaya
157
187
175




4. CREATING WORKSHEETS-USING FILL COMMAND

QUESTION:
a.       Create a worksheet to enter the names and marks of five students in three students.
b.      Find the class average for one subject and copy using fill to the other.                                                                                                                                     
 

AIM:

1.                  To create a worksheet to store the names and marks in 3 subjects for five students.
2.                  To find Class average for one subject using formulae, and copy it to other cells using fill command.
PROCEDURE:
            To create and enter the data in to the worksheet
Ø      Select File  New  Spreadsheet.
Ø      In  cell A1 – Type as Name
Ø      In  cell B1 – Type as Maths
Ø      In  cell C1 – Type as Physics
Ø      In  cell D1 – Type as Computer
Save the Worksheet by selecting File  Save, from menu. Then enter the following data into the worksheet.
Sriram
70
80
78
Saravanan
60
40
70
Selvakumar
80
85
90
Senthil kumar
75
65
40
Sivasankaran
90
95
100

To find Subject Average
Ø      In cell A7 – Type as Subject average.
Ø      Click the cell pointer into the B7.
Ø      Enter the formulae as = Average(B2:B6).
Ø      Select the range by B7 to D7.
Ø      Click Edit  Fill  Right.




                 
RESULT:

5. CREATING WORKSHEETS – USING PIE CHART

QUESTION:
Create a worksheet to enter the following details for five employees.
  1. Employee Name, Employee Number, Basic Pay, DA, CCA, HRA and Gross Pay.
  2. Calculate Gross Pay using formulae.
  3. Change the row height and column width.
  4. Sort the record in alphabetical order of employee names.
  5. Add two more employee details.
  6. Delete one employee details.
  7. Create a Line or pie Chart to show the variation of basic pay of the employees.

AIM:
  1. Create a worksheet to store the details of the five employees.
  2. To change the row height and column width.
  3. To Sort the record by alphabetical order
  4. To add two more  employee details
  5. To delete any one employee details
  6. To create a line or pie chart.

PROCEDURE:
To create and enter the date into the spreadsheet
Ø      Select File  New  Spreadsheet.
Ø      In cell A1 – Type as Employee Name.
Ø      In cell B1 – Type as Employee No.
Ø      In cell C1 – Type as Basic.
Ø      In cell D1 – Type as DA.
Ø      In cell E1 – Type as CCA.
Ø      In cell F1 – Type as HRA.
Ø      In cell G1 – Type as Gross Pay.



Save the worksheet by selecting File   Save, from menu. Then enter the following data into the worksheet.
Easwar
A001
4500
2250
500
500
David
A002
5000
2500
500
500
Anand
A003
4500
2250
500
500
Balu
A004
6000
3000
600
600
Chandrua
A005
7000
3500
750
750
                       
To find Gross pay.
Ø      Click the cell pointer into the G2.
Ø      Enter the formulae as = Sum(C2:F2).
Ø      Select the range by G2 to G6.
Ø      Click Edit  Fill  Down.
Now the worksheet looks like this,




To Change the Row height.
Ø      Select the required rows.
Ø      Click Format  Row  Height, option from menu.
Ø      From the “Row Height” dialog box, change the row height.


To Change the Column width
Ø      Select the required columns.
Ø      Click Format  Column  Width, option from menu.
Ø      From the “Column width” dialog box, change the Column width.
To arrange name in Alphabetical order
Ø      Select the range A2 to G6.
Ø      Click    icon, from main toolbar.
Now the worksheet looks like this,

To add two more employee details
Ø      Enter the following details in the following cells
Raja
A006
3200
1500
250
250
Kumar
A007
8200
4200
900
900
Select the range by G6 to G8.
Ø      Click Edit  Fill  Down.
Ø      To delete any one employee details.
Ø      Select any one of the row.
Ø      Click Edit  Delete Cells and click on delete entire rows option.

Now the final worksheet looks like this,

To create Line or Pie Chart
Ø      Select the range by B2 to C7.
Ø      Select the area to draw chart and click on Insert  Chart, from menu.
Ø      Click Next button from Auto Format Chart (1-4) dialog box.
Ø      Select Columns option button.
Ø      Select Pies form chart icons.
Ø      Click Next button.
Ø      Click Create button.
RESULT:

                                                                                                                                               


6. GENERATING THE SERIES

Questions:
            Generate the following series using Star Calc.
a.                   3/5/00, 3/12/00, 3/19/00, ……….5/28/00.
b.                  16, 32, 64, ………… 2048.
c.                    33, 30, ……. 3.

AIM:
  1. To generate the series of numbers and dates using Fill Command in Star Calc.

PROCEDURE:

To create and enter the data in to the worksheet.
Ø      Select File  New  Spreadsheet.
Ø      Enter the data as 3/5/00 in cell A1.
Ø      Select Range of A1 to A20.
Ø      Click Edit  Fill  Series (to get Fill Series dialog box)
Ø      Select Type as Date.
Ø      Select Date unit as Day.
Ø      Enter Start Value as 03/05/00.
Ø      Enter Stop Value as 05/28/00.
Ø      Enter increment value as 7 and click OK button.
Ø      Enter 16 in B1.
Ø      Select Range of B1 to B20.
Ø      Click Edit  Fill  Series (to get Fill Series dialog box).
Ø      Select type as Growth.
Ø      Enter Start Value as 16.
Ø      Enter Stop Value as 2048.
Ø      Enter increment value as 2 and click OK button.
Ø      Enter 33 in C1
Ø      Select Range of C1 to C20.
Ø      Click Edit  Fill  Series (to get Fill Series dialog box).
Ø      Select Type as Linear.
Ø      Enter Start Value as 33.
Ø      Enter Stop Value as 3.
Ø      Enter the increment value as -3 and click OK button.

RESULT:
Now the worksheet looks like this,






7.      STUDENT DATABASE – USING FILTER

QUESTION:

Create a table to store name, age, and sex of ten students. Using filter list the names of the students aged 18 above.

AIM:
1.      To create table in StarOffice Base to store name, age and sex for 10 students.
2.      To list the names of the students aged 18 above.

PROCEDURE:
Select File  New  Database.
In Star Office Base click on Create a new database button and click Finish.
To save the database give the file name and click save.
Now you get a Database Window
Ø                  Click on Table icon in the data base pane.
Ø                  Click on “Create Table in Design View”.
Ø                  Enter the following fields respectively,
Field Name: Name
Field Type: Text
Length: 30
Field Name: Age
Field Type: Number

Field Name: Sex
Field Type: Text
Length: 1
Ø      Select FileSave or use “Ctrl + S” keys.
Ø      Enter Student as a Table name in Save As dialog box.
Ø      Press Yes for Primary Key setting.
Ø      Close the window.
Ø      And open the Student Table and enter the 10 Students details.


Ø      Now the Table looks like this,
 

To list the names using filter
Ø      Click the Standard Filter icon from the toolbar.
Ø      Select Age from Field Name Dropdown list box.
Ø      Select >= from Condition Dropdown list box.
Ø      Enter 18 in the value text box.
Ø      Click OK button to execute filter
RESULT:
 





8.      STUDENTS MARK LIST DATABASE-FROM DESINGNING

QUESTION:
Create a students mark list database file with the following fields.
            1. Reg.No.       2. Name           3. Tamil            4. English          5.Maths
            6. Science        7. Social           8. Total            9. Average
Then add two new text fields called Result and Comment according to the scheme given below
            Average Range                                              Grade
85-100                                                                                                  H
75-85                                                                                                      A+
55-65                                                         A
50-55                                                         B
45-40                                                       C+
40-45                                                       C
<40                                                                         F
Design a form to view the marks scored by a student only in a particular subject or particular student.
AIM:
  1. To create the student mark list database.
  2. Add two new text fields called Result and Comment.
  3. Design a form to view the mark record by the student.

PROCEDURE:
In StarOffice Base click on Create a new database and click Finish. To save the database give the file name & click save.
Now you get a Database Window.
Ø      Click on Table icon in the data base pane.
Ø      Click on “Create Table in Design View”.
Ø      Enter the following fields respectively.
Field name: Reg. No.
Field Type: Number

Field name: Name
Field Type: Text
Length: 30
Field name: Tamil
Field Type: Number

Field name: English
Field Type: Number

Field name: Maths
Field Type: Number

Field name: Science
Field Type: Number

Field name: Social
Field Type: Number

Field name: Total
Field Type: Number

Field name: Average
Field Type: Number

Ø      Select File  Save, from menu or use “Ctrl + S” keys.
Ø      Enter name for the table in Save As dialog box.
Ø      Press Yes for Primary key setting.
Ø      Close the window.
Ø      Enter the data in the table.


Adding two more fields in Table.
Ø      Right click on the table named Mark.
Ø      Select Edit from menu.
Ø      Add the following fields.
Field Name: Result
Field Type: Text
Length: 20
Field Name: Comment
Field Type: Text
Length: 30
Now the Table Design Window looks like this,

Ø      Select File Save from menu or use “Ctrl + S” keys.
Ø      Press Yes for save the table.



To create form.
Ø      Click on form icon.
Ø      Select “Use wizard to create Form”.
Ø      Select Table Name as Mark, so that Field name will appear in Text area
Ø      Press >> button to select all the fields then click Next button.
Ø      Select style as Column Oriented then click Next button.
Ø      Select Page Style as 3D Effect then click Next button.
Ø      Click on Finish button.

Now the Form is ready to view the output.
RESULT:

                 
9. STUDENTS MARK LIST DATABASE AND SORTING

QUESTION:
Create a students mark list database file with the following fields.
            1. Reg.No.       2. Name           3. Tamil            4. English          5.Maths
            6. Science        7. Social           8. Total            9. Average
Enter data to the database file. Then sort the database by any one of the fields by ascending or descending.
AIM:
    1. To create the student mark list database.
    2. Sort the file both ascending and descending.

PROCEDURE:
In StarOffice Base click on Create a new database and click Finish. To save the database give the file name & click save.

Now you get a Database Window.
Ø      Click on Table icon in the data base pane.
Ø      Click on “Create Table in Design View”.
Ø      Enter the following fields respectively.
Field Name: Reg. No.
Field Type: Number

Field Name: Name
Field Type: Text
Length: 30
Field Name: Tamil
Field Type: Number

Field Name: English
Field Type: Number

Field Name: Maths
Field Type: Number

Field Name: Science
Field Type: Number

Field Name: Social
Field Type: Number

Field Name: Total
Field Type: Number

Field Name: Average
Field Type: Number

Field Name: Result
Field Type: Text
Length: 20
Field Name: Comment
Field Type: Text
Length: 20
Ø      Select File  Save, from menu.
Ø      Enter Mark as a table name in Save As dialog box.
Ø      Press Yes for Primary key setting.
Ø      Enter the data into the Table.


Now the Table Design Window looks like this,
Ø      Select File Save from menu.
Ø      Press Yes for save the table.


To Sort data in Ascending or Descending Order:
Ø      Click on the Required Field Header
Ø      Press   or    icons for Ascending or Descending Order.







RESULT:
Ascending order by the field of Name,





10.             PRESENTATION ABOUT SCHOOL

QUESTION:
Create a Presentation with five slides describing your school. Change the background and fonts.
AIM:  
            To create a Presentation with five slides describing your school. Change the background and fonts.
PROCEDURE:
            To enter into StarOffice Impress.
            Start  All Programs  StarOffice8  StarOffice Impress.
To create a Presentation.
  1. Select Empty presentation in presentation wizard 1 click Next.
  2. In presentation wizard 2, select Screen as out medium click Next.
  3. In presentation wizard 3, click Create.
*In the Presentation window
  1. Task pane  Layout  Select Layout.
  2. Click on “Click to add title” and enter the name of your school.
  3. Click on “Click to add text” and enter a sentence about your school.
  4. To insert four more slides, Select the blank slide in the layout. In menu bar
      Insert  Slide (four times).
  1. In slide pane, select the second slide and Insert text by selecting  icon from the drawing toolbar & Insert a text box.
  2. Enter a sentence about your school and apply formatting options.
  3. Repeat the above steps for other blank slides.
  4. Under Task pane  Select Slide Transition Select Automatically after.
  5. Under Advanced Slide  Click Apply to all slides Click Slide Show.
  6. Click to exit presentation.
  7. Select Slide 1 Format  Page  Background  Select gradient, select a gradient style and click OK.
In the page setting dialog box.
Click Yes to change background setting for all slides else, click NO for one slide alone.


To change the Font.
Select Format   Character.
Click on Font tab.
Change the Font style, Font face and size and click OK.
For Presentation.
Click Slide Show  Slide Show.


RESULT:


     11.  PRESENTATION USING TEMPLATES

QUESTION:

Create a presentation using templates and display the function of StarOffice using bullets in the created slide.

AIM:

To create a presentation using templates and display the function of StarOffice using bullets in the created slide.

PROCEDURE:
            To enter into StarOffice Impress.
            Start  All Programs  StarOffice8  StarOffice Impress.
In Presentation Wizard 1
Select from template click Create.
File  New  Templates & Documents.
Select the title Education.
In templates select Academic Presentation.
Click Open.
In slides pane, there will be 9 slides.
Delete all slides except overview.
To delete the slide select the slide & right click  Delete Slide.
In the presentation view,
Click Overview and enter the functions of Star Office.
Click the bulleted list & type the following
  • Star Office Writer.
  • Star Office Calc.
  • Star Office Base.
  • Star Office Draw.
  • Star Office Impress.
In menu bar click Slide Show  Slide Show.






                                          











                     12. DAYS OF THE WEEK WITH PICTURES AND SOUND

QUESTION:
Create a Presentation to display the days of the week in individual slide and sort them. Insert appropriate picture and sound.
AIM:  
            To create a Presentation to display the days of the week in individual slide and sort them. Insert appropriate picture and sound.
PROCEDURE:
            To enter into StarOffice Impress.
            Start  All Programs  StarOffice8  StarOffice Impress.
In Presentation Wizard , Select Empty presentation in presentation wizard 1 and click Next.
In presentation wizard 2, click Next.
In presentation wizard 3, click Create.
Click  9th  Item under Layout. (Title, Clipart, Text)
Click on “Click to add title” and enter the text “MONDAY”.
Click on “Click to add an outline” and enter the description of the outlay.
Apply formatting options on the text.
To insert a picture in the slide, choose Insert  Picture  From File, or click the Insert Picture icon from the Insert Toolbar. Choose the desired picture to be inserted form the open dialog box, and that is inserted on the slide.
To insert a sound or a movie in a slide, choose Insert  Movie and Sound or click the Insert Movie and Sound icon from the Insert toolbar.
Repeat the same process for seven days of the week.
Select Slide Transition under Task pane.
Select automatically after to fix Timing  Click Apply to all slides  Click Slide Show.

FOR SLIDE SORTING

Click slide sorter from switching presentation view tab.
Click the slide to move and drag it to the desired position.


                                             
     RESULT:                                    

                                                       CONTENTS

                                           SECTION B

Problem No.
Problem Description
Page no.
1.
Fibonacci Series.
36
2.
Factorial of a Number – Using function.
37
3.
Number in Words – Using Switch.
38
4.
Palindrome.
39
5.
Number of Odd and Even Numbers.
40
6.
Transpose of 3x3 Matrix.
41
7.
Addition of Two matrices.
43
8.
Prime Number.
45
9.
Net Pay – Using Classes.
46
10.
Maximum of Two Numbers or Three numbers – Using Overloading.
48
11.
Sum and Difference of Two Numbers – Using Inheritance.
50
12.
Display a Sting Pattern.
53
                                                  C++
PROCEDURE FOR EXECUTING C++ PROGRAMS.

1.     TO ENTER A PROGRAM: DOUBLE CLICK THE TURBO C++ ICON. FILE  NEW
2.     TO SAVE THE PROGRAM: ALT + F  SAVE (OR) F2, FILE NAME SHOULD BE WITH THE EXTENSION OF .CPP
3.     TO COMPILE THE PROGRAM: ALT + C (OR) ALT + F9.
4.     IF YOUR CODING DOES NOT HAVE SYNTAX ERROR, A MESSAGE BOX SHOWING “SUCCESS: PRESS ANY KEY” WILL BE DISPLAYED.
TO EXECUTE THE PROGRAM: ALT + R (OR) CTRL + F9.


BEST OF LUCK.
       C++ PROGRAMS
1.     FIBONACCI SERIES

PROBLEM:
Write the C++ program to generate the Fibonacci Series for n terms.
AIM:
To write a C++ program to generate the Fibonacci Series for n terms.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
void main ()
{
int x1=-1, x2=1, x3, n;
clrscr();
cout<< ”\nEnter the number of terms….”;
cin>> n;
for (int i=0: i<n: i++)
{
 x3=x1 + x2;
cout<<”\n”<<x3;
x1=x2;
x2=x3;
}
getch();
}

EXECUTION & OUTPUT:

Enter the number of terms ….. 10
0
1
1
2
3
5
8
13
21
34




2.     factorial of the number

PROBLEM:
Write the C++ program using function to the factorial of the number of a given number.
AIM:
To write a C++ program using function to the factorial of the number of a given number.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
long int fact(int x)
{
long int f=1, i;
for(i=1; i<=x; i++)
f*=i;
return (f);
}
void main()
{
int n;
clrscr();
cout<< ”\nEnter the number …..” ;
cin>> n;
cout<< ”\The Factorial of “<<n<<” is “<<fact(n);
getch();
}

EXECUTION & OUTPUT:

Enter the number …. 12
The Factorial of 12 is 479001600.




3.     NUMBERS IN WORDS.

PROBLEM:
Write the C++ program using SWITCH CASE structure to display the given number in words. (Enter number between 1 – 9).
AIM:
To write a C++ program using SWITCH CASE structure to display the given number in words.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
void main ()
{
int n;
clrscr();
cout<< ”\nEnter the number ….”;
cin>> n;
switch (n)
{
case 1 : cout<<”\nThe number is One.” ; break;
case 2 : cout<< ”\nThe number is Two.” ; break;
case 3 : cout<< ”\nThe number is Three.” ; break;
case 4 : cout<< ”\nThe number is Four.” ; break;
case 5 : cout<< ”\nThe number is Five.” ; break;
case 6 : cout<< ”\nThe number is Six.” ; break;
case 7 : cout<< ”\nThe number is Seven.” ; break;
case 8 : cout<< ”\nThe number is Eight.” ; break;
case 9 : cout<< ”\nThe number is Nine.” ; break;
default : cout<< ”\n Invalid number” ;
}
getch();
}

EXECUTION & OUTPUT:

Enter the number…. 8
The number is Eight.


4.     PALINDROME.

PROBLEM:
Write the C++ program to check whether the given string is PALINDROME or NOT.
AIM:
To write a C++ program to check whether the given string is PALINDROME or NOT.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main ()
{
clrscr();
char str1[50], rstr[50], ch;
int i, k;
cout<< ”\nEnter the string ….”;
cin>> strl;
strcpy(rstr, strl);
k=strlen(strl);
for(i=0; i<k/2; i++)
{
ch=rstr[i];
rstr[i]=rstr[k-i-l];
rstr[k-i-l]=ch;
}
if(strcmp(strl, rstr))
cout<< ”\n”<<strl<<”is not a PALINDROME.”;
else
cout<< “\n”<<strl<<”is a PALINDROME.”;
getch();
}

EXECUTION & OUTPUT:

Enter the string …… MADAM
MADAM is a PALINDROME.
Enter the string …… TAMILNADU
TAMILNADU is not a PALINDROME.


5.     NUMBER OF ODD AND EVEN NUMBERS.

PROBLEM:
Write the C++ program to find the number of Odd and Even numbers in a given array.
AIM:
To write a C++ program to find the number of Odd and Even numbers in a given array.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
void main ()
{
clrscr();
int x[50], n, odd=0, even=0;
cout<< ”\nEnter the number of values ….”;
cin>> n;
for(int i=0; i<n; i++)
{
cout<< “\nEnter the value of x[i]….”;
cin>>x[i];
if(x[i]%2==0)
++even;
else
++odd;
}
cout<< “\nThere are “<<odd<<” Odd numbers in the given array of values.”;
cout<< “\nThere are “<<even<<” Even numbers in the given array of values.”;
getch();
}

EXECUTION & OUTPUT:
Enter the number of values…. 5
Enter the value of x[1] …. 2
Enter the value of x[2] …. 3
Enter the value of x[3] …. 4
Enter the value of x[4] …. 5
Enter the value of x[5] …. 6
There are 2 Odd numbers in the given array of values.
There are 3 Even numbers in the given array of values.


6.     TRANSPOSE OF 3x3 MATRIX.

PROBLEM:  Write the C++ program to transpose a 3x3 matrix.
AIM:  To write a C++ program to transpose a 3x3 matrix.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
void getmatrix (int a[3][3])
{
clrscr();
for(int i=0; i<3; i++)
{
  for(int j=0; j<3; j++)
{
cout<< “\nEnter the value of A[“<<i+1<<”] [“<<j+1<<”]….”;
cin>> a[i][j];
}
}
}
void transpose (int a[3][3])
{
    for(int i=0; i<3; i++)
{
  for(int j=0; j<3; j++)
   {
cout<<a[i][j]<<”\t”;
   }
   cout<<”\n”;
}
}
void main()
{
int x[3][3];
cout<<”\nEnter the first matrix values….”;
getmatrix (x);
cout<<”\nThe Transposed matrix is ….\n”;
transpose (x);
getch();
}



EXECUTION & OUTPUT:
Enter the value of a[1][1] …. 1
Enter the value of a[1][2] …. 2
Enter the value of a[1][3] …. 3
Enter the value of a[2][1] …. 4
Enter the value of a[2][2] …. 5
Enter the value of a[2][3] …. 6
Enter the value of a[3][1] …. 7
Enter the value of a[3][2] …. 8
Enter the value of a[3][3] …. 9

The Transposed matrix is…
1          4          7
2          5          8         
3          6          9



7.     ADDITION OF TWO MATRIX.

PROBLEM:  Write the C++ program to add two 3x3 matrix.
AIM:  To write a C++ program to add two 3x3 matrix.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
void main ()
{
int a[3][3], b[3][3], c[3][3];
int i,j;
clrscr();
for(i=0; i<3; i++)
{
for(j=1; j<3; j++)
{
cout<< ”\nEnter the value of A[“<<i+1<<”] [“<<j+1<<”]”;
cin>> a[i][j];
}
    }
for(i=0; i<3; i++)
{
for(j=1; j<3; j++)
{
cout<< ”\nEnter the value of B[“<<i+1<<”] [“<<j+1<<”]”;
cin<< b[i] [j];
}
}
cout<< “\n”;
cout<< “RESULTANT MATRIX\n\n”;
for(i=0; i<3; i++)
{
for(j=1; j<3; j++)
{
c[i][j]=a[i][j] +b[i][j];
cout<<c[i][j]<<”\t”;
}
cout<<”\n”;
}
getch();
}
EXECUTION & OUTPUT:
Enter the value of A[1][1] …. 1
Enter the value of A[1][2] …. 2
Enter the value of A[1][3] …. 3
Enter the value of A[2][1] …. 4
Enter the value of A[2][2] …. 5
Enter the value of A[2][3] …. 6
Enter the value of A[3][1] …. 7
Enter the value of A[3][2] …. 8
Enter the value of A[3][3] …. 9
Enter the value of B[1][1] …. 9
Enter the value of B[1][2] …. 8
Enter the value of B[1][3] …. 7
Enter the value of B[2][1] …. 6
Enter the value of B[2][2] …. 5
Enter the value of B[2][3] …. 4
Enter the value of B[3][1] …. 3
Enter the value of B[3][2] …. 2
Enter the value of B[3][3] …. 1

RESULTANT MATRIX
10        10        10
10        10        10
10        10        10


8.     PRIME NUMBER.

PROBLEM: 
Write the C++ program using function to determine whether the given number is Prime or Not.
AIM: 
To write a C++ program using function to determine whether the given number is Prime or Not.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
void prime(int x)
{
for (int i=2; i<=x/2; i++)
if (x % i == 0)
{
cout<< x << “ is Not a Prime Number.”;
return;
}
cout<< x << “ is a Prime Number.”;
return;
 }
void main()
{
int n;
clrscr();
cout<< “\nEnter the Number….”;
cin>> n;
prime(n);
getch();
}

EXECUTION & OUTPUT:
Enter the Number …. 23
23 is a Prime Number.

Enter the Number…. 25
25 is Not a Prime Number.


9.     NET PAY.

PROBLEM: 
Write the C++ program to define a class employee with following specification.
Private members of the class employee
Empno – integer
Ename – 20 characters
Basic – float
Netpay, hra, da, float

Calculate() – A function to find the basic + da + hra+ with float return type.
Public member functions.
havedata() – A function to accept values for empno, ename, basic, hra, da and call.
calculate() to compute netpay.
      disdata() – A function to display all the data members on the screen.
AIM: 
To write a C++ program to find out the net pay of an employee using classes.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
class employee
{
private :
int empno;
char ename[20];
float basic, netpay, hra, da;
public:
float calculate()
{
        float netpay;
netpay = basic + da + hra;
return netpay;
 }
void havedata()
{
cout<< “\n\n\nEnter the Emp. Name, Emp. No. , Basic pay, DA, HRA .…”;
cin>> ename >> empno >> basic >> da >> har;
netpay = calculate();
}

void disdata()
{
cout << “\nEmployee Name       : “ << ename;
cout << “\nEmployee Number    : “ << empno;
cout << “\nEmployee Basic Pay : “ << basic;
cout << “\nEmployee DA           : “ << da;
cout << “\nEmployee HRA         : “ << hra;
cout << “\nEmployee Netpay      : “ << netpay;
}
};
void main()
{
clrscr();
employee emp;
emp.havedata();
emp.disdata();
getch();
}

EXECUTION & OUTPUT:
Enter the Emp. Name, Emp. No. , Basic pay, DA, HRA …. SEKAR
1005
4500
1200
900

Employee Name      : SEAKR
Employee Number   : 1005
Employee Basic Pay: 4500
Employee DA          : 1200
Employee HRA        : 900
Employee Netpay     : 6600


10.                          MAXIMUM OF TWO NUMBERS OR THREE NUMBERS.

PROBLEM: 
Write the C++ program that uses function overloading to do the following tasks,
a)          Find the maximum of two numbers (integers).
b)          Find the maximum of three numbers (integers).
AIM: 
To write a C++ program to find the maximum of two numbers (integers) OR find the maximum of three numbers (integers) using overloading.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
void max (int a, int b)
{
if (a > b)
cout << “\nThe maximum value is ….” << a;
else
cout << “\nThe maximum value is ….” << b;
return;
}
void max (int a, int b, int c)
{
if (a > b && a >c)
cout << “\nThe maximum value is ….” << a;
if (b > a && b >c)
cout << “\nThe maximum value is ….” << b;
if (c > a && c > b)
cout << “\nThe maximum value is ….” << c;
return;
}
void main()
{
int a, b, c, ch = 0;
clrscr();
cout << “\n1. Maximum of two numbers.”;
cout << “\n\n2. Maximum of three numbers”;
cout << “\n\nEnter your choice …”;
cin >> ch;
switch(ch)
{
case 1:
cout << “\n\nEnter the two numbers.\n”;
cin >> a >> b;
max (a, b);
break;
case 2:
cout << “\n\nEnter the three numbers.\n”;
cin >> a >> b >> c;
max (a, b, c);
break;
}
getch();
}

EXECUTION & OUTPUT:
1.          Maximum of two numbers.
2.          Maximum of three numbers.

Enter your choice… 1

Enter the two numbers.
23
10

The maximum value is …. 23

1.          Maximum of two numbers.
2.          Maximum of three numbers.

Enter your choice… 2

Enter the three numbers.
23
17
78

The maximum value is … 78


11.                          SUM AND DIFFERENCE.

PROBLEM: 
Write the C++ program to find the sum and difference of two numbers using inheritance,

Add
Subtract
Public
add(), accept(), plus()
subtract(), minus()
Private
sum()
sub()
Protected
num1, num2


AIM: 
To write a C++ program to find the sum and difference of two numbers using inheritance.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
class add
{
int sum;
protected: int num1, num2;
public:
add()
{
num=num2=sum=0;
cout << “\nAdd Constructor…”;
}
void accept()
{
cout << “\nEnter two numbers…”;
cin >> num1 >> num2;
}
void plus()
{
sum= num1+num2;
cout <<  “\nThe sum of “<< num1<<” and “<<num2<<” is “<<sum.;
}
};
class subtract: public add
{
int sub;
public:
subtract()
{
sub=0;
cout << “\nSubtract Constructor…”;
}
void minus()
{
add::accept();
sub=num1-num2;
cout << “\nThe difference of “<<num1<<” and “<<num2<<” is <<sub.;
}
};
void main()
{
subtract s;
int ch=0;
clrscr();
cout << “\n1. Add. \n2. Subtract. \n”;
cout << “\nEnter your choice…”
cin >> ch;
 switch (ch)
{
case 1:
s.accept();
s.plus();
break;
case 2:
s.minus();
break;
}
getch();
}

EXECUTION & OUTPUT:
1.          Add.
2.          Subtract.

Enter your choice… 1

Enter the two numbers…
34
45

The sum of 34 and 45 is 79.

1.          Add.
2.          Subtract.

Enter your choice… 2

Enter the two numbers…
56
28
The difference of 56 and 28 is 28.


12.                          DISPLAY A STRING PATTERN.

PROBLEM: 
Write the C++ program to get the following output,
C
CO
COM
COMP
COMPU
COMPUT
COMPUTE
COMPUTER
AIM: 
To write a C++ program to display a STRING PATTERN.
PROGRAM CODING:        
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
int i;
char str[] = “COMPUTER”;
for(i=0; i <= strlen(str); i++)
{
cout.writ(str,i);
cout << “\n”;
}
getch();
}

EXECUTION & OUTPUT:

C
CO
COM
COMP
COMPU
COMPUT
COMPUTE
COMPUTER

1 comment:

  1. can u help me? i need an academic presentation for staroffice n m having exam tomorrow so kindly do it fast plz!!!!

    ReplyDelete