ChameL1oN

Takse

Mar 25th, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale>
  3. #include <fstream>
  4.  
  5.  
  6. using namespace std;
  7. int n;
  8. ifstream f("input.txt", ios::in);
  9.  
  10. void print(int** a){
  11. for (int i = 0; i < n; i++){
  12. for (int j = 0; j < n; j++){
  13. cout << a[i][j] << " ";
  14. }
  15. cout << endl;
  16. }
  17. }
  18.  
  19. int fakt(){
  20. int p = n;
  21. int sum = 1;
  22. while (p>0){
  23. sum *= p;
  24. p--;
  25. }
  26. return sum;
  27. }
  28.  
  29.  
  30.  
  31. void main(){
  32.  
  33. f >> n;
  34. int** a = new int*[n];
  35. int** b = new int*[n];
  36. for (int i = 0; i < n; i++){
  37. a[i] = new int[n];
  38. for (int j = 0; j < n; j++){
  39. f >> a[i][j];
  40. }
  41. }
  42. for (int i = 0; i < n; i++){
  43. b[i] = new int[n];
  44. for (int j = 0; j < n; j++){
  45. f >> b[i][j];
  46. }
  47. }
  48. print(a);
  49. cout << endl;
  50. print(b);
  51. cout << endl;
  52. cout << fakt();
  53. }
Advertisement
Add Comment
Please, Sign In to add comment