Sie sind auf Seite 1von 60

B.S.

ABDUR RAHMAN U N I V E R S I T Y

COMPUTER PROGRAMMING CAD/CAM LABORATORIES (BMEL-003) PRACTICAL NOTE BOOK

ENROLMENT No. COURSE TITLE STUDY CENTRE NAME NAME B. Tech. in Mechanical Engineering B.S.ABDUR RAHMAN UNIVERSITY

DATE:

COURS E CODE

BTME

CENTR E CODE

SIGNATURE

INDIRA GANDHI NATIONAL OPEN UNIVERSITY


School of Engineering and Technology Maidan Garhi, New Delhi-110 068

B.S. ABDUR RAHMAN U N I V E R S I T Y

INDIRA GANDHI NATIONAL OPEN UNIVERSITY


PRACTICAL NOTE BOOK
BONAFIDE CERTIFICATE Certified bonafide record of work done by second year B.Tech. In Mechanical Engineering Roll No for practical lab COMPUTER PROGRAMMING CAD/CAM LABORATORIES (BMEL 003) of

Date :

Lab In Charge

The Practical examination for COMPUTER PROGRAMMING CAD/CAM LABORATORIES (BMEL 003) is held on date.

Internal Examiner

External Examiner
2

INDEX
EX. No
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

DATE

NAME OF THE EXPERIMENT


PROGRAM FOR ADDITION & MULTIPLICATION PROGRAM FOR SUBRACTION & DIVISION PROGRAM FOR SUM & AVERAGE OF n NUMBERS PROGRAM TO FIND AREA & PERIMETER OF A RECTANGLE PROGARM TO CALCUALTE SIMPLE INTEREST PROGRAM TO FIND STUDENTS MARK SYSTEM PROGARM TO FIND THE BIGGEST NUMBER AMONG THE THREE NUMBERS PROGARM TO FIND THE CIRCUMFERENCE OF A CIRCLE PROGARM TO FIND THE VOLUME OF A CYLINDER PROGRAM TO FIND THE CENTROID OF THREE SECTIONS PROGARM TO FIND THE CENTROID OF AN I - SECTION PROGARM TO CREATE A LINE FOR THE GIVEN POINTS PROGRAM TO CREATE A RECTANGLE PROGARM TO CREATE A CIRCLE PROGARM TO CREATE AN ELLIPSE TO FIND THE MASS PROPERTIES OF A GIVEN OBJECT IN SOLIDWORKS

PAGE No

Experiment No: 1

Date:

.11

PROGRAM FOR ADDITION & MULTIPLICATION


Aim: To write a C++ program to find the sum and multiplication of given three numbers. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 1

Date:

.11

PROGRAM FOR ADDITION & MULTIPLICATION

Program: /*Program for addition and multiplication*/ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("\t\t\tProgram for addition & multiplication\n"); printf("\t\t----------------------------------\n") ; int first,second,third,add,mul; printf("Enter first number:"); scanf("%d",&first); printf("\nEnter second number:"); scanf("%d",&second); printf("\nEnter third number:"); scanf("%d",&third); add=first+second+third; mul=first*second*third; printf("\nThe sum of numbers =%d",add); printf("\nThe product of numbers =%d\n",mul);

getch(); }

Experiment No: 1

Date:

.11

PROGRAM FOR ADDITION & MULTIPLICATION

Result: Program for addition & multiplication ------------------------------------Enter first number:25 Enter second number:30 Enter third number:50 The sum of numbers =105 The product of numbers =37500

Experiment No: 2

Date:

.11

PROGRAM FOR SUBRACTION & DIVISION


Aim: To write a C++ program to find the difference and division of given two numbers. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 2

Date:

.11

PROGRAM FOR SUBRACTION & DIVISION


Program: /*Program for Subtraction and Division*/ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("\t\t\tProgram for Subtraction & Division\n"); printf("\t\t----------------------------------\n") ; int first,second,sub,div; printf("Enter first number:"); scanf("%d",&first); printf("\nEnter second number:"); scanf("%d",&second); sub=second-first; div=second/first; printf("\n\nThe difference between two numbers = %d\n",sub);

printf("The division of two numbers =%d\n",div); getch(); }

Experiment No: 2

Date:

.11

PROGRAM FOR SUBRACTION & DIVISION


Result: Program for Subtraction & Division ---------------------------------Enter first number:30 Enter second number:90 The difference between two numbers =60 The division of two numbers =3

Experiment No: 3

Date:

.11

PROGRAM FOR SUM & AVERAGE OF n NUMBERS


Aim: To write a C++ program to find the sum and average of n numbers. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 3

Date:

.11

PROGRAM FOR SUM & AVERAGE OF n NUMBERS


Program: /*Program for Sum & Average of n numbers*/ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("t\t\tProgram for Sum and Average of n numbers\n"); printf("\t\t----------------------------------\n") ; int n,sum,avg,i,j; printf("Enter the no. of numbers:"); scanf("%d",&n); sum=0; avg=0; printf("\nEnter %d numbers one by one\n",n); for(i=0; i<n;i++) { scanf("%d\n",&j); sum=sum+j; } printf("\nThe Sum of %d numbers =%d",n,sum);

avg=sum/n;

Experiment No: 3

Date:

.11

PROGRAM FOR SUM & AVERAGE OF n NUMBERS


printf("\nThe Average of %d numbers =%d",n,avg); getch(); } Result: Program for Sum and Average of n numbers --------------------------------------Enter the no. of numbers:5 Enter the 5 numbers one by one 85 70 93 90 77 The Sum of 5 numbers =415 The Average of 5 numbers =83

Experiment No: 4

Date:

.11

PROGRAM TO FIND AREA & PERIMETER OF A RECTANGLE


Aim: To write a C++ program to find the area and perimeter of a rectangle. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed.

Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 4

Date:

.11

PROGRAM TO FIND AREA & PERIMETER OF A RECTANGLE


Program: /*Program to find Area and Perimeter of a rectangle*/ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("t\t\tProgram to find Area and Perimeter of a Rectangle\n");

printf("\t\t-------------------------------------------------\n"); int l,b,area,perimeter; printf("Enter the Length of the Rectangle:"); scanf("%d",&l); printf("\nEnter the Breadth of the Rectangle:"); scanf("%d",&b); area=l*b; perimeter=2*(l+b); printf("\nThe Area of the Rectangle =%d\n", area); printf("The Perimeter of the Rectangle =%d\n",perimeter); getch(); } Experiment No: 4 Date: . .11

PROGRAM TO FIND AREA & PERIMETER OF A RECTANGLE


Result: Program to find Area and Perimeter of a Rectangle ------------------------------------------------Enter the Length of the Rectangle:100 Enter the Breadth of the Rectangle:60

The Area of the Rectangle =6000 The Perimeter of the Rectangle =320

Experiment No: 5

Date:

.11

PROGARM TO CALCUALTE SIMPLE INTEREST


Aim: To write a C++ program to find simple interest. Software Used: Turbo C++

Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 5

Date:

.11

PROGARM TO CALCUALTE SIMPLE INTEREST


Program: /*Program to find Simple Interest*/ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("t\t\tProgram to find Simple Interest\n"); printf("\t\t------------------------------\n"); float p,n,r,si; printf("Enter Principal Amount:"); scanf("%f",&p); printf("\nEnter Number of Years:"); scanf("%f",&n); printf("\nEnter Rate of Interest:"); scanf("%f",&r); si=p*n*r/100; printf("\n\nSimple Interest = %f\n",si); getch(); }

Experiment No: 5

Date:

.11

PROGARM TO CALCUALTE SIMPLE INTEREST


Result: Program to find Simple Interest -------------------------------Enter Principal Amount:15000 Enter Number of Years:4 Enter Rate of Interest:7.5 Simple Interest =450.0000

Experiment No: 6

Date:

.11

PROGRAM TO FIND STUDENTS MARK SYSTEM


Aim: To write a C++ program to find students mark system. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied.

Finally the output is shown in the screen.

Experiment No: 6

Date:

.11

PROGRAM TO FIND STUDENTS MARK SYSTEM


Program: /*Program for finding students mark system*/ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("t\tProgram for finding Students Mark System\n"); printf("\t\t---------------------------------\n");

