Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <locale>
- #include <fstream>
- using namespace std;
- int n;
- ifstream f("input.txt", ios::in);
- void print(int** a){
- for (int i = 0; i < n; i++){
- for (int j = 0; j < n; j++){
- cout << a[i][j] << " ";
- }
- cout << endl;
- }
- }
- int fakt(){
- int p = n;
- int sum = 1;
- while (p>0){
- sum *= p;
- p--;
- }
- return sum;
- }
- void main(){
- f >> n;
- int** a = new int*[n];
- int** b = new int*[n];
- for (int i = 0; i < n; i++){
- a[i] = new int[n];
- for (int j = 0; j < n; j++){
- f >> a[i][j];
- }
- }
- for (int i = 0; i < n; i++){
- b[i] = new int[n];
- for (int j = 0; j < n; j++){
- f >> b[i][j];
- }
- }
- print(a);
- cout << endl;
- print(b);
- cout << endl;
- cout << fakt();
- }
Advertisement
Add Comment
Please, Sign In to add comment