Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Header.h"
- // this header file is the same cleanUp.h
- #include <vector>
- #include <string>
- #include <iostream>
- using namespace std;
- class matrix {
- public:
- vector <int> matrixB;
- vector <int> code;
- int selector = 5;
- void parse(char userInput) {
- int returnObject = 0;
- switch (userInput) {
- case 'D': {
- if ((this->selector + 3) < 10 && (this->selector + 3) > 0) {
- returnObject = this->selector + 3;
- }
- else {
- returnObject = this->selector;
- }
- break;
- }
- case 'U': {
- if ((this->selector - 3) < 10 && (this->selector - 3) > 0) {
- returnObject = this->selector - 3;
- }
- else {
- returnObject = this->selector;
- }
- break;
- }
- case 'L': {
- if (this->selector == 1 || this->selector == 4 || this->selector == 7) {
- returnObject = this->selector;
- }
- else {
- returnObject = this->selector;
- returnObject = (this->selector - 1);
- }
- break; }
- case 'R': {
- if (this->selector == 3 || this->selector == 6 || this->selector == 9) {
- returnObject = this->selector;
- }
- else {
- returnObject = this->selector;
- returnObject = (this->selector + 1);
- }
- break;
- }
- }
- this->selector = returnObject;
- }
- matrix() {
- for (int i = 0; i < 10; i++) {
- this->matrixB.push_back(i);
- }
- }
- };
- matrix classHandle(vector <string> userInput, matrix matrixObject) {
- for (int i = 0; i < userInput.size(); i++) {
- string stringPtr = userInput.at(i);
- for (int b = 0; b < stringPtr.length(); b++) {
- matrixObject.parse(stringPtr[b]);
- }
- matrixObject.code.push_back(matrixObject.selector);
- }
- return matrixObject;
- }
- vector <string> input;
- void main() {
- matrix A;
- input = getInputFile("C:\\temp\\New Text Document.txt");
- A = classHandle(input, A);
- vout(A.code);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment