* * Copyright and Version Statement of the program: * Copyright (c) 2011, Computer College of Yantai University * All rights reserved. * File name: Test.cpp * Author: Li Xinpeng * Completion Date: March 4, 2014 * Version number: v1.0 * Description of task and solution: * Input Description: No * Problem description: Find a plane point about X axis y
Axis and Origin symmetrical point * Program output: Symmetric point * problem analysis: slightly * algorithm design: Slightly * * #include <iostream> using namespace std;
Enum SYMMETRICSTYLE{AXISX, Axisy, point};//respectively indicated by x axis, Y axis, the original point symmetry three ways void output (Double,double,symmetricstyle);
int main () {int x,y;
cout<< "The coordinates of the input point:";
cin>>x>>y;
cout<< "The symmetry point about the x-axis is:";
Output (X,Y,AXISX);
cout<< "The symmetric point about the y axis is:";
Output (X,y,axisy);
cout<< "The symmetrical point about the origin of the coordinate is:";
Output (X,y,point);
return 0; void output (double a,double b,symmetricstyle m) {switch (m) {case axisx:cout<<a&
lt;< "," <<-b<<endl;
Break
Case axisy:cout<<-a<< "," <<b<<endl;
Break Case Point:cout<<-a<< "," <<-b<<endl;
Break
}
}
Run Result:
Experience: Paper tigers, can't afford to toss.