#include <iostream>
#include <stdlib.h>
#include <Eigen/Dense>
#include <math.h>
using namespace Std;
Using Eigen::matrixxd;
Matrixxd extract (char str[])
{
Matrixxd p (n);
int u;
int i,j;
Char a[10];
For (i=0;i<=49&&str[i]!= ' ('; i++);
For (j=0;j<=49&&str[j]!= ', '; j + +);
for (u=0;u<=10&&i!=j-1;u++)
{
i++;
A[u]=str[i];
}
P (0,0) =atof (a);
for (i=j;i<=49&&str[i]!= ') '; i++);
for (u=0;u<=10&&j!=i-1;u++)
{
j + +;
A[U]=STR[J];
}
P (0,1) =atof (a);
return p;
}
int main ()
{
Char name[15];
int n;
Double avg,deg;
float pi=3.1415926;
Char str1[20];
Char str2[20];
Char str3[20];
Char str4[15];
Char str5[15];
Char str6[15];
Matrixxd rot (2,2);
Matrixxd P1 ();
MATRIXXD P2 ();
Matrixxd P3 ();
MATRIXXD P4 ();
cout<< "Please enter";
cin>>name;
cin>>n;
Switch (n)
{
Case 1:
{
cin>>str1;
P1=extract (STR1);
}
Break
Case 2:
{
cin>>str1;
P1=extract (STR1);
cin>>str2;
P2=extract (STR2);
}
Break
Case 3:
{
cin>>str1;
P1=extract (STR1);
cin>>str2;
P2=extract (STR2);
cin>>str3;
P3=extract (STR3);
}
Break
default:cout<< "Input Error";
}
cout<< "Please enter operation instructions" <<endl;
cin>>str4;
if (str4[0]== ' m ' &&str4[1]== ' o ' &&str4[2]== ' V ' &&str4[3]== ' e ' &&str4[4]==0)
{
cin>>str5;
cin>>str6;
P4=extract (STR6);
if (n==1)
{
P1=P1+P4;
cout<< "(" <<p1<< ")" <<endl;
}
else if (n==2)
{
P1=P1+P4;
P2=P2+P4;
cout<< "(" <<p1<< ")" << "(" <<p2<< ")" <<endl;
}
Else
{
P1=P1+P4;
P2=P2+P4;
P3=P3+P4;
cout<< "(" <<p1<< ")" << "(" <<p2<< ")" << "(" <<p3<< ")" << Endl
}
}
else if (str4[0]== ' R ' &&str4[1]== ' o ' &&str4[2]== ' t ' &&str4[3]== ' a ' &&str4[4]== ' t ' &&str4[5]== ' E ' &&str4[6]==0)
{
cin>>str5;
cin>>avg;
Deg=avg/180*pi;
Rot (0,0) =cos (deg);
Rot (0,1) =sin (deg);
Rot (1,0) =-sin (deg);
Rot (=cos) (deg);
if (n==1)
{
P1=p1*rot;
cout<< "(" <<p1<< ")" <<endl;
}
else if (n==2)
{
P1=p1*rot;
P2=p2*rot;
cout<< "(" <<p1<< ")" << "(" <<p2<< ")" <<endl;
}
Else
{
P1=p1*rot;
P2=p2*rot;
P3=p3*rot;
cout<< "(" <<p1<< ")" << "(" <<p2<< ")" << "(" <<p3<< ")" << Endl
}
}
Else
{
cout<< "Input Error" <<endl;
}
return 0;
}
First time job