Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <fstream>
- #include "determinant.h"
- #include "size.h"
- #include "matrix.h"
- #include "triangle.h"
- #include "area.h"
- #include "unitMatrix.h"
- #include "Windows.h"
- #include <string>
- #include <vector>
- using namespace std;
- int main_menu();
- int main()
- {
- setlocale(LC_ALL, "Russian");
- main_menu();
- system("pause");
- return 0;
- }
- int main_menu()
- {
- setlocale(LC_ALL, "Russian");
- SetConsoleCP(1251); // Ввод с консоли в кодировке 1251
- SetConsoleOutputCP(1251); const string eng = "eng_menu.txt";
- const string rus = "rus_menu.txt";
- const string temp = "temp.txt";
- char ch;
- BOOL bFile;
- ifstream file_eng(eng);
- ifstream file_rus(rus);
- ofstream file_temp(temp);
- bool lang = 1;
- int key1, key2, row, column;
- double determ, area2;
- string mas_cap[35][35];
- string str;
- int i = 0;
- vector<string> lines;
- lines.reserve(14);
- string line; while (getline(file_eng, line, '\n')) {
- lines.push_back(line);
- }
- do
- {
- cout << lines.at(0) << endl;
- cout << lines.at(1)<< endl;
- cout << lines.at(2) << endl;
- cout << lines.at(3) << endl;
- cout << lines.at(4) << endl;
- cout << lines.at(5) << endl;
- cout << lines.at(6) << endl;
- cout << lines.at(7) << endl;
- key1 = _getch();
- switch (key1)
- {
- case '1': {
- cout << lines.at(8) << endl;
- cin >> row >> column;
- Matrix matrix(row, column);
- matrix.init();
- matrix.display_elements();
- break;
- }
- case '2':
- {
- TriangleMatrix trmatrix;
- trmatrix.init();
- trmatrix.display_elements();
- break;
- }
- case '3':
- {
- cout << lines.at(8) << endl;
- cin >> row >> column;
- Determinant det(row, column);
- det.init();
- determ = det.getDeterm();
- cout << determ << endl;
- break;
- }
- case '4':
- {
- Area area;
- area.init();
- cout << lines.at(9) << area.getArea() << endl;
- break;
- }
- case '5':
- {
- unitMatrix unit;
- unit.init();
- unit.TriangleMatrix::display_elements();
- break;
- }
- case '6':
- {
- cout << lines.at(10) << endl;
- cin >> row >> column;
- Matrix obj1(row, column);
- obj1.init();
- cout << lines.at(11) << endl;
- cin >> row >> column;
- Matrix obj2(row, column);
- obj2.init();
- Matrix result;
- result = result.multiple(obj1, obj2);
- result.display_elements();
- break;
- }
- case '7':
- {
- file_eng.open(eng, ios_base::in);
- file_rus.open(rus, ios_base::in);
- file_temp.open(temp);
- if (lang)
- {
- lang = false;
- bFile = CopyFile(
- L"E:\\projects\\kursach\\kurs\\eng_menu.txt",
- L"E:\\projects\\kursach\\kurs\\temp_menu.txt",
- FALSE);
- if (bFile == FALSE)
- {
- cout << GetLastError() << endl;
- }
- else
- cout << lines.at(12) << endl;
- i = 0;
- while (getline(file_eng, line, '\n')) {
- lines[i] = line;
- i++;
- }
- }
- else
- {
- lang = true;
- bFile = CopyFile(
- L"E:\\projects\\kursach\\kurs\\rus_menu.txt",
- L"E:\\projects\\kursach\\kurs\\temp_menu.txt",
- FALSE);
- if (bFile == FALSE)
- {
- cout << GetLastError() << endl;
- }
- else
- cout << lines.at(12)<< endl;
- i = 0;
- while (getline(file_rus, line, '\n')) {
- lines[i] = line;
- i++;
- }
- }
- file_eng.close();
- file_rus.close();
- file_temp.close();
- break;
- }
- default:
- break;
- }
- } while (key1 != 27);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement