private void Page2_Loaded(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Epub files (*.epub)|*.epub|All files (*.*)|*.*";
if (openFileDialog.ShowDialog() == false)
{
return;
}
else
{
string filePath = openFileDialog.FileName;
EpubBook book = EpubReader.Read(filePath);
string title = book.Title;
var authors = book.Authors;
byte[] cover = book.CoverImage;
ICollection<EpubChapter> chapters = book.TableOfContents;
ICollection<EpubTextFile> html = book.Resources.Html;
ICollection<EpubTextFile> css = book.Resources.Css;
ICollection<EpubByteFile> images = book.Resources.Images;
ICollection<EpubByteFile> fonts = book.Resources.Fonts;
string text = book.ToPlainText();
EpubFormat format = book.Format;
OcfDocument ocf = format.Ocf;
OpfDocument opf = format.Opf;
NcxDocument ncx = format.Ncx;
NavDocument nav = format.Nav;
bk.Items.Add(text);
}
}
Еще один момент. Ты вызываешь CreatMatr несколько раз, но сохраняешь (пока что не сохраняешь) набор значений n, m, l только один - последний. А как же все предыдущие? Они не нужны?
#include <iostream>
#include <fstream>
#include <vector>
#include <ctime>
using namespace std;
void CreatMatr(int &n, int &m, int &l) {
ofstream file("matriza.bin", ios::app);
cout << "Ввести строки первой матрицы";
cin >> n;
cout << "Ввести столбцы для первой матрицы и строки для второй";
cin >> m;
int** M;
M = new int* [n];
for (int i = 0; i < n; i++)
M[i] = new int[m];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
M[i][j] = rand() % 10;
cout << "Ввести столбцы второй матрицы";
cin >> l;
int** M2;
M2 = new int* [m];
for (int i = 0; i < m; i++)
M2[i] = new int[l];
for (int i = 0; i < m; i++)
for (int j = 0; j < l; j++)
M2[i][j] = rand() % 10;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++) {
file << M[i][j] << " ";
}
file << endl;
}
file << endl;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < l; j++) {
file << M2[i][j] << " ";
}
file << endl;
}
file << endl;
file.close();
delete[] M;
delete[] M2;
}
vector<vector<int>> ReadMatrix(ifstream& is, int n, int m) {
vector<vector<int>> result(n, vector<int>(m));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
is >> result[i][j];
}
}
return result;
}
void WriteMatrix(ofstream& os, const vector<vector<int>>& m1) {
os << m1.size() << " " << m1[0].size() << "\n";
for (int i = 0; i < m1.size(); ++i) {
for (int j = 0; j < m1[0].size(); ++j) {
os << m1[i][j] << " ";
}
os << "\n";
}
}
vector<vector<int>> MatrixProduct(const vector<vector<int>>& m1, const vector<vector<int>>& m2) {
int n = m1.size(), m = m2.size(), l = m2[0].size();
vector<vector<int>> result(n, vector<int>(l));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < l; ++j) {
int sum = 0;
for (int k = 0; k < m; ++k) {
sum += m1[i][k] * m2[k][j];
}
result[i][j] = sum;
}
}
return result;
}
int main() {
setlocale(LC_ALL, "Rus");
int m=1, n=1, l=1;
int k = 3;
int r = 0;
while (r < k) {
CreatMatr(n, m, l);
r++;
}
ifstream file("matriza.bin", ios::in);
ofstream out("result.bin", ios::out);
if (!file.is_open() || !out.is_open()) {
cout << "Файл не открыт\n";
return 1;
}
for (int i = 0; i < k; i++) {
vector<vector<int>> m1 = ReadMatrix(file, n, m);
vector<vector<int>> m2 = ReadMatrix(file, m, l);
WriteMatrix(out, MatrixProduct(m1, m2));
}
out.close();
file.close();
return 0;
}
#include <iostream>
#include <fstream>
#include <vector>
#include <ctime>
using namespace std;
int CreatMatr(int n, int m, int l) {
ofstream file("matriza.bin", ios::app);
cout << "Ввести строки первой матрицы";
cin >> n;
cout << "Ввести столбцы для первой матрицы и строки для второй";
cin >> m;
vector <std::vector <int>> myVect(n, std::vector <int>(m));
for (size_t i = 0; i < n; i++)
{
std::vector <int> tmp(m);
for (size_t j = 0; j < m; j++)
tmp[j] = rand() % 100;
myVect.push_back(tmp);
}
cout << "Ввести столбцы второй матрицы";
cin >> l;
vector <std::vector <int>> myVect1(n, std::vector <int>(l));
for (size_t i = 0; i < n; i++)
{
std::vector <int> tmp(l);
for (size_t j = 0; j < l; j++)
tmp[j] = rand() % 100;
myVect1.push_back(tmp);
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++) {
file << myVect[i][j] << " ";
}
file << endl;
}
file << endl;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < l; j++) {
file << myVect1[i][j] << " ";
}
file << endl;
}
file << endl;
file.close();
return n, m, l;
}
vector<vector<int>> ReadMatrix(ifstream& is, int n, int m) {
vector<vector<int>> result(n, vector<int>(m));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
is >> result[i][j];
}
}
return result;
}
void WriteMatrix(ofstream& os, const vector<vector<int>>& m1) {
os << m1.size() << " " << m1[0].size() << "\n";
for (int i = 0; i < m1.size(); ++i) {
for (int j = 0; j < m1[0].size(); ++j) {
os << m1[i][j] << " ";
}
os << "\n";
}
}
vector<vector<int>> MatrixProduct(const vector<vector<int>>& m1, const vector<vector<int>>& m2) {
int n = m1.size(), m = m2.size(), l = m2[0].size();
vector<vector<int>> result(n, vector<int>(l));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < l; ++j) {
int sum = 0;
for (int k = 0; k < m; ++k) {
sum += m1[i][k] * m2[k][j];
}
result[i][j] = sum;
}
}
return result;
}
int main() {
setlocale(LC_ALL, "Rus");
int m = 1, n = 1, l=1;
int k = 3;
int r = 0;
while (r < k) {
CreatMatr(n, m, l);
r++;
}
ifstream file("matriza.bin", ios::in);
ofstream out("result.bin", ios::out);
if (!file.is_open() || !out.is_open()) {
cout << "Файл не открыт\n";
return 1;
}
for (int i = 0; i < k; i++) {
file >> n >> m >> l;
vector<vector<int>> m1 = ReadMatrix(file, n, m);
vector<vector<int>> m2 = ReadMatrix(file, m, l);
WriteMatrix(out, MatrixProduct(m1, m2));
}
out.close();
file.close();
return 0;
}
#include <iostream>
#include <fstream>
#include <vector>
#include <ctime>
using namespace std;
int CreatMatr(int n, int m, int l) {
ofstream file("matriza.bin", ios::app);
cout << "Ввести строки первой матрицы";
cin >> n;
cout << "Ввести столбцы для первой матрицы и строки для второй";
cin >> m;
int** M;
M = new int* [n];
for (int i = 0; i < n; i++)
M[i] = new int[m];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
M[i][j] = rand() % 10;
cout << "Ввести столбцы второй матрицы";
cin >> l;
int** M2;
M2 = new int* [m];
for (int i = 0; i < m; i++)
M2[i] = new int[l];
for (int i = 0; i < m; i++)
for (int j = 0; j < l; j++)
M2[i][j] = rand() % 10;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++) {
file << M[i][j] << " ";
}
file << endl;
}
file << endl;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < l; j++) {
file << M2[i][j] << " ";
}
file << endl;
}
file << endl;
file.close();
delete[] M;
delete[] M2;
return n, m, l;
}
vector<vector<int>> ReadMatrix(ifstream& is, int n, int m) {
vector<vector<int>> result(n, vector<int>(m));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
is >> result[i][j];
}
}
return result;
}
void WriteMatrix(ofstream& os, const vector<vector<int>>& m1) {
os << m1.size() << " " << m1[0].size() << "\n";
for (int i = 0; i < m1.size(); ++i) {
for (int j = 0; j < m1[0].size(); ++j) {
os << m1[i][j] << " ";
}
os << "\n";
}
}
vector<vector<int>> MatrixProduct(const vector<vector<int>>& m1, const vector<vector<int>>& m2) {
int n = m1.size(), m = m2.size(), l = m2[0].size();
vector<vector<int>> result(n, vector<int>(l));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < l; ++j) {
int sum = 0;
for (int k = 0; k < m; ++k) {
sum += m1[i][k] * m2[k][j];
}
result[i][j] = sum;
}
}
return result;
}
int main() {
setlocale(LC_ALL, "Rus");
int m = 1, n = 1, l=1;
int k = 3;
int r = 0;
while (r < k) {
CreatMatr(n, m, l);
r++;
}
ifstream file("matriza.bin", ios::in);
ofstream out("result.bin", ios::out);
if (!file.is_open() || !out.is_open()) {
cout << "Файл не открыт\n";
return 1;
}
for (int i = 0; i < k; i++) {
file >> n >> m >> l;
vector<vector<int>> m1 = ReadMatrix(file, n, m);
vector<vector<int>> m2 = ReadMatrix(file, m, l);
WriteMatrix(out, MatrixProduct(m1, m2));
}
out.close();
file.close();
return 0;
}
void elementdob(student*& stu, int& n, student newelement) {
student* stooo = new student[n+1];
for (int i = 0; i < n; i++) {
stooo[i] = stu[i];
}
stooo[n] = newelement;
n++;
delete[] stu;
stu = stooo;
}
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
setlocale(LC_ALL , "Russian");
int N;
cout << "Введите N";
cin >> N;
ofstream file("proga.txt");
for (int i = 0; i < N; i++)
{
for (int e = 1; e < N-i; e++)
file << "*";
for (char j = 'A'; j <= 'A' + i; j++)
file << j;
file << '\n';
}
file.close();
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
float power(float X, int N){
if (N != 0){
if (N < 0){
return 1 / power(X, -N);
}
else if(N>0){
if (N % 2 == 0){
float b=power(X, N/2);
return pow(b,2);
}
else{
return X * power(X, N - 1);
}
}
else{
return 1;
}
}
}
int main(){
float X;
int N;
cout<<"X=";
cin>>X;
for (int i=0;i<=5;i++){
cout<<"N=";
cin>>N;
cout<<X<<"^"<<N<<"="<<power(X,N)<<endl;
}
}