scf_celebic/ex5/code/task_2-5/task_2.h
dino.celebic 3d054f8ae7 ex5 task5
2025-12-09 23:23:51 +01:00

38 lines
No EOL
1.4 KiB
C++

#pragma once
#include <iostream>
#include <vector>
using namespace std;
tuple<double, double> min_max_par(const vector<double> &v);
tuple<double, double, double> means_par(const vector<double>& v);
/**
This function opens the ASCII-file named @p file_name and reads the
double data into the C++ vector @p v.
If the file @p file_name does not exist then the code stops with an appropriate message.
@param[in] file_name name of the ASCII-file
@param[out] v C++ vector with double values
*/
void read_vector_from_file(const string& file_name, vector<double>& v);
/**
This function opens the ASCII-file named @p file_name and rewrites its with the
double data from the C++ vector @p v.
If there are problems in opening/generating file @p file_name
then the code stops with an appropriate message.
@param[in] file_name name of the ASCII-file
@param[in] v C++ vector with double values
*/
void write_vector_to_file(const string& file_name, const vector<double>& v);
/**
Fills the double-vector @p v with data from an input stream @p istr until this input stream
ends regularily. The vector is cleared and its memory is automatically allocated.
@param[in] istr input stream
@param[out] v C++ vector with double values
@warning An exception is thrown in case of wrong data format or corrupted data.
*/
void fill_vector(istream& istr, vector<double>& v);