Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #include < math.h >
  4. #include <iomanip>
  5.  
  6.  
  7. double round (double x)
  8. {
  9. setlocale(LC_ALL, "Russian");
  10. (int ((x+0.5)*pow(10,2)))/pow(10,2);
  11. return 0;
  12. }
  13.  
  14. int main()
  15. {
  16. setlocale(LC_ALL, "Russian");
  17. int i,j,jmax;
  18. long double x1,x2,x3,y1,y2,y3,max;
  19. long double A[3][4];
  20. long double B[3][4];
  21. long double C[3][4];
  22. A[1][1]=1.2345; A[2][1]=2.3456; A[3][1]=3.4567; A[1][2]=3.1415; A[1][3]=1; A[1][4]=7.7975; A[2][2]=5.9690; A[3][2]=2.1828; A[2][3]=0; A[2][4]=14.2836; A[3][3]=2.8; A[3][4]=8,6063;
  23. cout << "Матрица А \n" << endl;
  24. for (i=1; i<4; i++)
  25. {
  26. for (j=1; j<5; j++)
  27. cout << A[i][j] << "\t";
  28. cout << endl;
  29. }
  30. max=0;max=A[1][1];
  31. for(j=1;j<4;j++)
  32. {
  33. if(max<A[1][j])
  34. {
  35. max=A[1][j];
  36. jmax=j;
  37. }
  38. }
  39. cout << "Максимальный элемент 1 строки" << endl;
  40. cout << max << endl;
  41. for(i=1;i<4;i++)
  42. {
  43. swap(A[i][1],A[i][jmax]);
  44. }
  45. for (i=1; i<4; i++)
  46. {
  47. for (j=1; j<5; j++)
  48. cout << A[i][j] << "\t";
  49. cout << endl;
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement