Advertisement
Dzham

Matrix

Nov 13th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. int main() {
  2. std::vector<std::vector<int>> matrix;
  3. int n, m, element, c1, c2, i, j;
  4. cin >> n >> m;
  5. std::vector<int> line;
  6. for (i = 0; i < n; i++) {
  7. for (j = 0; j < m; j++) {
  8. cin >> element;
  9. line.push_back(element);
  10. }
  11. matrix.push_back(line);
  12. line.clear();
  13. }
  14. cin >> c1 >> c2;
  15. swap_columns(matrix, c1, c2);
  16. for (i = 0; i < n; i++) {
  17. for (j = 0; j < m - 1; j++) {
  18. cout << matrix.at(i).at(j) << " ";
  19. }
  20. cout << matrix.at(i).at(j) << "\n";
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement