Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include<iostream>
- #include<cmath>
- #include<string>
- #include<map>
- using std::cout;
- using std::cin;
- struct Complex {
- double cz_rzeczywista;
- double cz_urojona;
- };
- void printComplex(Complex instance) {
- cout << instance.cz_rzeczywista;
- if(instance.cz_urojona != 0)
- cout << std::showpos << instance.cz_urojona << "i";
- cout << std::noshowpos;
- }
- Complex createComplex(double cz_rzeczywista, double cz_urojona) {
- Complex ret{cz_rzeczywista, cz_urojona};
- return ret;
- }
- Complex addComplex(Complex num_1, Complex num_2) {
- Complex ret {
- num_1.cz_rzeczywista + num_2.cz_rzeczywista,
- num_1.cz_urojona + num_2.cz_urojona
- };
- return ret;
- }
- bool compareComplex(Complex num_1, Complex num_2) {
- double num_1_mod = sqrt(num_1.cz_rzeczywista - num_1.cz_urojona);
- double num_2_mod = sqrt(num_2.cz_rzeczywista - num_2.cz_urojona);
- if (num_1_mod == num_2_mod)
- return true;
- else
- return false;
- }
- enum Type { zimowa, letnia };
- // Etykietki dla enum Type
- std::string TypeLabels[] = {
- "zimowa",
- "letnia"
- };
- struct Wheel {
- Type type;
- };
- struct Car {
- Wheel tires[4];
- Car() {
- for (int i = 0; i < 4; i++)
- this->tires[i].type = Type::zimowa;
- };
- };
- void printCarTires(Car car) {
- cout << "[*] Samochód:\n";
- for (int i = 0; i < 4; i++)
- cout << "Opona: " << i+1 << " : " << TypeLabels[car.tires[i].type] << "\n";
- }
- bool checkCar(Car car) {
- bool ret = true;
- for (int i = 1; i < 4; i++)
- if (car.tires[i].type != car.tires[i - 1].type)
- ret = false;
- return ret;
- }
- void setType(Car &car, Type type) {
- for (int i = 0; i < 4; i++)
- car.tires[i].type = type;
- }
- struct Date {
- int year;
- int month;
- int day;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement