Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Макаров Денис Дмитриевич
Laba_3
Compare revisions
fc9cd22640d0199b9a96ca20f1acf4d7c946f73b...a207b3aef9f9034a13835a4922aefd7670ea5deb
Source
ddmakarov/laba_3
Select target project
a207b3aef9f9034a13835a4922aefd7670ea5deb
Select Git revision
..
..
...
Target
ddmakarov/laba_3
Select target project
ddmakarov/laba_3
fc9cd22640d0199b9a96ca20f1acf4d7c946f73b
Select Git revision
Compare
Swap revisions
Commits (2)
Доделал 2 и 3 пункты
· 4fad5119
Макаров Денис Дмитриевич
authored
1 year ago
4fad5119
Доделал 2 и 3 пункты
· a207b3ae
Макаров Денис Дмитриевич
authored
1 year ago
a207b3ae
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
.DS_Store
+0
-0
.DS_Store
cmake-build-debug/CMakeFiles/viktor.dir/compiler_depend.internal
+7
-0
...uild-debug/CMakeFiles/viktor.dir/compiler_depend.internal
cmake-build-debug/CMakeFiles/viktor.dir/compiler_depend.make
+27
-6
cmake-build-debug/CMakeFiles/viktor.dir/compiler_depend.make
cmake-build-debug/CMakeFiles/viktor.dir/source/main.cpp.o
+0
-0
cmake-build-debug/CMakeFiles/viktor.dir/source/main.cpp.o
cmake-build-debug/CMakeFiles/viktor.dir/source/main.cpp.o.d
+10
-3
cmake-build-debug/CMakeFiles/viktor.dir/source/main.cpp.o.d
cmake-build-debug/Testing/Temporary/LastTest.log
+2
-2
cmake-build-debug/Testing/Temporary/LastTest.log
cmake-build-debug/viktor
+0
-0
cmake-build-debug/viktor
source/constant.h
+3
-4
source/constant.h
source/laba3.h
+3
-3
source/laba3.h
source/laba3.hpp
+21
-58
source/laba3.hpp
source/main.cpp
+19
-4
source/main.cpp
with
92 additions
and
80 deletions
+92
-80
.DS_Store
View file @
a207b3ae
No preview for this file type
This diff is collapsed.
Click to expand it.
cmake-build-debug/CMakeFiles/viktor.dir/compiler_depend.internal
View file @
a207b3ae
...
...
@@ -221,6 +221,7 @@ CMakeFiles/viktor.dir/source/main.cpp.o
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__string
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__thread/poll_with_backoff.h
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__threading_support
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__tree
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__tuple
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__undef_macros
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__utility/__decay_copy.h
...
...
@@ -282,6 +283,7 @@ CMakeFiles/viktor.dir/source/main.cpp.o
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/optional
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/ostream
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/ratio
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/set
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/sstream
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/stack
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/stddef.h
...
...
@@ -433,6 +435,11 @@ CMakeFiles/viktor.dir/source/main.cpp.o
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/stdarg.h
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/stddef.h
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/stdint.h
/Users/denis/Desktop/laba_3/laba_3_graph/source/graph.h
/Users/denis/Desktop/laba_3/laba_3_graph/source/graph.hpp
/Users/denis/Desktop/laba_3/laba_3_matrix/source/matrix_new.h
/Users/denis/Desktop/laba_3/laba_3_matrix/source/matrix_new.hpp
/Users/denis/Desktop/laba_3/source/constant.h
/Users/denis/Desktop/laba_3/source/laba3.h
/Users/denis/Desktop/laba_3/source/laba3.hpp
This diff is collapsed.
Click to expand it.
cmake-build-debug/CMakeFiles/viktor.dir/compiler_depend.make
View file @
a207b3ae
...
...
@@ -220,6 +220,7 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__string
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__thread/poll_with_backoff.h
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__threading_support
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__tree
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__tuple
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__undef_macros
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__utility/__decay_copy.h
\
...
...
@@ -281,6 +282,7 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/optional
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/ostream
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/ratio
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/set
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/sstream
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/stack
\
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/stddef.h
\
...
...
@@ -432,12 +434,21 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/stdarg.h
\
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/stddef.h
\
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/stdint.h
\
/Users/denis/Desktop/laba_3/laba_3_graph/source/graph.h
\
/Users/denis/Desktop/laba_3/laba_3_graph/source/graph.hpp
\
/Users/denis/Desktop/laba_3/laba_3_matrix/source/matrix_new.h
\
/Users/denis/Desktop/laba_3/laba_3_matrix/source/matrix_new.hpp
\
/Users/denis/Desktop/laba_3/source/constant.h
\
/Users/denis/Desktop/laba_3/source/laba3.h
\
/Users/denis/Desktop/laba_3/source/laba3.hpp
/Users/denis/Desktop/laba_3/source/laba3.h
:
/Users/denis/Desktop/laba_3/source/constant.h
:
/Users/denis/Desktop/laba_3/laba_3_matrix/source/matrix_new.h
:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/stddef.h
:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include/stdarg.h
:
...
...
@@ -458,8 +469,6 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/time.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/wait.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/types.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/syslimits.h
:
...
...
@@ -480,6 +489,8 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/_types/_useconds_t.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/_types/_u_short.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/_types/_u_int8_t.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/_types/_timespec.h
:
...
...
@@ -658,6 +669,8 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/string_view
:
/Users/denis/Desktop/laba_3/laba_3_matrix/source/matrix_new.hpp
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__functional/reference_wrapper.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/limits.h
:
...
...
@@ -764,6 +777,10 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__utility/pair.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/wait.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/set
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/mutex
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__utility/forward.h
:
...
...
@@ -780,6 +797,10 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__undef_macros
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/_locale.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__tree
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__threading_support
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/limits.h
:
...
...
@@ -886,6 +907,8 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/_types/_u_int32_t.h
:
/Users/denis/Desktop/laba_3/laba_3_graph/source/graph.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__iterator/concepts.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__string
:
...
...
@@ -912,8 +935,6 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__functional/mem_fun_ref.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/_types/_u_short.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/xlocale/_ctype.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__functional/binder2nd.h
:
...
...
@@ -1208,6 +1229,8 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/sys/_types/_u_int.h
:
/Users/denis/Desktop/laba_3/laba_3_graph/source/graph.hpp
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__errc
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__algorithm/lexicographical_compare.h
:
...
...
@@ -1286,8 +1309,6 @@ CMakeFiles/viktor.dir/source/main.cpp.o: /Users/denis/Desktop/laba_3/source/main
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/runetype.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/_locale.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/Availability.h
:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__algorithm/copy_backward.h
:
...
...
This diff is collapsed.
Click to expand it.
cmake-build-debug/CMakeFiles/viktor.dir/source/main.cpp.o
View file @
a207b3ae
No preview for this file type
This diff is collapsed.
Click to expand it.
cmake-build-debug/CMakeFiles/viktor.dir/source/main.cpp.o.d
View file @
a207b3ae
...
...
@@ -421,6 +421,12 @@ CMakeFiles/viktor.dir/source/main.cpp.o: \
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
deque
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
__split_buffer
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
iomanip
\
/
Users
/
denis
/
Desktop
/
laba_3
/
source
/
constant
.
h
\
/
Users
/
denis
/
Desktop
/
laba_3
/
laba_3_matrix
/
source
/
matrix_new
.
h
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
iostream
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
sstream
\
/
Users
/
denis
/
Desktop
/
laba_3
/
laba_3_matrix
/
source
/
matrix_new
.
hpp
\
/
Users
/
denis
/
Desktop
/
laba_3
/
laba_3_graph
/
source
/
graph
.
h
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
unordered_map
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
__functional
/
is_transparent
.
h
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
__hash_table
\
...
...
@@ -429,6 +435,7 @@ CMakeFiles/viktor.dir/source/main.cpp.o: \
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
math
.
h
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
__node_handle
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
optional
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
iostream
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
sstream
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
vector
/
Users
/
denis
/
Desktop
/
laba_3
/
laba_3_graph
/
source
/
graph
.
hpp
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
vector
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
set
\
/
Library
/
Developer
/
CommandLineTools
/
SDKs
/
MacOSX13
.1
.
sdk
/
usr
/
include
/
c
++/
v1
/
__tree
This diff is collapsed.
Click to expand it.
cmake-build-debug/Testing/Temporary/LastTest.log
View file @
a207b3ae
Start testing: Apr 10 1
5:46
MSK
Start testing: Apr 10 1
8:25
MSK
----------------------------------------------------------
End testing: Apr 10 1
5:46
MSK
End testing: Apr 10 1
8:25
MSK
This diff is collapsed.
Click to expand it.
cmake-build-debug/viktor
View file @
a207b3ae
No preview for this file type
This diff is collapsed.
Click to expand it.
source/constant.h
View file @
a207b3ae
...
...
@@ -3,7 +3,6 @@
#include
"matrix_new.h"
#include
"graph.h"
#include
<vector>
#include
<limits>
#include
<set>
//хранит уникальные элементы в отсортированном порядке
...
...
@@ -13,11 +12,11 @@ using weight_t = double;
using
matrix_t
=
linalg
::
Matrix
<
weight_t
>
;
template
<
typename
T
>
using
graph_t
=
graph
::
Graph
<
node_name_t
,
T
,
weight_t
>
using
graph_t
=
graph
::
Graph
<
node_name_t
,
T
,
weight_t
>
;
using
components_t
=
std
::
set
<
std
::
set
<
node_name_t
>>
;
using
route_t
=
std
::
vector
<
node_name_t
>
using
route_t
=
std
::
vector
<
node_name_t
>
;
const
double
INF
=
std
::
numeric_limits
<
double
>::
infinity
();
const
double
EPS
=
s
r
d
::
numeric_limits
<
double
>::
epsilon
();
const
double
EPS
=
s
t
d
::
numeric_limits
<
double
>::
epsilon
();
This diff is collapsed.
Click to expand it.
source/laba3.h
View file @
a207b3ae
...
...
@@ -3,14 +3,14 @@
#include
<tuple>
#include
<string>
#include
<fstream>
//
#include "constant.h"
#include
"constant.h"
using
node_name_t
=
int
;
using
node_name_t
=
unsigned
int
;
node_name_t
convert
(
const
char
*
str
);
std
::
tuple
<
const
char
*
,
node_name_t
,
node_name_t
>
parse_args
(
int
arg_count
,
char
*
arg_vars
[]);
void
skip_one_stick
(
std
::
istream
&
in
);
void
check_eo
r
(
std
::
istream
&
in
);
void
check_eo
f
(
std
::
istream
&
in
);
std
::
ifstream
open_file
(
const
std
::
string
&
filename
);
...
...
This diff is collapsed.
Click to expand it.
source/laba3.hpp
View file @
a207b3ae
...
...
@@ -51,7 +51,7 @@ void skip_one_stick(std::istream& in) {
if
(
c
!=
'|'
)
throw
std
::
runtime_error
(
"Invalid skip symbol"
);
}
void
check_eo
r
(
std
::
istream
&
in
)
{
void
check_eo
f
(
std
::
istream
&
in
)
{
char
c
=
' '
;
if
(
!
(
in
>>
c
))
{
if
(
!
in
.
eof
())
throw
std
::
runtime_error
(
"Bad EOF"
);
...
...
@@ -62,66 +62,29 @@ void check_eor(std::istream& in) {
}
//до сюда идет парсинг строк
/*
node_name_t convert (const char* str) {
using namespace std::string_literals;
node_name_t value = 0;
std::istringstream sout(str);
if (!(sout >> value).eof())
throw std::runtime_error("Invalid argument parametr: "s + str); //если после чтения не был достигнут конец файла, то генерируется и выбрасывается исключение с сообщением об ошибке
return value;
}
std::tuple<std::string, node_name_t, node_name_t> parse_args(int arg_count, char* arg_vars[]) {
using namespace std::string_literals;
if (arg_count != 7)
throw std::runtime_error("Invalid number of arguments!");
std::unordered_map<std::string, const char*> args = {
{"--file", nullptr},
{"--from", nullptr},
{"--to", nullptr}
};
for (char** t = arg_vars + 1; t < arg_vars + arg_count; t += 2) {
auto it = args.find(*t);
if (it == args.end())
throw std::runtime_error("Invalid argument: "s + *t);
auto& [key, value] = *it;
if (value != nullptr)
throw std::runtime_error("Dublicated argument: "s + *t);
value = *(t + 1);
}
#ifndef NDEBUG
for (auto& [key, value] : args)
std::cout << key << ':' << value << '\n';
#endif // NDEBUG
return { args["--file"], convert(args["--from"]), convert(args["--to"]) };
}
void skip_one_stick(std::istream& in) {
char c = ' ';
if (!(in >> c)) throw std::runtime_error("Cannot skip stick");
if (c != '|') throw std::runtime_error("Invalid skip symbol");
}
void check_eor(std::istream& in) {
char c = ' ';
if (!(in >> c)) {
if (!in.eof()) throw std::runtime_error("Bad EOF");
return;
}
if (c != '|') throw std::runtime_error("Invalid end of row");
in.unget();
}
matrix_t load_matrix(const char* filename) {
std::ifstream file(filename);
if (!file.is_open()) throw std::runtime_error("no file");
std::vector<std::vector<weight_t>>vec_of_vec;
auto el = 0;
while (!file.eof()) {
std::vector<weight_t> vec;
skip_one_stick(file);
while (file >> el)
vec.push_back(el);
file.clear();
skip_one_stick(file);
check_eof(file);
vec_of_vec.push_back(vec);
std::ifstream open_file(const std::string& filename) {
std::ifstream file (filename);
if (!file) {
throw std::runtime_error("File not found: " + filename);
}
return file;
check_matrix(vec_of_vec);
matrix_t matr(vec_of_vec.size(), vec_of_vec.begin()->size());
size_t i = 0;
for (const auto& vec : vec_of_vec)
std::copy(vec.begin(), vec.end(), matr.begin() + (i++) * vec.size());
return matr;
}
*/
This diff is collapsed.
Click to expand it.
source/main.cpp
View file @
a207b3ae
...
...
@@ -5,18 +5,33 @@
#include
<string>
#include
<vector>
#include
<sstream>
/*
int main(int arg_count, char* arg_values[]) {
for (size_t i = 0; i < arg_count; ++i)
std::cout << i << ": " << arg_values[i] << '\n';
}
/*
int main(int arg_count, char* arg_values[]) {
*/
int
main
(
int
arg_count
,
char
*
arg_values
[]){
auto
[
file_name
,
more
,
less
]
=
parse_args
(
arg_count
,
arg_values
);
return
0
;
}
/* для 4 пункта
int main(int arg_count, char* arg_values[]){
try {
auto [file_name, from, to] = parse_args(arg_count, arg_values);
auto [file_name, more, less] = parse_args(arg_count, arg_values);
matrix_t matr = load_matrix(file_name);
std::cout << matr;
}
catch (std::exception&err) {
std::cout << err.what();
}
return 0;
}
*/
/*
int main() {
std::string input;
std::vector<std::string> args;
...
...
This diff is collapsed.
Click to expand it.
Menu
Explore
Projects
Groups
Topics
Snippets