1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
// Capsules_12.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<fstream>
#include<iostream>
#include <cstdlib>
#include <algorithm>
#include<list>
#include<math.h>
#include<conio.h>
#include<string>
#define PI 3.14159265
using namespace std;
double angle;
ifstream fileinput;
ofstream fileoutput;
int main(){
int count=0;
string str;
string str2;
fileinput.open("out1");
fileoutput.open("output.txt");
if(!fileinput) { // file couldn't be opened.
cerr << "Error: file could not be opened" << endl;
exit(1);
}
while(!fileinput.eof()){
std::string line,temp1,temp2,temp3,temp4;
stringstream linestring;
matrix temp;
linestring.clear();
getline(fileinput,line);
linestring <<line;
linestring >> temp1 >> temp.tag >> temp3 >> temp4 >> temp(0,0) >> temp(0,1) >> temp(0,2) ;
if (temp3 == "Rotation")
{
linestring.clear();
linestring <<line;
getline(fileinput,line);
linestring <<line;
linestring >> temp1 >> temp2 >> temp(1,0) >> temp(1,1) >> temp(1,2) ;
getline(fileinput,line);
linestring <<line;
linestring >> temp1 >> temp2 >> temp(2,0) >> temp(2,1) >> temp(2,2) ;
temp.computeAngle();
temp.print(fileoutput);
temp.print (std::cout);
line_No+=2;
}
line_No++;
if (line_No > 10000) break;
}
}
fileinput.close();
fileoutput.close();
}
|