SlideShare a Scribd company logo
1. Translation program:
#include
#include
#include
#include
#include
int x1,y1,x2,y2,x3,y3,mx,my;
void draw();
void tri();
void main()
{
int gd=DETECT,gm;
int c;
initgraph(&gd,&gm,"d:tcbgi ");
printf("Enter the 1st point for the triangle:");
scanf("%d%d",&x1,&y1);
printf("Enter the 2nd point for the triangle:");
scanf("%d%d",&x2,&y2);
printf("Enter the 3rd point for the triangle:");
scanf("%d%d",&x3,&y3);
cleardevice();
draw();
getch();
tri();
getch();
}
void draw()
{
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
}
void tri()
{
int x,y,a1,a2,a3,b1,b2,b3;
printf("Enter the Transaction coordinates");
scanf("%d%d",&x,&y);
cleardevice();
a1=x1+x;
b1=y1+y;
a2=x2+x;
b2=y2+y;
a3=x3+x;
b3=y3+y;
line(a1,b1,a2,b2);
line(a2,b2,a3,b3);
line(a3,b3,a1,b1);
}
getch();
closegraph();
2.
//rotation
#include
#include
#include
#include
#include
#include
float x1,y1,x2,y2,x,y,x3,y3,x4,y4,a;
int ch;
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
clrscr();
initgraph(&gdriver, &gmode, "c:tcbgi");
cout<<"enter coordinates of line1: ";
cin>>x1>>y1>>x2>>y2;
cout<<"enter coordinates for relative line: ";
cin>>x3>>y3;
cout<<"enter the angle of rotation: ";cin>>a;
cleardevice();
line(x1,y1,x2,y2);
moveto(x2,y2);
lineto(x3,y3);
moveto(x3,y3);
lineto(x1,y1);
a=a*(3.14/180);
x1=(x1*cos(a))-(y1*sin(a));
y1=(x1*sin(a))+(y1*cos(a));
x2=(x2*cos(a))-(y2*sin(a));
y2=(x2*sin(a))+(y2*cos(a));
x3=(x3*cos(a))-(y3*sin(a));
y3=(x3*sin(a))+(y3*cos(a));
cout<<"now hit a key to see rotation:";
getch();
moveto(x1,y1);
lineto(x2,y2);
moveto(x2,y2);
lineto(x3,y3);
moveto(x3,y3);
lineto(x1,y1);
getch();
closegraph();
}
3. Reflection
#include
#include
#include
#include
void main()
{
int gd=DETECT,gm;
int x1,y1,x2,y2,x3,y3;
char a;
clrscr();
initgraph(&gd,&gm,"");
printf(" enter the coordinates of triangle");
sacnf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
line(320,0,320,430);
line(0,240,640,240);
printf(" enter the axis of reflection");
scanf("%d",&a);
if(a='x'||a='X')
{
x1=x1;
x2=x2;
x3=x3;
y1=y1+240;
y2=y2+240;
y3=y3+240;
}
else
if(a='y'||a='Y')
{
y1=y1;
y2=y2;
y3=y3;
x1+=320;
x2+=320;
x3+=320;
}
printf(" triangle after reflection");
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
getch();
closegraph();
}
Solution
1. Translation program:
#include
#include
#include
#include
#include
int x1,y1,x2,y2,x3,y3,mx,my;
void draw();
void tri();
void main()
{
int gd=DETECT,gm;
int c;
initgraph(&gd,&gm,"d:tcbgi ");
printf("Enter the 1st point for the triangle:");
scanf("%d%d",&x1,&y1);
printf("Enter the 2nd point for the triangle:");
scanf("%d%d",&x2,&y2);
printf("Enter the 3rd point for the triangle:");
scanf("%d%d",&x3,&y3);
cleardevice();
draw();
getch();
tri();
getch();
}
void draw()
{
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
}
void tri()
{
int x,y,a1,a2,a3,b1,b2,b3;
printf("Enter the Transaction coordinates");
scanf("%d%d",&x,&y);
cleardevice();
a1=x1+x;
b1=y1+y;
a2=x2+x;
b2=y2+y;
a3=x3+x;
b3=y3+y;
line(a1,b1,a2,b2);
line(a2,b2,a3,b3);
line(a3,b3,a1,b1);
}
getch();
closegraph();
2.
//rotation
#include
#include
#include
#include
#include
#include
float x1,y1,x2,y2,x,y,x3,y3,x4,y4,a;
int ch;
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
clrscr();
initgraph(&gdriver, &gmode, "c:tcbgi");
cout<<"enter coordinates of line1: ";
cin>>x1>>y1>>x2>>y2;
cout<<"enter coordinates for relative line: ";
cin>>x3>>y3;
cout<<"enter the angle of rotation: ";cin>>a;
cleardevice();
line(x1,y1,x2,y2);
moveto(x2,y2);
lineto(x3,y3);
moveto(x3,y3);
lineto(x1,y1);
a=a*(3.14/180);
x1=(x1*cos(a))-(y1*sin(a));
y1=(x1*sin(a))+(y1*cos(a));
x2=(x2*cos(a))-(y2*sin(a));
y2=(x2*sin(a))+(y2*cos(a));
x3=(x3*cos(a))-(y3*sin(a));
y3=(x3*sin(a))+(y3*cos(a));
cout<<"now hit a key to see rotation:";
getch();
moveto(x1,y1);
lineto(x2,y2);
moveto(x2,y2);
lineto(x3,y3);
moveto(x3,y3);
lineto(x1,y1);
getch();
closegraph();
}
3. Reflection
#include
#include
#include
#include
void main()
{
int gd=DETECT,gm;
int x1,y1,x2,y2,x3,y3;
char a;
clrscr();
initgraph(&gd,&gm,"");
printf(" enter the coordinates of triangle");
sacnf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
line(320,0,320,430);
line(0,240,640,240);
printf(" enter the axis of reflection");
scanf("%d",&a);
if(a='x'||a='X')
{
x1=x1;
x2=x2;
x3=x3;
y1=y1+240;
y2=y2+240;
y3=y3+240;
}
else
if(a='y'||a='Y')
{
y1=y1;
y2=y2;
y3=y3;
x1+=320;
x2+=320;
x3+=320;
}
printf(" triangle after reflection");
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
getch();
closegraph();
}