int i,n,total,name,mark; float avg; printf("Enter Student's name:"); scanf("%s",&name); printf("\nEnter Total Number of Subjects:"); scanf("%d\n",&n); total=0; for(i=1;i<=n;i++) { printf("Enter Subject %d Mark =",i); scanf("%d",&mark); if(mark<40) printf("\t\t\t\tSubject %d FAIL\n",i); Experiment No: 6 Date: . .11

PROGRAM TO FIND STUDENTS MARK SYSTEM


else printf("\t\t\t\tSubject %d PASS\n",i); total=mark+total; } printf("\nTotal Marks =%d",total); getch(); } Result:

Program for finding Students Mark system --------------------------------------Enter Students name: RAGUNATH P Enter Total Number of Subjects:5 Enter Subject 1 Mark =85 Subject 1 PASS Enter Subject 2 Mark =70 Subject 2 PASS Enter Subject 3 Mark =35 Subject 3 FAIL Enter Subject 4 Mark =75 Subject 4 PASS Enter Subject 5 Mark =30 Subject 5 FAIL Total Marks =295

Experiment No: 7

Date:

.11

PROGARM TO FIND THE BIGGEST NUMBERS AMONG THE THREE NUMBERS


Aim: To write a C++ program to find the biggest numbers among the three numbers. Software Used: Turbo C++ Procedure:

Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 7

Date:

.11

PROGARM TO FIND THE BIGGEST NUMBERS AMONG THE THREE NUMBERS

Program: /*Program for finding the biggest numbers among the three numbers */ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("t\t\tProgram for finding the Biggest Number\n"); printf("\t\t-------------------------------\n"); int a,b,c; printf("Enter the three numbers:"); scanf("%d %d %d",&a,&b,&c); if(a>b) { if(a>c) { printf("\n%d is the Biggest Number",a); } else printf("\n%d is the Biggest Number",c); }

Experiment No: 7

Date:

.11

PROGARM TO FIND THE BIGGEST NUMBERS AMONG THE THREE NUMBERS


else { if(c>b) { printf("\n%d is the Biggest Number",c); } else { printf("\n%d is the Biggest Number",b); } } getch(); } Result: Program for finding the Biggest Number -------------------------------------Enter the three numbers:50 270 -300 270 is the Biggest Number

Experiment No: 8

Date:

.11

PROGARM TO FIND THE CIRCUMFERENCE OF A CIRCLE


Aim: To write a C++ program to find the circumference of a circle. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed.

Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 8

Date:

.11

PROGARM TO FIND THE CIRCUMFERENCE OF A CIRCLE


Program: /*Program to find the Circumference of a Circle*/ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("t\t\tProgram to find the Circumference of a Circle\n");

printf("\t\t------------------------------------\n"); float radius,circum; float pi=3.14; printf("Enter the Radius of the Circle:"); scanf("%f",&radius); circum=2*pi*radius; printf("\nThe Circumference = %f\n",circum); getch(); }

Experiment No: 8

Date:

.11

PROGARM TO FIND THE CIRCUMFERENCE OF A CIRCLE


Result: Program for finding the Biggest Number ------------------------------------Enter the Radius of the Circle:15 The Circumference =94.200005

Experiment No: 9

Date:

.11

PROGARM TO FIND THE VOLUME OF A CYLINDER


Aim: To write a C++ program to find the volume of a cylinder. Software Used: Turbo C++ Procedure:

Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 9

Date:

.11

PROGARM TO FIND THE VOLUME OF A CYLINDER


Program: /*Program to find the Volume of a Cylinder*/ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("t\t\tProgram to find the Volume of a Cylinder\n"); printf("\t\t----------------------------------------\n"); float radius,hight,volume; float pi=3.14; printf("Enter the Radius of the Cylinder:"); scanf("%f",&radius); printf("\nEnter the Height of the Cylinder:"); scanf("%f",&hight); volume=pi*radius*radius*hight; printf("\n\nThe Volume of the Cylinder =%f\n",volume); getch(); }

Experiment No: 9

Date:

.11

PROGARM TO FIND THE VOLUME OF A CYLINDER


Result: Program to find the Volume of a Cylinder --------------------------------------Enter the Radius of the Cylinder:30 Enter the Height of the Cylinder:80 The Volume of the Cylinder =226194.671059

Experiment No: 10

