Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Zeitlhofer
ESE_Zeitlhofer_Bajer
Commits
26c8b8c0
Commit
26c8b8c0
authored
May 08, 2020
by
Mario Bajer
Browse files
fixed multi.cpp
parent
db65fe2f
Changes
3
Show whitespace changes
Inline
Side-by-side
Matrix.cpp
View file @
26c8b8c0
#include "Matrix.hpp"
bool
exists
(
string
filename
){
bool
exists
m
(
string
filename
){
ifstream
f
(
filename
);
return
f
.
good
();
}
...
...
@@ -40,7 +40,7 @@ int Matrix::generateMatrix(int dimension){
this
->
ID
=
rand
()
%
100
;
string
folderpath
=
"Json/"
;
string
testpath
=
folderpath
+
to_string
(
this
->
ID
);
while
(
exists
(
testpath
)){
while
(
exists
m
(
testpath
)){
cout
<<
"<p>"
<<
"File mit ID: "
<<
this
->
ID
<<
" existiert bereits!"
<<
"</p>"
;
this
->
ID
=
rand
()
%
100
;
testpath
=
folderpath
+
to_string
(
this
->
ID
);
...
...
Matrix.hpp
View file @
26c8b8c0
...
...
@@ -47,6 +47,6 @@ private:
};
void
htmlHeader
(
string
title
);
bool
existsm
(
string
filename
);
#endif
\ No newline at end of file
multi.cpp
View file @
26c8b8c0
...
...
@@ -138,10 +138,34 @@ int main(){
result
=
run
(
mult_strassen
,
matrix1
,
matrix2
);
cout
<<
"debug 4"
;
result
.
generateMatrix
(
result
.
dim
);
json
json3
;
srand
(
time
(
NULL
));
result
.
ID
=
rand
()
%
100
;
string
folderpath
=
"Json/"
;
string
testpath
=
folderpath
+
to_string
(
result
.
ID
);
while
(
existsm
(
testpath
)){
cout
<<
"<p>"
<<
"File mit ID: "
<<
result
.
ID
<<
" existiert bereits!"
<<
"</p>"
;
result
.
ID
=
rand
()
%
100
;
testpath
=
folderpath
+
to_string
(
result
.
ID
);
}
folderpath
+=
to_string
(
result
.
ID
)
+
".json"
;
json3
[
"id"
]
=
result
.
ID
;
json3
[
"dimension"
]
=
result
.
dim
;
int
size
=
result
.
dim
*
result
.
dim
;
vector
<
int
>
v
(
result
.
data
,
result
.
data
+
size
);
json3
[
"matrix"
]
=
v
;
ofstream
o
;
o
.
open
(
folderpath
);
o
<<
json3
<<
endl
;
o
.
close
();
// result.generateMatrix(result.dim);
cout
<<
"Resulting Matrix saved at ID: "
+
to_string
(
result
.
ID
)
<<
endl
;
cout
<<
"</div>"
<<
endl
;
cout
<<
"<a href=
\"
http://localhost:80/index.html
\"
>Back to Index</a>"
;
cout
<<
"</body>
\n
"
;
cout
<<
"</html>
\n
"
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment