#include <iostream>
#include <stdlib.h>
#include <Eigen/Dense>
#include <math.h>
using namespace Std;
Using Eigen::matrixxd;
Matrixxd Exchange (char str[])
{Matrixxd p (n);
int i,j;
Char a[10];
I=1;
j=0;
do{
A[j]=str[i];
i++;
j + +;
}while (str[i]!= ', ');
P (0,0) =atof (a);
j=0;
i=i+1;
for (i<20&&str[i]!= ') '; i++;)
{A[j]=str[i];
j + +;
}
P (0,1) =atof (a);
return p;
}
int main ()
{
Char name[10];
int n;
Double deg;
const float pi=3.1415927;
Char str1[20];
Char str2[20];
Char str3[20];
Char str4[20];
Char str5[20];
Char str6[20];
Matrixxd R (2,2);
Matrixxd P1 ();
MATRIXXD P2 ();
Matrixxd P3 ();
MATRIXXD P4 ();
cout<< "Please enter type";
cin>>name;
cin>>n;
Switch (n)
{
Case 1:
cin>>str1;
P1=exchange (STR1);
Break
Case 2:
cin>>str1;
P1=exchange (STR1);
cin>>str2;
P2=exchange (STR2);
Break
Case 3:
cin>>str1;
P1=exchange (STR1);
cin>>str2;
P2=exchange (STR2);
cin>>str3;
P3=exchange (STR3);
Break
default:cout<< "Input Error";
}
cout<< "Please enter Transform" <<endl;
cin>>str4;
if (str4[0]== ' m ' &&str4[1]== ' o ' &&str4[2]== ' V ' &&str4[3]== ' e ' &&str4[4]==0)
{
cin>>str5;
cin>>str6;
P4=exchange (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]== ' 0 ' &&str4[2]== ' t ' &&str4[3]== ' a ' &&str4[4]== ' t ' &&str4[5]== ' E ' &&str4[6]==0)
{
cin>>str5;
cin>>deg;
R (0,0) =cos (deg*pi/180);
R (0,1) =sin (deg*pi/180);
R (1,0) =-sin (deg*pi/180);
R (=cos) (deg*pi/180);
if (n==1)
{
P1=p1*r;
cout<< "(" <<p1<< ")" <<endl;
}
else if (n==2)
{
P1=p1*r;
P2=p2*r;
cout<< "(" <<p1<< ")" << "(" <<p2<< ")" <<endl;
}
Else
{
P1=p1*r;
P2=p2*r;
P3=p3*r;
cout<< "(" <<p1<< ")" << "(" <<p2<< ")" << "(" <<p3<< ")" << Endl
}
}
Else
{cout<< "Output Error" <<endl;
}
return 0;
}
After each input is this appearance, and then send the program to the classmate computer to try, but there are other problems. Presumably the exchange function is out of the question, but the ability is limited to find out.
First time Software Practice