More Related Content

Similar to 1. Translation program#includestdio.h#includeconio.h#incl.pdf

Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
alish sha
 
implement the following funtions. myg1 and myg2 are seperate. x and .pdf
implement the following funtions. myg1 and myg2 are seperate. x and .pdfimplement the following funtions. myg1 and myg2 are seperate. x and .pdf
implement the following funtions. myg1 and myg2 are seperate. x and .pdf
forladies
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programs
Amit Kapoor
 

Similar to 1. Translation program#includestdio.h#includeconio.h#incl.pdf (20)

week-3x
week-3xweek-3x
week-3x
 
C Programming lab
C Programming labC Programming lab
C Programming lab
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
 
implement the following funtions. myg1 and myg2 are seperate. x and .pdf
implement the following funtions. myg1 and myg2 are seperate. x and .pdfimplement the following funtions. myg1 and myg2 are seperate. x and .pdf
implement the following funtions. myg1 and myg2 are seperate. x and .pdf
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
C lab programs
C lab programsC lab programs
C lab programs
 
C lab programs
C lab programsC lab programs
C lab programs
 
C programming codes for the class assignment
C programming codes for the class assignmentC programming codes for the class assignment
C programming codes for the class assignment
 
Basic C Programming Lab Practice
Basic C Programming Lab PracticeBasic C Programming Lab Practice
Basic C Programming Lab Practice
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
 
Progr3
Progr3Progr3
Progr3
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
 
9.C Programming
9.C Programming9.C Programming
9.C Programming
 
C-programs
C-programsC-programs
C-programs
 
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
 
Cg my own programs
Cg my own programsCg my own programs
Cg my own programs
 
week-4x
week-4xweek-4x
week-4x
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 

More from sutharbharat59

1A. The acronym DBLC is used to name the Database Life Cycle.The DBL.pdf
1A. The acronym DBLC is used to name the Database Life Cycle.The DBL.pdf1A. The acronym DBLC is used to name the Database Life Cycle.The DBL.pdf
1A. The acronym DBLC is used to name the Database Life Cycle.The DBL.pdf
sutharbharat59
 
In chemistry, hybridisation (or hybridization) is.pdf
                     In chemistry, hybridisation (or hybridization) is.pdf                     In chemistry, hybridisation (or hybridization) is.pdf
In chemistry, hybridisation (or hybridization) is.pdf
sutharbharat59
 
To convert html code into Java servlet you have to write all html ta.pdf
To convert html code into Java servlet you have to write all html ta.pdfTo convert html code into Java servlet you have to write all html ta.pdf
To convert html code into Java servlet you have to write all html ta.pdf
sutharbharat59
 
The implementation algorithm whose amortized complexity is O (1) to .pdf
The implementation algorithm whose amortized complexity is O (1) to .pdfThe implementation algorithm whose amortized complexity is O (1) to .pdf
The implementation algorithm whose amortized complexity is O (1) to .pdf
sutharbharat59
 
The correct matches are as discussed below(a) A (Glycoprotiens ar.pdf
The correct matches are as discussed below(a) A (Glycoprotiens ar.pdfThe correct matches are as discussed below(a) A (Glycoprotiens ar.pdf
The correct matches are as discussed below(a) A (Glycoprotiens ar.pdf
sutharbharat59
 
SKIN SENSORY ORGANThe human skin is the external covering of the .pdf
SKIN SENSORY ORGANThe human skin is the external covering of the .pdfSKIN SENSORY ORGANThe human skin is the external covering of the .pdf
SKIN SENSORY ORGANThe human skin is the external covering of the .pdf
sutharbharat59
 
tested on EclipseRainfall.javaimpo.pdf
tested on EclipseRainfall.javaimpo.pdftested on EclipseRainfall.javaimpo.pdf
tested on EclipseRainfall.javaimpo.pdf
sutharbharat59
 
Ques-1Part-a Mitosis it is a somatic cell division in an organi.pdf
Ques-1Part-a Mitosis it is a somatic cell division in an organi.pdfQues-1Part-a Mitosis it is a somatic cell division in an organi.pdf
Ques-1Part-a Mitosis it is a somatic cell division in an organi.pdf
sutharbharat59
 
Proportional tax is a tax where the rate of tax is fixed. It is a pr.pdf
Proportional tax is a tax where the rate of tax is fixed. It is a pr.pdfProportional tax is a tax where the rate of tax is fixed. It is a pr.pdf
Proportional tax is a tax where the rate of tax is fixed. It is a pr.pdf
sutharbharat59
 
Q) The passage of traits from parents of offspring is called A H.pdf
Q) The passage of traits from parents of offspring is called A H.pdfQ) The passage of traits from parents of offspring is called A H.pdf
Q) The passage of traits from parents of offspring is called A H.pdf
sutharbharat59
 

More from sutharbharat59 (20)

1A. The acronym DBLC is used to name the Database Life Cycle.The DBL.pdf
1A. The acronym DBLC is used to name the Database Life Cycle.The DBL.pdf1A. The acronym DBLC is used to name the Database Life Cycle.The DBL.pdf
1A. The acronym DBLC is used to name the Database Life Cycle.The DBL.pdf
 
In chemistry, hybridisation (or hybridization) is.pdf
                     In chemistry, hybridisation (or hybridization) is.pdf                     In chemistry, hybridisation (or hybridization) is.pdf
In chemistry, hybridisation (or hybridization) is.pdf
 
RPS 19 stands for ribosomal protein S19. This proteins is synthesise.pdf
RPS 19 stands for ribosomal protein S19. This proteins is synthesise.pdfRPS 19 stands for ribosomal protein S19. This proteins is synthesise.pdf
RPS 19 stands for ribosomal protein S19. This proteins is synthesise.pdf
 
y^(iv)-4y=0taking 4y to RHS we gety^(iv) = 4yy^(iii) = integra.pdf
y^(iv)-4y=0taking 4y to RHS we gety^(iv) = 4yy^(iii) = integra.pdfy^(iv)-4y=0taking 4y to RHS we gety^(iv) = 4yy^(iii) = integra.pdf
y^(iv)-4y=0taking 4y to RHS we gety^(iv) = 4yy^(iii) = integra.pdf
 
 Fe(s) + Mn2+(aq) Fe2+(aq) + Mn(s)Yes this reaction is spon.pdf
 Fe(s) + Mn2+(aq)  Fe2+(aq) + Mn(s)Yes this reaction is spon.pdf Fe(s) + Mn2+(aq)  Fe2+(aq) + Mn(s)Yes this reaction is spon.pdf
 Fe(s) + Mn2+(aq) Fe2+(aq) + Mn(s)Yes this reaction is spon.pdf
 
When Na2SO3 is dissolved in water, Na+ and SO32- ions are formedN.pdf
When Na2SO3 is dissolved in water, Na+ and SO32- ions are formedN.pdfWhen Na2SO3 is dissolved in water, Na+ and SO32- ions are formedN.pdf
When Na2SO3 is dissolved in water, Na+ and SO32- ions are formedN.pdf
 
To convert html code into Java servlet you have to write all html ta.pdf
To convert html code into Java servlet you have to write all html ta.pdfTo convert html code into Java servlet you have to write all html ta.pdf
To convert html code into Java servlet you have to write all html ta.pdf
 
Therapsids is a group of synapsidsAdaptation1.Four limbs extent.pdf
Therapsids is a group of synapsidsAdaptation1.Four limbs extent.pdfTherapsids is a group of synapsidsAdaptation1.Four limbs extent.pdf
Therapsids is a group of synapsidsAdaptation1.Four limbs extent.pdf
 
They trade away higher fecundity for future reproduction.Being ite.pdf
They trade away higher fecundity for future reproduction.Being ite.pdfThey trade away higher fecundity for future reproduction.Being ite.pdf
They trade away higher fecundity for future reproduction.Being ite.pdf
 
The statements that are consistent with facts known about membrane a.pdf
The statements that are consistent with facts known about membrane a.pdfThe statements that are consistent with facts known about membrane a.pdf
The statements that are consistent with facts known about membrane a.pdf
 
The implementation algorithm whose amortized complexity is O (1) to .pdf
The implementation algorithm whose amortized complexity is O (1) to .pdfThe implementation algorithm whose amortized complexity is O (1) to .pdf
The implementation algorithm whose amortized complexity is O (1) to .pdf
 
The correct matches are as discussed below(a) A (Glycoprotiens ar.pdf
The correct matches are as discussed below(a) A (Glycoprotiens ar.pdfThe correct matches are as discussed below(a) A (Glycoprotiens ar.pdf
The correct matches are as discussed below(a) A (Glycoprotiens ar.pdf
 
Step1 Moles of He = 504.0026Step2 Moles of Xe = 50131.29Step3 .pdf
Step1 Moles of He = 504.0026Step2 Moles of Xe = 50131.29Step3 .pdfStep1 Moles of He = 504.0026Step2 Moles of Xe = 50131.29Step3 .pdf
Step1 Moles of He = 504.0026Step2 Moles of Xe = 50131.29Step3 .pdf
 
SKIN SENSORY ORGANThe human skin is the external covering of the .pdf
SKIN SENSORY ORGANThe human skin is the external covering of the .pdfSKIN SENSORY ORGANThe human skin is the external covering of the .pdf
SKIN SENSORY ORGANThe human skin is the external covering of the .pdf
 
a) FlaseIn terms of trasing volume it is by far the largest market.pdf
a) FlaseIn terms of trasing volume it is by far the largest market.pdfa) FlaseIn terms of trasing volume it is by far the largest market.pdf
a) FlaseIn terms of trasing volume it is by far the largest market.pdf
 
tested on EclipseRainfall.javaimpo.pdf
tested on EclipseRainfall.javaimpo.pdftested on EclipseRainfall.javaimpo.pdf
tested on EclipseRainfall.javaimpo.pdf
 
Ques-1Part-a Mitosis it is a somatic cell division in an organi.pdf
Ques-1Part-a Mitosis it is a somatic cell division in an organi.pdfQues-1Part-a Mitosis it is a somatic cell division in an organi.pdf
Ques-1Part-a Mitosis it is a somatic cell division in an organi.pdf
 
Proportional tax is a tax where the rate of tax is fixed. It is a pr.pdf
Proportional tax is a tax where the rate of tax is fixed. It is a pr.pdfProportional tax is a tax where the rate of tax is fixed. It is a pr.pdf
Proportional tax is a tax where the rate of tax is fixed. It is a pr.pdf
 
POS system is a networked invironment where a main computer linked t.pdf
POS system is a networked invironment where a main computer linked t.pdfPOS system is a networked invironment where a main computer linked t.pdf
POS system is a networked invironment where a main computer linked t.pdf
 
Q) The passage of traits from parents of offspring is called A H.pdf
Q) The passage of traits from parents of offspring is called A H.pdfQ) The passage of traits from parents of offspring is called A H.pdf
Q) The passage of traits from parents of offspring is called A H.pdf
 

Recently uploaded

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
Avinash Rai
 

Recently uploaded (20)

Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
Mattingly "AI & Prompt Design: Limitations and Solutions with LLMs"
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Research Methods in Psychology | Cambridge AS Level | Cambridge Assessment In...
Research Methods in Psychology | Cambridge AS Level | Cambridge Assessment In...Research Methods in Psychology | Cambridge AS Level | Cambridge Assessment In...
Research Methods in Psychology | Cambridge AS Level | Cambridge Assessment In...
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdfTelling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
Telling Your Story_ Simple Steps to Build Your Nonprofit's Brand Webinar.pdf
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptx
 

1. Translation program#includestdio.h#includeconio.h#incl.pdf

  • 1. 1. Translation program: #include #include #include #include #include int x1,y1,x2,y2,x3,y3,mx,my; void draw(); void tri(); void main() { int gd=DETECT,gm; int c; initgraph(&gd,&gm,"d:tcbgi "); printf("Enter the 1st point for the triangle:"); scanf("%d%d",&x1,&y1); printf("Enter the 2nd point for the triangle:"); scanf("%d%d",&x2,&y2); printf("Enter the 3rd point for the triangle:"); scanf("%d%d",&x3,&y3); cleardevice(); draw(); getch(); tri(); getch(); } void draw() { line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); }
  • 2. void tri() { int x,y,a1,a2,a3,b1,b2,b3; printf("Enter the Transaction coordinates"); scanf("%d%d",&x,&y); cleardevice(); a1=x1+x; b1=y1+y; a2=x2+x; b2=y2+y; a3=x3+x; b3=y3+y; line(a1,b1,a2,b2); line(a2,b2,a3,b3); line(a3,b3,a1,b1); } getch(); closegraph(); 2. //rotation #include #include #include #include #include #include float x1,y1,x2,y2,x,y,x3,y3,x4,y4,a; int ch; int main(void) { int gdriver = DETECT, gmode, errorcode; clrscr(); initgraph(&gdriver, &gmode, "c:tcbgi"); cout<<"enter coordinates of line1: "; cin>>x1>>y1>>x2>>y2;
  • 3. cout<<"enter coordinates for relative line: "; cin>>x3>>y3; cout<<"enter the angle of rotation: ";cin>>a; cleardevice(); line(x1,y1,x2,y2); moveto(x2,y2); lineto(x3,y3); moveto(x3,y3); lineto(x1,y1); a=a*(3.14/180); x1=(x1*cos(a))-(y1*sin(a)); y1=(x1*sin(a))+(y1*cos(a)); x2=(x2*cos(a))-(y2*sin(a)); y2=(x2*sin(a))+(y2*cos(a)); x3=(x3*cos(a))-(y3*sin(a)); y3=(x3*sin(a))+(y3*cos(a)); cout<<"now hit a key to see rotation:"; getch(); moveto(x1,y1); lineto(x2,y2); moveto(x2,y2); lineto(x3,y3); moveto(x3,y3); lineto(x1,y1); getch(); closegraph(); } 3. Reflection #include #include #include #include void main() { int gd=DETECT,gm; int x1,y1,x2,y2,x3,y3;
  • 4. char a; clrscr(); initgraph(&gd,&gm,""); printf(" enter the coordinates of triangle"); sacnf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3); line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); line(320,0,320,430); line(0,240,640,240); printf(" enter the axis of reflection"); scanf("%d",&a); if(a='x'||a='X') { x1=x1; x2=x2; x3=x3; y1=y1+240; y2=y2+240; y3=y3+240; } else if(a='y'||a='Y') { y1=y1; y2=y2; y3=y3; x1+=320; x2+=320; x3+=320; } printf(" triangle after reflection"); line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); getch();
  • 5. closegraph(); } Solution 1. Translation program: #include #include #include #include #include int x1,y1,x2,y2,x3,y3,mx,my; void draw(); void tri(); void main() { int gd=DETECT,gm; int c; initgraph(&gd,&gm,"d:tcbgi "); printf("Enter the 1st point for the triangle:"); scanf("%d%d",&x1,&y1); printf("Enter the 2nd point for the triangle:"); scanf("%d%d",&x2,&y2); printf("Enter the 3rd point for the triangle:"); scanf("%d%d",&x3,&y3); cleardevice(); draw(); getch(); tri(); getch(); } void draw() {
  • 6. line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); } void tri() { int x,y,a1,a2,a3,b1,b2,b3; printf("Enter the Transaction coordinates"); scanf("%d%d",&x,&y); cleardevice(); a1=x1+x; b1=y1+y; a2=x2+x; b2=y2+y; a3=x3+x; b3=y3+y; line(a1,b1,a2,b2); line(a2,b2,a3,b3); line(a3,b3,a1,b1); } getch(); closegraph(); 2. //rotation #include #include #include #include #include #include float x1,y1,x2,y2,x,y,x3,y3,x4,y4,a; int ch; int main(void) { int gdriver = DETECT, gmode, errorcode;
  • 7. clrscr(); initgraph(&gdriver, &gmode, "c:tcbgi"); cout<<"enter coordinates of line1: "; cin>>x1>>y1>>x2>>y2; cout<<"enter coordinates for relative line: "; cin>>x3>>y3; cout<<"enter the angle of rotation: ";cin>>a; cleardevice(); line(x1,y1,x2,y2); moveto(x2,y2); lineto(x3,y3); moveto(x3,y3); lineto(x1,y1); a=a*(3.14/180); x1=(x1*cos(a))-(y1*sin(a)); y1=(x1*sin(a))+(y1*cos(a)); x2=(x2*cos(a))-(y2*sin(a)); y2=(x2*sin(a))+(y2*cos(a)); x3=(x3*cos(a))-(y3*sin(a)); y3=(x3*sin(a))+(y3*cos(a)); cout<<"now hit a key to see rotation:"; getch(); moveto(x1,y1); lineto(x2,y2); moveto(x2,y2); lineto(x3,y3); moveto(x3,y3); lineto(x1,y1); getch(); closegraph(); } 3. Reflection #include #include #include #include
  • 8. void main() { int gd=DETECT,gm; int x1,y1,x2,y2,x3,y3; char a; clrscr(); initgraph(&gd,&gm,""); printf(" enter the coordinates of triangle"); sacnf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3); line(x1,y1,x2,y2); line(x2,y2,x3,y3); line(x3,y3,x1,y1); line(320,0,320,430); line(0,240,640,240); printf(" enter the axis of reflection"); scanf("%d",&a); if(a='x'||a='X') { x1=x1; x2=x2; x3=x3; y1=y1+240; y2=y2+240; y3=y3+240; } else if(a='y'||a='Y') { y1=y1; y2=y2; y3=y3; x1+=320; x2+=320; x3+=320; } printf(" triangle after reflection");