Date:

.11

PROGRAM TO FIND THE CENTROID OF THREE SECTIONS


Aim: To write a C++ program to find the Centroid of three Sections. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends.

By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 10

Date:

.11

PROGRAM TO FIND THE CENTROID OF THREE SECTIONS


Program: /*Program for finding Centroid*/ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("t\t\tProgram for finding Centroid of three Sections\n");

printf("\t\t----------------------------------------------\n"); int n; float a1,a2,a3,x1,x2,x3,centroid1,centroid 2, centroid3; printf("Enter the Number of Sections:"); scanf("%d",&n); { printf("\nEnter the Area of First Section:"); scanf("%f",&a1); printf("\nEnter the Area of Second Section:"); scanf("%f",&a2); printf("\nEnter the Area of Third Section:"); scanf("%f",&a3);

Experiment No: 10

Date:

.11

PROGRAM TO FIND THE CENTROID OF THREE SECTIONS


printf("\n\nEnter the X1 Value:"); scanf("%f",&x1); printf("\nEnter the X2 Value:"); scanf("%f",&x2); printf("\nEnter the X3 Value:");

scanf("%f",&x3); centroid1=(a1*x1)/a1; centroid2=(a1*x1+a2*x2)/(a1+a2); centroid3=(a1*x1+a2*x2+a3*x3)/ (a1+a2+a3); printf("\n\nThe Centriod of 1 Section =%f", centroid1); printf("\nThe Centriod of 2 Section =%f", centroid2); printf("\nThe Centriod of 3 Section =%f", centroid3); } getch(); }

Experiment No: 10

Date:

.11

PROGRAM TO FIND THE CENTROID OF THREE SECTIONS


Result: Program for finding Centroid of three Sections

--------------------------------------------Enter the Number of Sections:3 Enter the Area of First Section:750 Enter the Area of Second Section:830 Enter the Area of Third Section:600 Enter the X1 Value:80 Enter the X1 Value:100 Enter the X1 Value:150 The Centriod of 1 Section =80.000000 The Centriod of 2 Section =90.506332 The Centriod of 3 Section =106.880737

Experiment No: 11

Date:

.11

PROGRAM TO FIND THE CENTROID OF AN I - SECTION


Aim:

To write a C++ program to find the centroid of an I section. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 11

Date:

.11

PROGRAM TO FIND THE CENTROID OF AN I - SECTION


Program: /*Program for finding Centroid of Isection*/ #include<stdio.h> #include<string.h> #include<math.h> #include<conio.h> main() { clrscr(); printf("t\t\tProgram for finding Centroid of I-Section\n"); printf("\t\t-----------------------------------------\n"); float l1,b1,l2,b2,l3,b3,a1,a2,a3,x1,x2,x3, y1,y2,y3, centroidX,centroidY; printf("Enter the Length & Breadth of Rectangle a1=l1*b1; printf("\nThe Area of Rectangle of section 1 =%f\n\n",a1); of Section 1 ="); scanf("%f %f",&l1,&b1);

printf("Enter the Length & Breadth of Rectangle a2=l2*b2; of Section 2 ="); scanf("%f %f",&l2,&b2);

Experiment No: 11

Date:

.11

PROGRAM TO FIND THE CENTROID OF AN I - SECTION


printf("\nThe Area of Rectangle of Section 2 =%f\n\n",a2); printf("Enter the Length & Breadth of Rectangle a3=l3*b3; printf("\nThe Area of Rectangle of Section 3 =%f\n\n",a3); printf("Enter X Values\n"); printf("Enter X1 Value:"); scanf("%f",&x1); printf("\nEnter X2 Value:"); scanf("%f",&x2); printf("\nEnter X3 Value:"); scanf("%f",&x3); printf("\n\nEnter Y Values\n"); printf("Enter Y1 Value:"); scanf("%f",&y1); printf("\nEnter Y2 Value:"); scanf("%f",&y2); printf("\nEnter Y3 Value:"); of Section 3 ="); scanf("%f %f",&l3,&b3);

scanf("%f",&y3); centroidX=(a1*x1+a2*x2+a3*x3)/ (a1+a2+a3); centroidY=(a1*y1+a2*y2+a3*y3)/ (a1+a2+a3);

Experiment No: 11

Date:

.11

PROGRAM TO FIND THE CENTROID OF AN I - SECTION


printf("\n\nThe Centriod of ISection with ref. to X-axis = %f",centroidX); printf("\nThe Centriod of I-Section with ref. to Y-axis =%f",centroidY); getch(); } Result: Program for finding Centroid of ISection ---------------------------------------Enter the Length & Breadth of Rectangle of Section 1 =100 20 The Area of Rectangle of Section 1 =2000.000000

Enter the Length & Breadth of Rectangle of Section 2 =20 80 The Area of Rectangle of Section 2 =1600.000000 Enter the Length & Breadth of Rectangle of Section 3 =100 20 The Area of Rectangle of Section 3 =2000.000000 Enter X Values Enter X1 Value:10 Enter X2 Value:50 Enter X3 Value:80 Experiment No: 11 Date: .

.11

PROGRAM TO FIND THE CENTROID OF AN I - SECTION


Enter Y Values Enter Y1 Value:50 Enter Y2 Value:10 Enter Y3 Value:50 The Centriod of I-Section with ref. to X-axis =46.428570 The Centriod of I-Section with ref. to

Y-axis =38.571430

Experiment No: 12

Date:

.11

PROGARM TO CREATE A LINE FOR THE GIVEN POINTS


Aim: To write a C++ program to find create a line for the given points. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software.

The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 12

Date:

.11

PROGARM TO CREATE A LINE FOR THE GIVEN POINTS


Program:

/*Program For Creating A Line For The Given Points*/ #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<graphics.h> main() { clrscr(); printf("t\t\tProgram for creating a line for the given points\n"); printf("\t\t------------------------------------------------\n"); int xmin,xmax,ymin,ymax; printf("Graphics driver initialization - Please include the C program directory\n"); int gdriver=DETECT,gmode,errorcode; initgraph(&gdriver,&gmode,"C:\TC"); setcolor(BLUE); printf("Enter X start point:"); scanf("%d",&xmin); printf("\nEnter Y start point:"); scanf("%d",&ymin); printf("\nEnter X end point:"); scanf("%d",&xmax); Experiment No: 12 Date: .

.11

PROGARM TO CREATE A LINE FOR THE GIVEN POINTS

printf("\nEnter Y end point:"); scanf("%d\n",&ymax); line(xmin,ymin,xmax,ymax); getch(); closegraph(); } Result: Program For Creating A Line For The Given Points ----------------------------------------------Enter X start point:50 Enter Y start point:20 Enter X end point:20 Enter Y end point:20

Experiment No: 13

Date:

.11

PROGRAM TO CREATE A RECTANGLE


Aim: To write a C++ program to create a Rectangle for the given points. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 13

Date:

.11

PROGRAM TO CREATE A RECTANGLE


Program: /*Program for Creating Rectangle*/ #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<graphics.h> void main() { clrscr(); printf("t\t\tProgram for Creating Rectangle\n"); printf("\t\t------------------------------\n"); int A,B,C,D; printf("Graphics driver initialization - Please include the C program directory\n"); int gdriver=DETECT,gmode,errorcode;

initgraph(&gdriver,&gmode,"C:\TC"); setcolor(RED); printf("Enter A point:"); scanf("%d",&A); printf("\nEnter B point:"); scanf("%d",&B); printf("\nEnter C point:"); scanf("%d",&C); printf("\nEnter D point:"); scanf("%d\n",&D); rectangle(A,B,C,D); Experiment No: 13 Date: .

.11

PROGRAM TO CREATE A RECTANGLE


getch(); closegraph(); } Result: Program for Creating Rectangle ------------------------------Enter A point:50 Enter B point:100 Enter C point:150 Enter D point:200

Experiment No: 14

Date:

.11

PROGARM TO CREATE A CIRCLE


Aim: To write a C++ program to create a circle. Software Used: Turbo C++ Procedure: Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part.

By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 14

Date:

.11

PROGARM TO CREATE A CIRCLE


Program: /*Program for Creating Circle*/ #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<graphics.h> void main() { clrscr();

printf("t\t\tProgram for Creating Circle\n"); printf("\t\t---------------------------\n"); int xcenter,ycenter,radius; printf("Graphics driver initialization - Please include the C program directory\n"); int gdriver=DETECT,gmode,errorcode; initgraph(&gdriver,&gmode,"C:\TC"); setcolor(GREEN); printf("Enter center point:"); scanf("%d %d",&xcenter,&ycenter); printf("\nEnter radius of circle:"); scanf("%d\n",&radius); circle(xcenter,ycenter,radius); getch(); closegraph(); }

Experiment No: 14

Date:

.11

PROGRAM TO CREATE A CIRCLE


Result: Program for Creating Circle ---------------------------Enter center point:50 50 Enter radius of circle:200

Experiment No: 15

Date:

.11

PROGARM TO CREATE AN ELLIPSE


Aim: To write a C++ program to create an ellipse. Software Used: Turbo C++ Procedure:

Open C++ program windows by using Turbo C++ Software. The standard coding like stdio.h, math.h have been set. The variables are specified as required. By using printf & scanf command, the inputs are set in program. Then formula is given to find out the given geometrical part. By using printf command the output is set in program. Finally the program ends. By using Ctrl + F9 key, the program has been executed. Then the program is checked for various input & found satisfied. Finally the output is shown in the screen.

Experiment No: 15

Date:

.11

PROGARM TO CREATE AN ELLIPSE


Program: /*Program for Creating Ellipse*/ #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<graphics.h> void main() { clrscr(); printf("t\t\tProgram for Creating Ellipse\n"); printf("\t\t----------------------------\n"); int xcenter,ycenter,xradius,yradius; int stangle=0,endangle=360; printf("Graphics driver initialization - Please include the C program directory\n"); int gdriver=DETECT,gmode,errorcode; initgraph(&gdriver,&gmode,"C:\TC"); setcolor(YELLOW); printf("\nEnter X center point:"); scanf("%d",&xcenter); printf("\nEnter Y center point:"); scanf("%d",&ycenter); printf("\nEnter X radius of the ellipse:"); scanf("%d",&xradius);

printf("\nEnter Y radius of the ellipse:"); scanf("%d",&yradius); Experiment No: 15 Date: .

.11

PROGARM TO CREATE AN ELLIPSE


ellipse(xcenter,ycenter,stangle,enda ngle,xradius, yradius); getch(); closegraph(); } Result: Program for Creating Ellipse ---------------------------Enter X center point:50 Enter Y center point:50 Enter X radius of the ellipse:200 Enter Y radius of the ellipse:80

Experiment No: 16

Date:

.11

TO FIND THE MASS PROPERTIES OF A GIVEN OBJECT IN SOLIDWORKS


Aim: To calculate volume and surface area of the given 3D object by mass properties command and check the same manually. Software Used: Solid Works Professional 2007 Procedure: 1. Open Solid Works 2007 from Start menu Program Files Solid Works2007 Solid Works 2007.exe 2. Open a new part file from Menu New Part OK 3. Go to Menu Tools Options Document Properties Units Select the unit system to MMGS (Millimeter, gram, second) - OK. 4. Select the preferred plane (Top plane) from part manager tree right click Insert sketch. 5. Draw the closed profile of the given sketch by using line, circle, rectangle, etc... icons from Sketch tool bar. 6. Dimension the sketch by using smart dimension tool and exit the sketch mode.

7. Go to feature tool and select extrude / revolve feature depend the final shape of the 3D object. Use revolve option for cone and other symmetry object. 8. Go to Menu Tools Mass Properties and find the Volume and Surface area of the 3D object as shown below

Experiment No: 16

Date:

.11

TO FIND THE MASS PROPERTIES OF A GIVEN OBJECT IN SOLIDWORKS

9. Manually Check the Volume and Surface area of the 3D object and compare the same with the solid works mass properties. 10.Consider radius of the cylinder is 25mm and height is 10mm. The volume of cylinder = r2 h = 3.14 x 252 x 100 = 196349.54 mm3. The surface area of cylinder = 2 r (r + h) = 2 x 3.14 x 25 (25 + 100) = 19634.95 mm2. Result:

The volume and surface area of the given 3D object is calculated from mass properties command in solid works and manually. Both the results are found same.

Das könnte Ihnen auch gefallen