Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <chrono>
- #include <thread>
- #include <optional>
- #include "LinkedList.h"
- #include "LinkedList.cpp"
- template <class T>
- void printMaybe(std::optional<T> maybeSomething) {
- if (maybeSomething)
- std::cout << "SOMETHIN: " << *maybeSomething << std::endl;
- else
- std::cout << "NUFFIN" << std::endl;
- }
- int main()
- {
- std::optional<int> last;
- LinkedList<int>* ll = new LinkedList<int>();
- int myarray[] = { 76, 105, 107, 101, 32, 116, 104, 101, 32, 108, 101, 103, 101, 110, 100, 32, 111, 102, 32, 116, 104, 101, 32, 80, 104, 111, 101, 110, 105, 120, 44, 32, 104, 117, 104, 10, 65, 108, 108, 32, 101, 110, 100, 115, 32, 119, 105, 116, 104, 32, 98, 101, 103, 105, 110, 110, 105, 110, 103, 115, 10, 87, 104, 97, 116, 32, 107, 101, 101, 112, 115, 32, 116, 104, 101, 32, 112, 108, 97, 110, 101, 116, 32, 115, 112, 105, 110, 110, 105, 110, 103, 44, 32, 97, 104, 10, 84, 104, 101, 32, 102, 111, 114, 99, 101, 32, 102, 114, 111, 109, 32, 116, 104, 101, 32, 98, 101, 103, 105, 110, 110, 105, 110, 103, 44, 32, 104, 109, 44, 32, 108, 111, 118, 101, 10, 10, 87, 101, 39, 118, 101, 32, 99, 111, 109, 101, 32, 116, 111, 111, 32, 102, 97, 114, 10, 84, 111, 32, 103, 105, 118, 101, 32, 117, 112, 32, 119, 104, 111, 32, 119, 101, 32, 97, 114, 101, 10, 83, 111, 32, 108, 101, 116, 39, 115, 32, 114, 97, 105, 115, 101, 32, 116, 104, 101, 32, 98, 97, 114, 10, 65, 110, 100, 32, 111, 117, 114, 32, 99, 117, 112, 115, 32, 116, 111, 32, 116, 104, 101, 32, 115, 116, 97, 114, 115, 10, 10, 83, 104, 101, 39, 115, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 39, 116, 105, 108, 32, 116, 104, 101, 32, 115, 117, 110, 10, 73, 39, 109, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 116, 111, 32, 103, 101, 116, 32, 115, 111, 109, 101, 10, 83, 104, 101, 39, 115, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 102, 111, 114, 32, 103, 111, 111, 100, 32, 102, 117, 110, 10, 73, 39, 109, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 116, 111, 32, 103, 101, 116, 32, 108, 117, 99, 107, 121, 10, 10, 87, 101, 39, 114, 101, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 39, 116, 105, 108, 32, 116, 104, 101, 32, 115, 117, 110, 10, 87, 101, 39, 114, 101, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 116, 111, 32, 103, 101, 116, 32, 115, 111, 109, 101, 10, 87, 101, 39, 114, 101, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 102, 111, 114, 32, 103, 111, 111, 100, 32, 102, 117, 110, 10, 87, 101, 39, 114, 101, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 116, 111, 32, 103, 101, 116, 32, 108, 117, 99, 107, 121, 10, 10, 87, 101, 39, 114, 101, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 116, 111, 32, 103, 101, 116, 32, 108, 117, 99, 107, 121, 10, 87, 101, 39, 114, 101, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 116, 111, 32, 103, 101, 116, 32, 108, 117, 99, 107, 121, 10, 87, 101, 39, 114, 101, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 116, 111, 32, 103, 101, 116, 32, 108, 117, 99, 107, 121, 10, 87, 101, 39, 114, 101, 32, 117, 112, 32, 97, 108, 108, 32, 110, 105, 103, 104, 116, 32, 116, 111, 32, 103, 101, 116, 32, 108, 117, 99, 107, 121 };
- LinkedList<int>* longus = new LinkedList<int>(myarray, sizeof(myarray) / sizeof(int));
- std::cout << "Size: " << longus->getSize() << std::endl;
- for (unsigned int i = 0; i < longus->getSize(); i++) {
- std::optional<int> meinRTL = longus->getAt(i);
- if (meinRTL) {
- char meinChar = (char) *meinRTL;
- std::cout << meinChar;
- } else
- std::cout << "KeinRTL" << std::endl;
- std::this_thread::sleep_for(std::chrono::milliseconds(75));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement