Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "pch.h"
- #include <vector>
- #include <string>
- int main() {
- //Task4
- float a, n;
- int b;
- cin >> a;
- whole(a);
- cout << a << endl;
- whole(&a);
- cout << a << endl;
- //Task7
- cout << "Task7 " << endl;
- cin >> n;
- inverse(n);
- cout << n << endl;
- inverse(&n);
- cout << n << endl;
- inverse(b);
- cout << b << endl;
- inverse(&b);
- cout << b << endl;
- //Task15
- cout << "Task15" << endl;
- vector<vector<float>> M(3, vector<float>(3));
- string str;
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++) {
- cout << "[" << i << "][" << j << "] = ";
- cin >> M[i][j];
- }
- }
- matrix(M);
- cout << "Res1:" << endl;
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++) {
- cout << M[i][j] << " ";
- }
- cout << endl;
- }
- matrix(&M);
- cout << "Res2:" << endl;
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++) {
- cout << M[i][j] << " ";
- }
- cout << endl;
- }
- return 0;
- }
- #include "pch.h"
- //Task4
- void whole(float *a) {
- *a = *a / 10;
- }
- void whole(float& a) {
- a = a / 10;
- }
- //Task #7
- void inverse(float* n) {
- *n = -*n;
- }
- void inverse(int* b) {
- *b = -*b;
- }
- void inverse(float& n) {
- n = -n;
- }
- void inverse(int& b) {
- b = -b;
- }
- //Task15
- void matrix(vector<vector<float>>* M) {
- for (vector<float>& line : *M) {
- for (float& element : line)
- element *= 3;
- }
- }
- void matrix(vector<vector<float>>& M) {
- for (vector<float>& line : M) {
- for (float& element : line)
- element *= 3;
- }
- }
- #ifndef PCH_H
- #define PCH_H
- #pragma once
- #include <vector>
- using namespace std;
- //Task4
- void whole(float* a);
- void whole(float& a);
- //Task7
- void inverse(float* n);
- void inverse(int* b);
- void inverse(float& n);
- void inverse(int& b);
- //Task15
- void matrix(vector<vector<float>>* M);
- void matrix(vector<vector<float>>& M);
- #endif //PCH_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement