Nikitasobakabmx

MainFunction

Mar 12th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include "LinkedList.h"
  3.  
  4.  
  5. int main()
  6. {
  7.     LinkedList<int> list(14);
  8.     for (int i = 0; i < 10; i++) {
  9.         try {
  10.             list[i] = i;
  11.         }
  12.         catch (std::out_of_range){}
  13.         printf("%i \t", list[i]);
  14.     }
  15.     std::cout << std::endl;
  16.     LinkedList<int> list2(list);
  17.     list2[4] = 12;
  18.     list[4] = 3;
  19.     for (int i = 0; i < 10; i++) {
  20.         printf("%i \t", list2[i]);
  21.     }
  22.     std::cout << std::endl;
  23.     system("pause");
  24.     return 0;
  25. }
Add Comment
Please, Sign In to add comment