Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 87 lines (64 sloc) 1.575 kb
f486114 abstracted classes
Jordan Shaw authored
1 #include <iostream>
2 #include <stdlib.h>
3 #include <time.h>
4 #include <string>
5 #include "matrix.cpp"
6 using namespace std;
7
8
9 /*cell*** build_matrix(string input, int rows,int columns){
10 int** weights = new int*[columns];
11 *weights = new int[rows];
12 int row =0;
13 for(int i = 0;input.length();i++){
14 char c= input.at(i);
15 int column = 0;
16 if(&c == "|"){
17 int j = i;
18 while(j<input.length() && &input.at(j) != "|"){
19 j++;
20 }
21 column++;
22 weights[column][row] = input.substr(i,j);
23 if(column ==columns){
24 row++;
25 column = 0;
26
27 }
28
29 i = j;
30
31 }
32
33 }
34
35 cell*** matrix = allocmatrix(rows,columns);
36 for(int x = 0;x <rows;x++){
37 for(int y =0;y<columns;y++){
38 alloccell(matrix,weights[y][x],x,y,rows,columns);
39
40 }
41
42 }
43
44 return matrix;
45
46
47 }
48 */
49 int main(int argc,const char* argv[]){
50 int rows = 6;
51 int columns = 4;
52
53 srand ( time(NULL) );
54
55
56 /*
57 0 | 4 | 4 | 3 |
58 3 | 5 | 2 | 3 |
59 7 | 2 | 5 | 4 |
60 5 | 9 | 6 | 7 |
61 3 | 10 | 3 | 2 |
62 8 | 10 | 2 | 0 |
63 */
64 /*
65 0 | 5 | 7 | 6 |
66 1 | 3 | 2 | 7 |
67 9 | 2 | 1 | 6 |
68 10 | 1 | 8 | 2 |
69 2 | 3 | 6 | 10 |
70 1 | 8 | 3 | 0 |
71 */
72 Matrix* m = new Matrix(rows,columns);
73 cout << "------------traversing-------------"<<endl;
74 m->go(0,0,rows,columns);
75
76 m->sum();
77
78 cout << "---------------------------------";
79
80
81 cout << "hi";
82
83 return 0;
84 }
85
86
Something went wrong with that request. Please try again.