Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include "complexNumber.h"
- #include "number.h"
- #include "realNumber.h"
- #include "matrix.h"
- #ifdef __cplusplus__
- #include <cstdlib>
- #else
- #include <stdlib.h>
- #endif
- using namespace std;
- void demo();
- void real();
- /*
- void acls();
- void pakc();
- void menu();
- */
- int main()
- {
- cout << "aCal version 0.1.0 by Agata Głogowska\n"
- "Program for matrix and complex operations\n";
- char option = ' ';
- srand (static_cast <unsigned> (time(0)));
- //pakc();
- //acls();
- for (;;) {
- cout << "You can:\n"
- " · press 'd' for demo of program functions\n"
- " · press 'r' for make your own calculations\n"
- " · press 'c' for close program\n";
- cin >> option;
- switch (option) {
- case 'd':
- demo();
- break;
- case 'r':
- real();
- break;
- case 'c':
- return 0;
- break;
- default:
- //acls();
- cout << "Please press valid key...\n\n";
- break;
- }
- }
- }
- void demo() {
- /*
- acls();
- complexNumber a(0.5, 0.7);
- complexNumber b(5.3, 4.2);
- float c = 11.3;
- */
- complexNumber** tabA = new complexNumber* [3];
- for (int i = 0; i < 3; i++) {
- tabA[i] = new complexNumber[2];
- for (int j = 0; j < 2; j++){
- complexNumber tmp((10 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(10-20)))),
- (10 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(10-20)))));
- tabA[i][j] = tmp;
- }
- }
- matrix<complexNumber> matA(2, 3, tabA);
- matA.show();
- /*
- complexNumber** tabB = new complexNumber* [3];
- for (int i = 0; i < 3; i++) {
- tabB[i] = new complexNumber[2];
- for (int j = 0; j < 2; j++){
- complexNumber tmp((10 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(10-20)))),
- (10 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(10-20)))));
- tabB[i][j] = tmp;
- }
- }
- matrix<complexNumber> matB(3, 2, tabB);
- complexNumber tabC[2][2];
- for (int i = 0; i < 2; i++) {
- for (int j = 0; j < 2; j++){
- complexNumber tmp((10 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(10-20)))),
- (10 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(10-20)))));
- tabC[i][j] = tmp;
- }
- }
- complexNumber tabD[2][1];
- for (int i = 0; i < 2; i++) {
- for (int j = 0; j < 1; j++){
- complexNumber tmp((10 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(10-20)))),
- (10 + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(10-20)))));
- tabD[i][j] = tmp;
- }
- }
- cout << "Complex calculations:\n"
- " a = " << a << "\n" <<
- " b = " << b << "\n" <<
- " c = " << c << "\n\n\n" <<
- " " << a << " + " << b << " = " << a+b << "\n" <<
- " " << a << " - " << b << " = " << a-b << "\n"<<
- " " << a << " * " << b << " = " << a*b << "\n" <<
- " " << a << " * " << c << " = " << a*c << "\n" <<
- " " << a << " / " << b << " = " << a/b << "\n" <<
- " conjugate of a = " << conjugate(a) << "\n" <<
- " reciprocal of a = " << reciprocal(a) << "\n" <<
- " magnitude of a = " << a.Magnitude() << "\n" <<
- "Matrix calculations:\n";
- pakc();
- */
- }
- void real() {
- }
- /*
- void acls() {
- if (system("CLS")) system("clear");
- }
- void pakc() {
- char c = 'a';
- while (c != 'c'){
- cout << "\nPress c to continue...\n";
- cin >> c;
- acls();
- };
- }
- void menu(){}
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement