├── README.md ├── en.subject.pdf ├── ex00 ├── BitcoinExchange.cpp ├── BitcoinExchange.hpp ├── Makefile ├── btc ├── data.csv ├── input.csv └── main.cpp ├── ex01 ├── Makefile ├── main.cpp ├── rpn ├── rpn.cpp ├── rpn.hpp ├── script.sh └── tester.sh ├── ex02 ├── Makefile ├── PmergeMe ├── PmergeMe.cpp ├── PmergeMe.hpp ├── main.cpp └── mainn.cpp ├── explanation ├── Page 1.svg ├── Screen Shot 2023-03-25 at 6.20.26 PM.png ├── Screen Shot 2023-03-26 at 5.56.08 PM.png ├── deque.png ├── last.gif ├── rpn_stack.png ├── swap.gif ├── vector.png ├── vector2.gif └── vector_pair.png ├── file.cpp └── list.cpp /README.md: -------------------------------------------------------------------------------- 1 | # Ex01 : RPN : 2 | 3 | دابا حنا فاش كانبغيوا نعطيوا الأولوية للشي عملية بحال الضرب و لا القسمة كانديروا الأقواس و العملية (+, -, *, /) كاتكون وسط الأرقام, فال RPN كاتبدل القضية و كانحيدوا الحاجة للأقواس بحيت كانبقاو نقراو من اليسار الى اليمين وما كانديروا شي عملية تاكنلقاو 2 أعداد من وراهم Operator 4 | 5 | هاد الكتابة كاتستعمل فبعض الCalculators و Computers حيتاش كيحتاجو غير شويا ديال ال Charachters باش يخدموا و فبعض للغات البرمجة كPostScript 6 | 7 | 8 | هاد الكتابة سريعة و من بين الأسباب علاش انها كتحتاج معلومات قلال لي تخزنهم متلا ايلا بغينا نديرو 2 * 3 - 5 غادي نحتاجو 9 ديال ((5 - 3) * 2) فبلاصة غي 5 بحال * 2 - 3 5 و حيتاش كاينين معلومات قلال يعني وقت قليل باش يخدم الProgram 9 | 10 | 11 | 12 |

13 | 14 | 15 | 16 | 17 | 18 | 19 | # Ex02 : Ford Johnson Sort : 20 | 21 | ### Disclaimer: The following is a brief explanation and does not reflect the actual implementation (Check Resources Below) 22 | 23 |

24 | 25 | We Have a unsorted vector (or any container) : 26 | 27 |

28 | 29 | 30 | 31 |

32 | 33 | We create a vector of pairs of unsigned integers (because the value to be inserted are positives) 34 | 35 |

36 | 37 | 38 | 39 |

40 | 41 | Then we take a vector of pairs of unsigned integers and swaps the first and second elements if the first element is greater than the second element 42 | 43 |

44 | 45 | 46 | 47 |

48 | 49 | After that we take a vector of pairs of unsigned integers and extracts the second element of each pair into a new vector called the largest and the first element of each pair into a new vector called smallest. 50 | 51 |

52 | 53 | 54 | 55 |

56 | 57 | 58 | 59 |

60 | 61 | It’s up to you to choose which one to sort, i choose the largest 62 | 63 |

64 | 65 | Now start to insert the elements of largest to smallest by using lower_bound to get its position and the member function insert to insert. 66 | 67 |

68 | 69 | 70 | 71 | 72 | 73 | 74 | # Addons 75 | 76 | let's start by defining what's a container ?? 77 | 78 | Container ? 79 | A container in C++ is a class template that stores a collection of other objects (elements), and provides member functions to access and manipulate them. The C++ Standard Library provides a variety of container classes that can be used to store and manipulate collections of objects, including sequential containers, associative containers, and unordered associative containers. 80 | 81 | deque is the double-ended queue container provided by C++ Standard Template Library (STL), it is similar with vector container, but if you want to add a new element to the beginning in a vector, the time complexity is O(N), but in a deque it is O(1). 82 | 83 | deque can automatically expand the space when we need to store more elements, so that we don’t have to worry about the size of the queue. 84 | 85 |

86 | 87 | 88 | 89 | - std::deque is a good choice when you need a container that supports efficient insertion and deletion at both ends 90 | 91 | - std::vector is a good choice when you need a container that supports efficient random access 92 | 93 | - Random access refers to the ability to access any element in a container in constant time, regardless of its position in the container, In C++, std::vector provides random access, meaning that you can access any element in a vector in constant time using the [] operator. This is because std::vector stores its elements in a contiguous block of memory, allowing for efficient random access. 94 | 95 | 96 | 97 | 98 | # Ressources : 99 | 100 | ## RPN 101 | https://isaaccomputerscience.org/concepts/dsa_datastruct_stack?examBoard=all&stage=all 102 | 103 | https://isaaccomputerscience.org/concepts/dsa_toc_rpn?examBoard=all&stage=all 104 | 105 | https://www.dcode.fr/reverse-polish-notation 106 | 107 | **RPN Problem in LeetCode** 108 | 109 | - https://leetcode.com/problems/evaluate-reverse-polish-notation/description/ 110 | 111 | ## Ford Johnson 112 | 113 | https://codereview.stackexchange.com/questions/116367/ford-johnson-merge-insertion-sort 114 | 115 | https://github.com/PunkChameleon/ford-johnson-merge-insertion-sort 116 | 117 | https://github.com/decidedlyso/merge-insertion-sort/blob/master/README.md 118 | 119 | 120 | ## STL 121 | 122 | # Benchmarking 123 | 124 | 125 | http://blog.davidecoppola.com/2014/05/cpp-benchmarks-vector-vs-list-vs-deque/ 126 | 127 | # Deque 128 | 129 | https://clay-atlas.com/us/blog/2021/09/28/cpp-en-how-to-use-deque-stl/ 130 | 131 | https://stackoverflow.com/questions/5345152/why-would-i-prefer-using-vector-to-deque 132 | -------------------------------------------------------------------------------- /en.subject.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/en.subject.pdf -------------------------------------------------------------------------------- /ex00/BitcoinExchange.cpp: -------------------------------------------------------------------------------- 1 | #include "BitcoinExchange.hpp" 2 | 3 | BitcoinExchange::BitcoinExchange () 4 | { 5 | } 6 | 7 | /*--------------------------------------------------------*/ 8 | BitcoinExchange::BitcoinExchange (const BitcoinExchange &a) 9 | { 10 | this->operator=(a); 11 | } 12 | 13 | /*--------------------------------------------------------*/ 14 | BitcoinExchange::~BitcoinExchange () 15 | { 16 | } 17 | 18 | /*--------------------------------------------------------*/ 19 | BitcoinExchange & BitcoinExchange::operator = (const BitcoinExchange &a) 20 | { 21 | (void)a; 22 | return (*this); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /ex00/BitcoinExchange.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BITCOINEXCHANGE_H 2 | #define BITCOINEXCHANGE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class BitcoinExchange 10 | { 11 | private: 12 | std::map _database; 13 | public: 14 | BitcoinExchange (); 15 | BitcoinExchange (const BitcoinExchange &a); 16 | ~BitcoinExchange (); 17 | BitcoinExchange & operator = (const BitcoinExchange &a); 18 | 19 | void ReadBase(void); 20 | void PrintMap(std::map mymap); 21 | void ReadInput(std::string file); 22 | int Parsing(int year, int month, int day, std::string raate, float rate, std::string line); 23 | void PrintOuput(std::string inputdate, float bitcoins); 24 | }; 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /ex00/Makefile: -------------------------------------------------------------------------------- 1 | NAME = btc 2 | 3 | CPP = c++ 4 | 5 | CPP_FLAGS = -Wall -Wextra -Werror -std=c++98 6 | 7 | FILES = main.cpp \ 8 | BitcoinExchange.cpp \ 9 | 10 | all : $(NAME) 11 | 12 | $(NAME) : $(FILES) 13 | $(CPP) $(CPP_FLAGS) $(FILES) -o $(NAME) 14 | 15 | RM = rm -rf 16 | 17 | clean : 18 | $(RM) $(NAME) 19 | 20 | re : clean all -------------------------------------------------------------------------------- /ex00/btc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/ex00/btc -------------------------------------------------------------------------------- /ex00/data.csv: -------------------------------------------------------------------------------- 1 | 2009-01-02,0 2 | 2009-01-05,0 3 | 2009-01-08,0 4 | 2009-01-11,0 5 | 2009-01-14,0 6 | 2009-01-17,0 7 | 2009-01-20,0 8 | 2009-01-23,0 9 | 2009-01-26,0 10 | 2009-01-29,0 11 | 2009-02-01,0 12 | 2009-02-04,0 13 | 2009-02-07,0 14 | 2009-02-10,0 15 | 2009-02-13,0 16 | 2009-02-16,0 17 | 2009-02-19,0 18 | 2009-02-22,0 19 | 2009-02-25,0 20 | 2009-02-28,0 21 | 2009-03-03,0 22 | 2009-03-06,0 23 | 2009-03-09,0 24 | 2009-03-12,0 25 | 2009-03-15,0 26 | 2009-03-18,0 27 | 2009-03-21,0 28 | 2009-03-24,0 29 | 2009-03-27,0 30 | 2009-03-31,0 31 | 2009-04-03,0 32 | 2009-04-06,0 33 | 2009-04-09,0 34 | 2009-04-12,0 35 | 2009-04-15,0 36 | 2009-04-18,0 37 | 2009-04-21,0 38 | 2009-04-24,0 39 | 2009-04-27,0 40 | 2009-04-30,0 41 | 2009-05-03,0 42 | 2009-05-06,0 43 | 2009-05-09,0 44 | 2009-05-12,0 45 | 2009-05-15,0 46 | 2009-05-18,0 47 | 2009-05-21,0 48 | 2009-05-24,0 49 | 2009-05-27,0 50 | 2009-05-30,0 51 | 2009-06-02,0 52 | 2009-06-05,0 53 | 2009-06-08,0 54 | 2009-06-11,0 55 | 2009-06-14,0 56 | 2009-06-17,0 57 | 2009-06-20,0 58 | 2009-06-23,0 59 | 2009-06-26,0 60 | 2009-06-29,0 61 | 2009-07-02,0 62 | 2009-07-05,0 63 | 2009-07-08,0 64 | 2009-07-11,0 65 | 2009-07-14,0 66 | 2009-07-17,0 67 | 2009-07-20,0 68 | 2009-07-23,0 69 | 2009-07-26,0 70 | 2009-07-29,0 71 | 2009-08-01,0 72 | 2009-08-04,0 73 | 2009-08-07,0 74 | 2009-08-10,0 75 | 2009-08-13,0 76 | 2009-08-16,0 77 | 2009-08-19,0 78 | 2009-08-22,0 79 | 2009-08-25,0 80 | 2009-08-28,0 81 | 2009-08-31,0 82 | 2009-09-03,0 83 | 2009-09-06,0 84 | 2009-09-09,0 85 | 2009-09-12,0 86 | 2009-09-15,0 87 | 2009-09-18,0 88 | 2009-09-21,0 89 | 2009-09-24,0 90 | 2009-09-27,0 91 | 2009-09-30,0 92 | 2009-10-03,0 93 | 2009-10-06,0 94 | 2009-10-09,0 95 | 2009-10-12,0 96 | 2009-10-15,0 97 | 2009-10-18,0 98 | 2009-10-21,0 99 | 2009-10-24,0 100 | 2009-10-26,0 101 | 2009-10-29,0 102 | 2009-11-01,0 103 | 2009-11-04,0 104 | 2009-11-07,0 105 | 2009-11-10,0 106 | 2009-11-13,0 107 | 2009-11-16,0 108 | 2009-11-19,0 109 | 2009-11-22,0 110 | 2009-11-25,0 111 | 2009-11-28,0 112 | 2009-12-01,0 113 | 2009-12-04,0 114 | 2009-12-07,0 115 | 2009-12-10,0 116 | 2009-12-13,0 117 | 2009-12-16,0 118 | 2009-12-19,0 119 | 2009-12-22,0 120 | 2009-12-25,0 121 | 2009-12-28,0 122 | 2009-12-31,0 123 | 2010-01-03,0 124 | 2010-01-06,0 125 | 2010-01-09,0 126 | 2010-01-12,0 127 | 2010-01-15,0 128 | 2010-01-18,0 129 | 2010-01-21,0 130 | 2010-01-24,0 131 | 2010-01-27,0 132 | 2010-01-30,0 133 | 2010-02-02,0 134 | 2010-02-05,0 135 | 2010-02-08,0 136 | 2010-02-11,0 137 | 2010-02-14,0 138 | 2010-02-17,0 139 | 2010-02-20,0 140 | 2010-02-23,0 141 | 2010-02-26,0 142 | 2010-03-01,0 143 | 2010-03-04,0 144 | 2010-03-07,0 145 | 2010-03-10,0 146 | 2010-03-13,0 147 | 2010-03-16,0 148 | 2010-03-19,0 149 | 2010-03-22,0 150 | 2010-03-25,0 151 | 2010-03-29,0 152 | 2010-04-01,0 153 | 2010-04-04,0 154 | 2010-04-07,0 155 | 2010-04-10,0 156 | 2010-04-13,0 157 | 2010-04-16,0 158 | 2010-04-19,0 159 | 2010-04-22,0 160 | 2010-04-25,0 161 | 2010-04-28,0 162 | 2010-05-01,0 163 | 2010-05-04,0 164 | 2010-05-07,0 165 | 2010-05-10,0 166 | 2010-05-13,0 167 | 2010-05-16,0 168 | 2010-05-19,0 169 | 2010-05-22,0 170 | 2010-05-25,0 171 | 2010-05-28,0 172 | 2010-05-31,0 173 | 2010-06-03,0 174 | 2010-06-06,0 175 | 2010-06-09,0 176 | 2010-06-12,0 177 | 2010-06-15,0 178 | 2010-06-18,0 179 | 2010-06-21,0 180 | 2010-06-24,0 181 | 2010-06-27,0 182 | 2010-06-30,0 183 | 2010-07-03,0 184 | 2010-07-06,0 185 | 2010-07-09,0 186 | 2010-07-12,0 187 | 2010-07-15,0 188 | 2010-07-18,0 189 | 2010-07-21,0 190 | 2010-07-24,0 191 | 2010-07-27,0 192 | 2010-07-30,0 193 | 2010-08-02,0 194 | 2010-08-05,0 195 | 2010-08-08,0 196 | 2010-08-11,0 197 | 2010-08-14,0 198 | 2010-08-17,0 199 | 2010-08-20,0.07 200 | 2010-08-23,0.07 201 | 2010-08-26,0.07 202 | 2010-08-29,0.06 203 | 2010-09-01,0.06 204 | 2010-09-04,0.06 205 | 2010-09-07,0.06 206 | 2010-09-10,0.06 207 | 2010-09-13,0.06 208 | 2010-09-16,0.15 209 | 2010-09-19,0.06 210 | 2010-09-22,0.06 211 | 2010-09-25,0.06 212 | 2010-09-28,0.06 213 | 2010-10-01,0.06 214 | 2010-10-04,0.06 215 | 2010-10-07,0.06 216 | 2010-10-10,0.12 217 | 2010-10-13,0.1 218 | 2010-10-16,0.12 219 | 2010-10-19,0.1 220 | 2010-10-22,0.11 221 | 2010-10-25,0.18 222 | 2010-10-28,0.19 223 | 2010-10-31,0.19 224 | 2010-11-02,0.21 225 | 2010-11-05,0.25 226 | 2010-11-08,0.36 227 | 2010-11-11,0.24 228 | 2010-11-14,0.3 229 | 2010-11-17,0.28 230 | 2010-11-20,0.29 231 | 2010-11-23,0.29 232 | 2010-11-26,0.29 233 | 2010-11-29,0.28 234 | 2010-12-02,0.25 235 | 2010-12-05,0.23 236 | 2010-12-08,0.25 237 | 2010-12-11,0.23 238 | 2010-12-14,0.23 239 | 2010-12-17,0.25 240 | 2010-12-20,0.27 241 | 2010-12-23,0.25 242 | 2010-12-26,0.27 243 | 2010-12-29,0.3 244 | 2011-01-01,0.3 245 | 2011-01-04,0.3 246 | 2011-01-07,0.32 247 | 2011-01-10,0.33 248 | 2011-01-13,0.42 249 | 2011-01-16,0.4 250 | 2011-01-19,0.35 251 | 2011-01-22,0.43 252 | 2011-01-25,0.43 253 | 2011-01-28,0.45 254 | 2011-01-31,0.61 255 | 2011-02-03,0.78 256 | 2011-02-06,0.92 257 | 2011-02-09,0.97 258 | 2011-02-12,1.09 259 | 2011-02-15,1.08 260 | 2011-02-18,1.04 261 | 2011-02-21,0.88 262 | 2011-02-24,0.96 263 | 2011-02-27,0.96 264 | 2011-03-02,0.95 265 | 2011-03-05,0.92 266 | 2011-03-08,0.9 267 | 2011-03-11,0.93 268 | 2011-03-14,0.9 269 | 2011-03-17,0.87 270 | 2011-03-20,0.79 271 | 2011-03-23,0.86 272 | 2011-03-26,0.9 273 | 2011-03-30,0.8 274 | 2011-04-02,0.8 275 | 2011-04-05,0.77 276 | 2011-04-08,0.78 277 | 2011-04-11,0.76 278 | 2011-04-14,0.99 279 | 2011-04-17,1.09 280 | 2011-04-20,1.19 281 | 2011-04-23,1.38 282 | 2011-04-26,1.71 283 | 2011-04-29,2.66 284 | 2011-05-02,3.95 285 | 2011-05-05,3.56 286 | 2011-05-08,3.75 287 | 2011-05-11,5.41 288 | 2011-05-14,8.56 289 | 2011-05-17,8.47 290 | 2011-05-20,7.28 291 | 2011-05-23,6.81 292 | 2011-05-26,7.95 293 | 2011-05-29,8.68 294 | 2011-06-01,9.47 295 | 2011-06-04,15.05 296 | 2011-06-07,19.19 297 | 2011-06-10,32.34 298 | 2011-06-13,24.87 299 | 2011-06-16,19.99 300 | 2011-06-19,17.6 301 | 2011-06-22,15.39 302 | 2011-06-25,16.95 303 | 2011-06-28,17.89 304 | 2011-07-01,17.38 305 | 2011-07-04,15.74 306 | 2011-07-07,16.44 307 | 2011-07-10,15.16 308 | 2011-07-13,14.52 309 | 2011-07-16,14.25 310 | 2011-07-19,13.93 311 | 2011-07-22,13.94 312 | 2011-07-25,14.16 313 | 2011-07-28,14.1 314 | 2011-07-31,14.06 315 | 2011-08-03,13.37 316 | 2011-08-06,11.42 317 | 2011-08-09,9.66 318 | 2011-08-12,10.35 319 | 2011-08-15,11.4 320 | 2011-08-18,11.39 321 | 2011-08-21,11.75 322 | 2011-08-24,11.47 323 | 2011-08-27,10.01 324 | 2011-08-30,9.4 325 | 2011-09-02,8.46 326 | 2011-09-05,8.56 327 | 2011-09-08,7.53 328 | 2011-09-11,6.49 329 | 2011-09-14,6.19 330 | 2011-09-17,5.18 331 | 2011-09-20,5.89 332 | 2011-09-23,5.8 333 | 2011-09-26,5.49 334 | 2011-09-29,4.95 335 | 2011-10-02,5.27 336 | 2011-10-05,5.03 337 | 2011-10-08,4.79 338 | 2011-10-11,4.23 339 | 2011-10-14,4.37 340 | 2011-10-17,3.87 341 | 2011-10-20,2.59 342 | 2011-10-23,3.31 343 | 2011-10-26,3 344 | 2011-10-29,3.39 345 | 2011-10-31,3.38 346 | 2011-11-03,3.28 347 | 2011-11-06,3.04 348 | 2011-11-09,3.09 349 | 2011-11-12,3.11 350 | 2011-11-15,2.67 351 | 2011-11-18,2.37 352 | 2011-11-21,2.3 353 | 2011-11-24,2.48 354 | 2011-11-27,2.51 355 | 2011-11-30,3 356 | 2011-12-03,3.1 357 | 2011-12-06,3.06 358 | 2011-12-09,3.04 359 | 2011-12-12,3.33 360 | 2011-12-15,3.2 361 | 2011-12-18,3.36 362 | 2011-12-21,4.08 363 | 2011-12-24,4.06 364 | 2011-12-27,4.09 365 | 2011-12-30,4.47 366 | 2012-01-02,5.45 367 | 2012-01-05,6.6 368 | 2012-01-08,7.2 369 | 2012-01-11,7.1 370 | 2012-01-14,6.81 371 | 2012-01-17,6.97 372 | 2012-01-20,6.57 373 | 2012-01-23,6.47 374 | 2012-01-26,6.08 375 | 2012-01-29,5.72 376 | 2012-02-01,5.77 377 | 2012-02-04,5.99 378 | 2012-02-07,5.74 379 | 2012-02-10,5.94 380 | 2012-02-13,5.69 381 | 2012-02-16,4.74 382 | 2012-02-19,4.38 383 | 2012-02-22,4.63 384 | 2012-02-25,5.05 385 | 2012-02-28,4.98 386 | 2012-03-02,4.94 387 | 2012-03-05,5.04 388 | 2012-03-08,4.99 389 | 2012-03-11,4.98 390 | 2012-03-14,5.45 391 | 2012-03-17,5.4 392 | 2012-03-20,4.95 393 | 2012-03-23,4.81 394 | 2012-03-27,4.74 395 | 2012-03-30,4.85 396 | 2012-04-02,4.97 397 | 2012-04-05,4.96 398 | 2012-04-08,4.94 399 | 2012-04-11,4.9 400 | 2012-04-14,4.97 401 | 2012-04-17,4.99 402 | 2012-04-20,5.19 403 | 2012-04-23,5.3 404 | 2012-04-26,5.16 405 | 2012-04-29,5.09 406 | 2012-05-02,5.04 407 | 2012-05-05,5.15 408 | 2012-05-08,5.1 409 | 2012-05-11,5.1 410 | 2012-05-14,5.01 411 | 2012-05-17,5.1 412 | 2012-05-20,5.14 413 | 2012-05-23,5.13 414 | 2012-05-26,5.15 415 | 2012-05-29,5.16 416 | 2012-06-01,5.21 417 | 2012-06-04,5.27 418 | 2012-06-07,5.48 419 | 2012-06-10,5.68 420 | 2012-06-13,5.76 421 | 2012-06-16,6.27 422 | 2012-06-19,6.48 423 | 2012-06-22,6.8 424 | 2012-06-25,6.56 425 | 2012-06-28,6.58 426 | 2012-07-01,6.69 427 | 2012-07-04,6.71 428 | 2012-07-07,6.74 429 | 2012-07-10,6.98 430 | 2012-07-13,7.46 431 | 2012-07-16,7.8 432 | 2012-07-19,9.37 433 | 2012-07-22,9.53 434 | 2012-07-25,8.91 435 | 2012-07-28,8.95 436 | 2012-07-31,9.22 437 | 2012-08-03,10.12 438 | 2012-08-06,11.21 439 | 2012-08-09,11.35 440 | 2012-08-12,11.64 441 | 2012-08-15,12.3 442 | 2012-08-18,15.37 443 | 2012-08-21,10.45 444 | 2012-08-24,10.25 445 | 2012-08-27,10.99 446 | 2012-08-30,11.14 447 | 2012-09-02,10.36 448 | 2012-09-05,10.59 449 | 2012-09-08,11.27 450 | 2012-09-11,11.14 451 | 2012-09-14,11.48 452 | 2012-09-17,11.98 453 | 2012-09-20,12.63 454 | 2012-09-23,12.4 455 | 2012-09-26,12.24 456 | 2012-09-29,12.46 457 | 2012-10-02,12.58 458 | 2012-10-05,13.07 459 | 2012-10-08,12.58 460 | 2012-10-11,12.16 461 | 2012-10-14,12.1 462 | 2012-10-17,11.99 463 | 2012-10-20,11.94 464 | 2012-10-23,11.86 465 | 2012-10-26,11.56 466 | 2012-10-28,10.69 467 | 2012-10-31,11.17 468 | 2012-11-03,10.62 469 | 2012-11-06,10.97 470 | 2012-11-09,11.04 471 | 2012-11-12,11.17 472 | 2012-11-15,11.28 473 | 2012-11-18,11.82 474 | 2012-11-21,11.9 475 | 2012-11-24,12.46 476 | 2012-11-27,12.5 477 | 2012-11-30,12.66 478 | 2012-12-03,12.75 479 | 2012-12-06,13.69 480 | 2012-12-09,13.53 481 | 2012-12-12,13.8 482 | 2012-12-15,13.75 483 | 2012-12-18,13.4 484 | 2012-12-21,13.63 485 | 2012-12-24,13.45 486 | 2012-12-27,13.51 487 | 2012-12-30,13.57 488 | 2013-01-02,13.42 489 | 2013-01-05,13.54 490 | 2013-01-08,13.84 491 | 2013-01-11,14.31 492 | 2013-01-14,14.34 493 | 2013-01-17,15.53 494 | 2013-01-20,16.15 495 | 2013-01-23,17.97 496 | 2013-01-26,17.71 497 | 2013-01-29,19.78 498 | 2013-02-01,21.25 499 | 2013-02-04,20.99 500 | 2013-02-07,22.15 501 | 2013-02-10,23.97 502 | 2013-02-13,24.3 503 | 2013-02-16,27.39 504 | 2013-02-19,29.48 505 | 2013-02-22,30.52 506 | 2013-02-25,30.4 507 | 2013-02-28,33.36 508 | 2013-03-03,34.25 509 | 2013-03-06,42 510 | 2013-03-09,46.93 511 | 2013-03-12,44.32 512 | 2013-03-15,46.9 513 | 2013-03-18,52.12 514 | 2013-03-21,70.25 515 | 2013-03-24,71.93 516 | 2013-03-27,88.8 517 | 2013-03-30,92.5 518 | 2013-04-03,117.34 519 | 2013-04-06,142.1 520 | 2013-04-09,186.96 521 | 2013-04-12,124.9 522 | 2013-04-15,100 523 | 2013-04-18,93.9 524 | 2013-04-21,127.5 525 | 2013-04-24,142.5 526 | 2013-04-27,137 527 | 2013-04-30,144.54 528 | 2013-05-03,103.3 529 | 2013-05-06,115.98 530 | 2013-05-09,113.35 531 | 2013-05-12,115.68 532 | 2013-05-15,112 533 | 2013-05-18,123.32 534 | 2013-05-21,122.02 535 | 2013-05-24,126.7 536 | 2013-05-27,133.5 537 | 2013-05-30,132.3 538 | 2013-06-02,129.3 539 | 2013-06-05,121.42 540 | 2013-06-08,111.5 541 | 2013-06-11,106.1 542 | 2013-06-14,103.9 543 | 2013-06-17,99.9 544 | 2013-06-20,107.68 545 | 2013-06-23,108.35 546 | 2013-06-26,103.89 547 | 2013-06-29,94.65 548 | 2013-07-02,87 549 | 2013-07-05,80.04 550 | 2013-07-08,75 551 | 2013-07-11,87.9 552 | 2013-07-14,98 553 | 2013-07-17,97.05 554 | 2013-07-20,92 555 | 2013-07-23,91.99 556 | 2013-07-26,97 557 | 2013-07-29,98.7 558 | 2013-08-01,106.2 559 | 2013-08-04,104.95 560 | 2013-08-07,106.56 561 | 2013-08-10,102.8 562 | 2013-08-13,106.64 563 | 2013-08-16,98.08 564 | 2013-08-19,99.3 565 | 2013-08-22,110.43 566 | 2013-08-25,109.04 567 | 2013-08-28,117.72 568 | 2013-08-31,124.84 569 | 2013-09-03,130.09 570 | 2013-09-06,122.63 571 | 2013-09-09,118.18 572 | 2013-09-12,126.54 573 | 2013-09-15,124.05 574 | 2013-09-18,139.15 575 | 2013-09-21,123.04 576 | 2013-09-24,122.65 577 | 2013-09-27,124.65 578 | 2013-09-30,127.01 579 | 2013-10-03,103.85 580 | 2013-10-06,121.2 581 | 2013-10-09,124.12 582 | 2013-10-12,127.41 583 | 2013-10-15,135.17 584 | 2013-10-18,143.94 585 | 2013-10-21,186.12 586 | 2013-10-24,203.7 587 | 2013-10-27,179.56 588 | 2013-10-29,216 589 | 2013-11-01,203 590 | 2013-11-04,229.95 591 | 2013-11-07,291.02 592 | 2013-11-10,328 593 | 2013-11-13,393 594 | 2013-11-16,437.24 595 | 2013-11-19,547 596 | 2013-11-22,795 597 | 2013-11-25,814.56 598 | 2013-11-28,1014.1 599 | 2013-12-01,955.01 600 | 2013-12-04,1136.9 601 | 2013-12-07,705.91 602 | 2013-12-10,978.76 603 | 2013-12-13,885 604 | 2013-12-16,690 605 | 2013-12-19,685.3 606 | 2013-12-22,614.11 607 | 2013-12-25,679.02 608 | 2013-12-28,715 609 | 2013-12-31,732 610 | 2014-01-03,807.39 611 | 2014-01-06,915.69 612 | 2014-01-09,826.28 613 | 2014-01-12,844.04 614 | 2014-01-15,841.83 615 | 2014-01-18,811.2 616 | 2014-01-21,824.78 617 | 2014-01-24,780.02 618 | 2014-01-27,747.57 619 | 2014-01-30,800 620 | 2014-02-02,814.34 621 | 2014-02-05,781 622 | 2014-02-08,680.8 623 | 2014-02-11,675.1 624 | 2014-02-14,670.29 625 | 2014-02-17,629.96 626 | 2014-02-20,563 627 | 2014-02-23,611.05 628 | 2014-02-26,585.21 629 | 2014-03-01,567.48 630 | 2014-03-04,673.28 631 | 2014-03-07,631.99 632 | 2014-03-10,629.33 633 | 2014-03-13,641.01 634 | 2014-03-16,634.99 635 | 2014-03-19,611.2 636 | 2014-03-22,563.01 637 | 2014-03-25,585.79 638 | 2014-03-28,499.6 639 | 2014-04-01,457.49 640 | 2014-04-04,448.72 641 | 2014-04-07,458 642 | 2014-04-10,441.93 643 | 2014-04-13,423.37 644 | 2014-04-16,523 645 | 2014-04-19,482.11 646 | 2014-04-22,498.38 647 | 2014-04-25,502.15 648 | 2014-04-28,438.8 649 | 2014-05-01,452.03 650 | 2014-05-04,440 651 | 2014-05-07,428.01 652 | 2014-05-10,449 653 | 2014-05-13,442.45 654 | 2014-05-16,446.53 655 | 2014-05-19,446.89 656 | 2014-05-22,493.97 657 | 2014-05-25,527.91 658 | 2014-05-28,572.7 659 | 2014-05-31,621.3 660 | 2014-06-03,662 661 | 2014-06-06,661.48 662 | 2014-06-09,657.11 663 | 2014-06-12,624.97 664 | 2014-06-15,572.28 665 | 2014-06-18,608 666 | 2014-06-21,593.48 667 | 2014-06-24,588.25 668 | 2014-06-27,577.34 669 | 2014-06-30,599.99 670 | 2014-07-03,650.49 671 | 2014-07-06,631 672 | 2014-07-09,624.97 673 | 2014-07-12,634 674 | 2014-07-15,621.21 675 | 2014-07-18,625.8 676 | 2014-07-21,627 677 | 2014-07-24,620.43 678 | 2014-07-27,595.9 679 | 2014-07-30,585.5 680 | 2014-08-02,595.76 681 | 2014-08-05,588.5 682 | 2014-08-08,585.02 683 | 2014-08-11,590.74 684 | 2014-08-14,549.98 685 | 2014-08-17,523.88 686 | 2014-08-20,490 687 | 2014-08-23,515.69 688 | 2014-08-26,501.55 689 | 2014-08-29,506.61 690 | 2014-09-01,478.87 691 | 2014-09-04,474.5 692 | 2014-09-07,479.59 693 | 2014-09-10,473.35 694 | 2014-09-13,474.62 695 | 2014-09-16,470.83 696 | 2014-09-19,425.56 697 | 2014-09-22,401.15 698 | 2014-09-25,423.68 699 | 2014-09-28,400.39 700 | 2014-10-01,390.18 701 | 2014-10-04,358.9 702 | 2014-10-07,327.61 703 | 2014-10-10,363.61 704 | 2014-10-13,380.8 705 | 2014-10-16,394.84 706 | 2014-10-19,391 707 | 2014-10-22,385.89 708 | 2014-10-25,358.49 709 | 2014-10-27,350.9 710 | 2014-10-30,345.3 711 | 2014-11-02,324.36 712 | 2014-11-05,338.63 713 | 2014-11-08,346.94 714 | 2014-11-11,369.41 715 | 2014-11-14,399.11 716 | 2014-11-17,388.87 717 | 2014-11-20,356.47 718 | 2014-11-23,367.12 719 | 2014-11-26,366.86 720 | 2014-11-29,375.59 721 | 2014-12-02,379.62 722 | 2014-12-05,376 723 | 2014-12-08,362.99 724 | 2014-12-11,348.97 725 | 2014-12-14,357.8 726 | 2014-12-17,321.34 727 | 2014-12-20,331.52 728 | 2014-12-23,336.95 729 | 2014-12-26,329.94 730 | 2014-12-29,313.4 731 | 2015-01-01,314.81 732 | 2015-01-04,263.17 733 | 2015-01-07,297.99 734 | 2015-01-10,275.97 735 | 2015-01-13,222 736 | 2015-01-16,208.13 737 | 2015-01-19,216.01 738 | 2015-01-22,233.51 739 | 2015-01-25,254.32 740 | 2015-01-28,236.2 741 | 2015-01-31,219.25 742 | 2015-02-03,227.53 743 | 2015-02-06,222.36 744 | 2015-02-09,219.93 745 | 2015-02-12,222.33 746 | 2015-02-15,234.18 747 | 2015-02-18,237.44 748 | 2015-02-21,245.41 749 | 2015-02-24,239.94 750 | 2015-02-27,252.11 751 | 2015-03-02,275.87 752 | 2015-03-05,273.11 753 | 2015-03-08,275 754 | 2015-03-11,296.56 755 | 2015-03-14,282.2 756 | 2015-03-17,284.48 757 | 2015-03-20,262.1 758 | 2015-03-23,265.99 759 | 2015-03-26,249.23 760 | 2015-03-30,242.34 761 | 2015-04-02,246.49 762 | 2015-04-05,253.67 763 | 2015-04-08,253.9 764 | 2015-04-11,236 765 | 2015-04-14,223.01 766 | 2015-04-17,227.5 767 | 2015-04-20,222.61 768 | 2015-04-23,233.59 769 | 2015-04-26,226.29 770 | 2015-04-29,225.2 771 | 2015-05-02,230.97 772 | 2015-05-05,238.25 773 | 2015-05-08,237.16 774 | 2015-05-11,239.11 775 | 2015-05-14,235.97 776 | 2015-05-17,236.63 777 | 2015-05-20,231.4 778 | 2015-05-23,238.8 779 | 2015-05-26,235.59 780 | 2015-05-29,236.44 781 | 2015-06-01,228.34 782 | 2015-06-04,225.4 783 | 2015-06-07,224.99 784 | 2015-06-10,228.88 785 | 2015-06-13,229.6 786 | 2015-06-16,236 787 | 2015-06-19,248.26 788 | 2015-06-22,243.55 789 | 2015-06-25,240.2 790 | 2015-06-28,251.21 791 | 2015-07-01,262.43 792 | 2015-07-04,256.12 793 | 2015-07-07,268.53 794 | 2015-07-10,269 795 | 2015-07-13,310.55 796 | 2015-07-16,285.66 797 | 2015-07-19,276.74 798 | 2015-07-22,276.76 799 | 2015-07-25,289 800 | 2015-07-28,293.93 801 | 2015-07-31,288.45 802 | 2015-08-03,282.26 803 | 2015-08-06,281 804 | 2015-08-09,262.22 805 | 2015-08-12,270.98 806 | 2015-08-15,265.93 807 | 2015-08-18,256.66 808 | 2015-08-21,235.31 809 | 2015-08-24,228.14 810 | 2015-08-27,225.04 811 | 2015-08-30,229.63 812 | 2015-09-02,227.97 813 | 2015-09-05,230.73 814 | 2015-09-08,240.47 815 | 2015-09-11,238.81 816 | 2015-09-14,230 817 | 2015-09-17,228.33 818 | 2015-09-20,230.25 819 | 2015-09-23,230.42 820 | 2015-09-26,235.22 821 | 2015-09-29,239.14 822 | 2015-10-02,238.03 823 | 2015-10-05,238.4 824 | 2015-10-08,243.01 825 | 2015-10-11,245.72 826 | 2015-10-14,249.98 827 | 2015-10-17,262.26 828 | 2015-10-20,263.59 829 | 2015-10-23,274.35 830 | 2015-10-25,282.8 831 | 2015-10-28,304.79 832 | 2015-10-31,310.18 833 | 2015-11-03,404.5 834 | 2015-11-06,373.69 835 | 2015-11-09,380.62 836 | 2015-11-12,340.81 837 | 2015-11-15,318.97 838 | 2015-11-18,333.66 839 | 2015-11-21,326.31 840 | 2015-11-24,319.64 841 | 2015-11-27,358 842 | 2015-11-30,377.27 843 | 2015-12-03,361.47 844 | 2015-12-06,387.3 845 | 2015-12-09,416.49 846 | 2015-12-12,436.2 847 | 2015-12-15,463.98 848 | 2015-12-18,463 849 | 2015-12-21,438.35 850 | 2015-12-24,456 851 | 2015-12-27,422.42 852 | 2015-12-30,428.23 853 | 2016-01-02,432.76 854 | 2016-01-05,432.43 855 | 2016-01-08,452.64 856 | 2016-01-11,447.98 857 | 2016-01-14,429.55 858 | 2016-01-17,380.16 859 | 2016-01-20,420.35 860 | 2016-01-23,385.09 861 | 2016-01-26,391.66 862 | 2016-01-29,378.18 863 | 2016-02-01,371.99 864 | 2016-02-04,388 865 | 2016-02-07,375 866 | 2016-02-10,379.14 867 | 2016-02-13,389.88 868 | 2016-02-16,407 869 | 2016-02-19,419.98 870 | 2016-02-22,436.76 871 | 2016-02-25,423.46 872 | 2016-02-28,431.89 873 | 2016-03-02,422.5 874 | 2016-03-05,399.17 875 | 2016-03-08,412.15 876 | 2016-03-11,420.11 877 | 2016-03-14,414.99 878 | 2016-03-17,418.49 879 | 2016-03-20,411.81 880 | 2016-03-23,417.96 881 | 2016-03-26,416.96 882 | 2016-03-30,415.83 883 | 2016-04-02,416.31 884 | 2016-04-05,419.71 885 | 2016-04-08,419.95 886 | 2016-04-11,420.75 887 | 2016-04-14,423.87 888 | 2016-04-17,430.58 889 | 2016-04-20,435.95 890 | 2016-04-23,447.7 891 | 2016-04-26,462.5 892 | 2016-04-29,449.98 893 | 2016-05-02,453 894 | 2016-05-05,446.84 895 | 2016-05-08,459.02 896 | 2016-05-11,450.78 897 | 2016-05-14,455.82 898 | 2016-05-17,454 899 | 2016-05-20,436.05 900 | 2016-05-23,438.47 901 | 2016-05-26,448.7 902 | 2016-05-29,526.64 903 | 2016-06-01,531.97 904 | 2016-06-04,567.88 905 | 2016-06-07,583.72 906 | 2016-06-10,574.32 907 | 2016-06-13,665.85 908 | 2016-06-16,693.88 909 | 2016-06-19,751.96 910 | 2016-06-22,664.46 911 | 2016-06-25,665 912 | 2016-06-28,651.85 913 | 2016-07-01,667.95 914 | 2016-07-04,656.97 915 | 2016-07-07,673.76 916 | 2016-07-10,647.41 917 | 2016-07-13,664.5 918 | 2016-07-16,663.19 919 | 2016-07-19,673.46 920 | 2016-07-22,664 921 | 2016-07-25,661.48 922 | 2016-07-28,655.37 923 | 2016-07-31,654.68 924 | 2016-08-03,530.74 925 | 2016-08-06,572.72 926 | 2016-08-09,591.69 927 | 2016-08-12,586.01 928 | 2016-08-15,567.34 929 | 2016-08-18,570.92 930 | 2016-08-21,577.52 931 | 2016-08-24,581.98 932 | 2016-08-27,577.77 933 | 2016-08-30,571.5 934 | 2016-09-02,571 935 | 2016-09-05,603.95 936 | 2016-09-08,615.33 937 | 2016-09-11,621.65 938 | 2016-09-14,608.82 939 | 2016-09-17,607.04 940 | 2016-09-20,608.66 941 | 2016-09-23,594.08 942 | 2016-09-26,598.98 943 | 2016-09-29,603.85 944 | 2016-10-02,612.98 945 | 2016-10-05,607.18 946 | 2016-10-08,614.74 947 | 2016-10-11,614.77 948 | 2016-10-14,634.02 949 | 2016-10-17,638.97 950 | 2016-10-20,627.72 951 | 2016-10-23,653.25 952 | 2016-10-26,651.45 953 | 2016-10-29,685.91 954 | 2016-10-31,697.01 955 | 2016-11-03,683.69 956 | 2016-11-06,709.96 957 | 2016-11-09,721.5 958 | 2016-11-12,702.28 959 | 2016-11-15,711.73 960 | 2016-11-18,748.98 961 | 2016-11-21,736.97 962 | 2016-11-24,735.64 963 | 2016-11-27,727.31 964 | 2016-11-30,742.05 965 | 2016-12-03,762.97 966 | 2016-12-06,758.99 967 | 2016-12-09,769.08 968 | 2016-12-12,777.99 969 | 2016-12-15,775.88 970 | 2016-12-18,788.67 971 | 2016-12-21,834.97 972 | 2016-12-24,892.6 973 | 2016-12-27,930.34 974 | 2016-12-30,958.12 975 | 2017-01-02,1013.42 976 | 2017-01-05,999.65 977 | 2017-01-08,910.49 978 | 2017-01-11,780.92 979 | 2017-01-14,819.55 980 | 2017-01-17,906.6 981 | 2017-01-20,895.64 982 | 2017-01-23,919.97 983 | 2017-01-26,915.05 984 | 2017-01-29,912.19 985 | 2017-02-01,983.42 986 | 2017-02-04,1034.07 987 | 2017-02-07,1052.84 988 | 2017-02-10,997.59 989 | 2017-02-13,1001.2 990 | 2017-02-16,1035.2 991 | 2017-02-19,1050.87 992 | 2017-02-22,1130.01 993 | 2017-02-25,1150.37 994 | 2017-02-28,1190.89 995 | 2017-03-03,1287 996 | 2017-03-06,1279.5 997 | 2017-03-09,1192.09 998 | 2017-03-12,1227.68 999 | 2017-03-15,1257 1000 | 2017-03-18,967.69 1001 | 2017-03-21,1113 1002 | 2017-03-24,927.93 1003 | 2017-03-28,1041.04 1004 | 2017-03-31,1034.74 1005 | 2017-04-03,1079.99 1006 | 2017-04-06,1133.53 1007 | 2017-04-09,1184.03 1008 | 2017-04-12,1219.09 1009 | 2017-04-15,1170.36 1010 | 2017-04-18,1176.97 1011 | 2017-04-21,1236.63 1012 | 2017-04-24,1240.84 1013 | 2017-04-27,1288.02 1014 | 2017-04-30,1333 1015 | 2017-05-03,1447.55 1016 | 2017-05-06,1518.75 1017 | 2017-05-09,1651.1 1018 | 2017-05-12,1829 1019 | 2017-05-15,1780 1020 | 2017-05-18,1783.98 1021 | 2017-05-21,2008.84 1022 | 2017-05-24,2256.32 1023 | 2017-05-27,2279.82 1024 | 2017-05-30,2290.02 1025 | 2017-06-02,2409.93 1026 | 2017-06-05,2529.53 1027 | 2017-06-08,2683.03 1028 | 2017-06-11,2898.63 1029 | 2017-06-14,2706 1030 | 2017-06-17,2477.94 1031 | 2017-06-20,2600 1032 | 2017-06-23,2713.48 1033 | 2017-06-26,2502.03 1034 | 2017-06-29,2558.3 1035 | 2017-07-02,2421.26 1036 | 2017-07-05,2598.89 1037 | 2017-07-08,2502.86 1038 | 2017-07-11,2327.09 1039 | 2017-07-14,2338.49 1040 | 2017-07-17,1910.96 1041 | 2017-07-20,2265.21 1042 | 2017-07-23,2825.51 1043 | 2017-07-26,2564.3 1044 | 2017-07-29,2784.8 1045 | 2017-08-01,2862.9 1046 | 2017-08-04,2790 1047 | 2017-08-07,3210.2 1048 | 2017-08-10,3340.28 1049 | 2017-08-13,3868.52 1050 | 2017-08-16,4179.97 1051 | 2017-08-19,4104.71 1052 | 2017-08-22,3986.28 1053 | 2017-08-25,4331.77 1054 | 2017-08-28,4339.05 1055 | 2017-08-31,4582.52 1056 | 2017-09-03,4585.57 1057 | 2017-09-06,4385.02 1058 | 2017-09-09,4312.26 1059 | 2017-09-12,4198.59 1060 | 2017-09-15,3216.43 1061 | 2017-09-18,3678.53 1062 | 2017-09-21,3894.48 1063 | 2017-09-24,3777.62 1064 | 2017-09-27,3881 1065 | 2017-09-30,4164.27 1066 | 2017-10-03,4394.07 1067 | 2017-10-06,4318.58 1068 | 2017-10-09,4605.66 1069 | 2017-10-12,4822.17 1070 | 2017-10-15,5825.99 1071 | 2017-10-18,5594.66 1072 | 2017-10-21,5986.44 1073 | 2017-10-24,5900.59 1074 | 2017-10-27,5889.82 1075 | 2017-10-29,6136.49 1076 | 2017-11-01,6751.98 1077 | 2017-11-04,7365.99 1078 | 2017-11-07,7128.64 1079 | 2017-11-10,6569.22 1080 | 2017-11-13,6493.63 1081 | 2017-11-16,7868.77 1082 | 2017-11-19,8049.72 1083 | 2017-11-22,8236.72 1084 | 2017-11-25,8768.8 1085 | 2017-11-28,9919 1086 | 2017-12-01,10879.88 1087 | 2017-12-04,11591.22 1088 | 2017-12-07,16860.88 1089 | 2017-12-10,15068.95 1090 | 2017-12-13,16252.31 1091 | 2017-12-16,19279.9 1092 | 2017-12-19,17382.94 1093 | 2017-12-22,13776.61 1094 | 2017-12-25,13740.94 1095 | 2017-12-28,14214.01 1096 | 2017-12-31,13796 1097 | 2018-01-03,15039.24 1098 | 2018-01-06,17155.95 1099 | 2018-01-09,14437.42 1100 | 2018-01-12,13791.19 1101 | 2018-01-15,13554.14 1102 | 2018-01-18,11174.82 1103 | 2018-01-21,11513.42 1104 | 2018-01-24,11392.03 1105 | 2018-01-27,11431.37 1106 | 2018-01-30,10082.52 1107 | 2018-02-02,8852.73 1108 | 2018-02-05,6925.46 1109 | 2018-02-08,8245.08 1110 | 2018-02-11,8068.02 1111 | 2018-02-14,9471.64 1112 | 2018-02-17,11085.83 1113 | 2018-02-20,11245.98 1114 | 2018-02-23,10171.3 1115 | 2018-02-26,10319.46 1116 | 2018-03-01,10931.12 1117 | 2018-03-04,11516.83 1118 | 2018-03-07,9920.46 1119 | 2018-03-10,8777.37 1120 | 2018-03-13,9153.54 1121 | 2018-03-16,8297.89 1122 | 2018-03-19,8605.64 1123 | 2018-03-22,8725.37 1124 | 2018-03-26,8457.96 1125 | 2018-03-29,7950.61 1126 | 2018-04-01,6937.56 1127 | 2018-04-04,7426.48 1128 | 2018-04-07,6634.68 1129 | 2018-04-10,6784.41 1130 | 2018-04-13,7941.46 1131 | 2018-04-16,8368.1 1132 | 2018-04-19,8175.96 1133 | 2018-04-22,8930.6 1134 | 2018-04-25,9658.11 1135 | 2018-04-28,8928.55 1136 | 2018-05-01,9239.55 1137 | 2018-05-04,9753.35 1138 | 2018-05-07,9631.44 1139 | 2018-05-10,9310.37 1140 | 2018-05-13,8463.52 1141 | 2018-05-16,8471.06 1142 | 2018-05-19,8239.08 1143 | 2018-05-22,8396.63 1144 | 2018-05-25,7576.78 1145 | 2018-05-28,7344.56 1146 | 2018-05-31,7386.72 1147 | 2018-06-03,7637.14 1148 | 2018-06-06,7619.43 1149 | 2018-06-09,7615.54 1150 | 2018-06-12,6879.31 1151 | 2018-06-15,6637.41 1152 | 2018-06-18,6445.79 1153 | 2018-06-21,6760.83 1154 | 2018-06-24,6170.46 1155 | 2018-06-27,6097.46 1156 | 2018-06-30,6223.28 1157 | 2018-07-03,6626.44 1158 | 2018-07-06,6555.51 1159 | 2018-07-09,6724.04 1160 | 2018-07-12,6403.18 1161 | 2018-07-15,6248.84 1162 | 2018-07-18,7321.62 1163 | 2018-07-21,7334.99 1164 | 2018-07-24,7715.1 1165 | 2018-07-27,7939.81 1166 | 2018-07-30,8220.91 1167 | 2018-08-02,7607.7 1168 | 2018-08-05,7011.28 1169 | 2018-08-08,6718.23 1170 | 2018-08-11,6138.96 1171 | 2018-08-14,6252.13 1172 | 2018-08-17,6312.75 1173 | 2018-08-20,6486.58 1174 | 2018-08-23,6354.57 1175 | 2018-08-26,6738.27 1176 | 2018-08-29,7078.19 1177 | 2018-09-01,7018.78 1178 | 2018-09-04,7265.08 1179 | 2018-09-07,6501.19 1180 | 2018-09-10,6240.98 1181 | 2018-09-13,6326.04 1182 | 2018-09-16,6522.39 1183 | 2018-09-19,6342.39 1184 | 2018-09-22,6756.12 1185 | 2018-09-25,6583.45 1186 | 2018-09-28,6686.08 1187 | 2018-10-01,6611.02 1188 | 2018-10-04,6483.73 1189 | 2018-10-07,6573.62 1190 | 2018-10-10,6626.85 1191 | 2018-10-13,6247 1192 | 2018-10-16,6599.17 1193 | 2018-10-19,6509.61 1194 | 2018-10-22,6504.78 1195 | 2018-10-25,6489.77 1196 | 2018-10-28,6457.21 1197 | 2018-10-30,6301.61 1198 | 2018-11-02,6390.42 1199 | 2018-11-05,6437.76 1200 | 2018-11-08,6444.97 1201 | 2018-11-11,6408.53 1202 | 2018-11-14,5756.77 1203 | 2018-11-17,5572.44 1204 | 2018-11-20,4491.98 1205 | 2018-11-23,4352.98 1206 | 2018-11-26,3793.35 1207 | 2018-11-29,4278.77 1208 | 2018-12-02,4140.6 1209 | 2018-12-05,3744.98 1210 | 2018-12-08,3453.66 1211 | 2018-12-11,3407.28 1212 | 2018-12-14,3242.42 1213 | 2018-12-17,3556.54 1214 | 2018-12-20,4135.19 1215 | 2018-12-23,3995.17 1216 | 2018-12-26,3848.21 1217 | 2018-12-29,3770.36 1218 | 2019-01-01,3855.88 1219 | 2019-01-04,3856.62 1220 | 2019-01-07,4032.25 1221 | 2019-01-10,3646.25 1222 | 2019-01-13,3531.96 1223 | 2019-01-16,3621.43 1224 | 2019-01-19,3703.98 1225 | 2019-01-22,3587.35 1226 | 2019-01-25,3577.79 1227 | 2019-01-28,3448.58 1228 | 2019-01-31,3444.81 1229 | 2019-02-03,3456.02 1230 | 2019-02-06,3405.7 1231 | 2019-02-09,3664.38 1232 | 2019-02-12,3632.42 1233 | 2019-02-15,3608.2 1234 | 2019-02-18,3910.8 1235 | 2019-02-21,3944.88 1236 | 2019-02-24,3766.89 1237 | 2019-02-27,3833.23 1238 | 2019-03-02,3831.44 1239 | 2019-03-05,3872.25 1240 | 2019-03-08,3875.96 1241 | 2019-03-11,3881.09 1242 | 2019-03-14,3885.21 1243 | 2019-03-17,3994.92 1244 | 2019-03-20,4056.4 1245 | 2019-03-23,4011.92 1246 | 2019-03-26,3947.74 1247 | 2019-03-29,4115.55 1248 | 2019-04-02,4152.53 1249 | 2019-04-05,4911.24 1250 | 2019-04-08,5189.39 1251 | 2019-04-11,5310.18 1252 | 2019-04-14,5064.62 1253 | 2019-04-17,5196.65 1254 | 2019-04-20,5277.04 1255 | 2019-04-23,5377.19 1256 | 2019-04-26,5195.61 1257 | 2019-04-29,5301.29 1258 | 2019-05-02,5326.67 1259 | 2019-05-05,5771.08 1260 | 2019-05-08,5755.72 1261 | 2019-05-11,6348.02 1262 | 2019-05-14,7823.11 1263 | 2019-05-17,7885.96 1264 | 2019-05-20,8193.7 1265 | 2019-05-23,7625.93 1266 | 2019-05-26,8071.45 1267 | 2019-05-29,8719.88 1268 | 2019-06-01,8553.81 1269 | 2019-06-04,8134.92 1270 | 2019-06-07,7803.23 1271 | 2019-06-10,7640.61 1272 | 2019-06-13,8173.06 1273 | 2019-06-16,8859.47 1274 | 2019-06-19,9076.18 1275 | 2019-06-22,10209.38 1276 | 2019-06-25,11017.5 1277 | 2019-06-28,11132.85 1278 | 2019-07-01,10737.73 1279 | 2019-07-04,11984.76 1280 | 2019-07-07,11232.04 1281 | 2019-07-10,12586.78 1282 | 2019-07-13,11803.97 1283 | 2019-07-16,10873.5 1284 | 2019-07-19,10638.56 1285 | 2019-07-22,10587.41 1286 | 2019-07-25,9772.17 1287 | 2019-07-28,9473.99 1288 | 2019-07-31,9589.13 1289 | 2019-08-03,10529.55 1290 | 2019-08-06,11787.99 1291 | 2019-08-09,11996.41 1292 | 2019-08-12,11566.84 1293 | 2019-08-15,10016.96 1294 | 2019-08-18,10214.52 1295 | 2019-08-21,10760.56 1296 | 2019-08-24,10405.81 1297 | 2019-08-27,10360.28 1298 | 2019-08-30,9484.55 1299 | 2019-09-02,9769.79 1300 | 2019-09-05,10584.16 1301 | 2019-09-08,10487.21 1302 | 2019-09-11,10101.03 1303 | 2019-09-14,10363.9 1304 | 2019-09-17,10265.63 1305 | 2019-09-20,10275.88 1306 | 2019-09-23,10033.05 1307 | 2019-09-26,8432.23 1308 | 2019-09-29,8225 1309 | 2019-10-02,8322.92 1310 | 2019-10-05,8155.48 1311 | 2019-10-08,8212.02 1312 | 2019-10-11,8586.9 1313 | 2019-10-14,8283.76 1314 | 2019-10-17,8002.51 1315 | 2019-10-20,7960.04 1316 | 2019-10-23,8026.76 1317 | 2019-10-26,8666.79 1318 | 2019-10-28,9218.76 1319 | 2019-10-31,9147.98 1320 | 2019-11-03,9206.16 1321 | 2019-11-06,9343.34 1322 | 2019-11-09,8809.41 1323 | 2019-11-12,8801.52 1324 | 2019-11-15,8457.69 1325 | 2019-11-18,8175.99 1326 | 2019-11-21,7617.07 1327 | 2019-11-24,6907.4 1328 | 2019-11-27,7523.83 1329 | 2019-11-30,7557.72 1330 | 2019-12-03,7296.77 1331 | 2019-12-06,7547.19 1332 | 2019-12-09,7337.42 1333 | 2019-12-12,7189.16 1334 | 2019-12-15,7111.14 1335 | 2019-12-18,7284.29 1336 | 2019-12-21,7143.2 1337 | 2019-12-24,7250.69 1338 | 2019-12-27,7243.93 1339 | 2019-12-30,7219.6 1340 | 2020-01-02,6944.33 1341 | 2020-01-05,7351.57 1342 | 2020-01-08,8042.65 1343 | 2020-01-11,8021.49 1344 | 2020-01-14,8842.42 1345 | 2020-01-17,8900.34 1346 | 2020-01-20,8626.47 1347 | 2020-01-23,8388.11 1348 | 2020-01-26,8588.42 1349 | 2020-01-29,9279.81 1350 | 2020-02-01,9378.09 1351 | 2020-02-04,9162.14 1352 | 2020-02-07,9807.54 1353 | 2020-02-10,9854.79 1354 | 2020-02-13,10242.43 1355 | 2020-02-16,9937.67 1356 | 2020-02-19,9604.72 1357 | 2020-02-22,9669.63 1358 | 2020-02-25,9309.15 1359 | 2020-02-28,8712.35 1360 | 2020-03-02,8912.82 1361 | 2020-03-05,9067.39 1362 | 2020-03-08,8039.38 1363 | 2020-03-11,7936.65 1364 | 2020-03-14,5166.26 1365 | 2020-03-17,5357.61 1366 | 2020-03-20,6226.44 1367 | 2020-03-23,6502.16 1368 | 2020-03-26,6763.75 1369 | 2020-03-30,5885.41 1370 | 2020-04-02,6652.87 1371 | 2020-04-05,6871.69 1372 | 2020-04-08,7205.55 1373 | 2020-04-11,6873.24 1374 | 2020-04-14,6857.66 1375 | 2020-04-17,7112.27 1376 | 2020-04-20,7130.04 1377 | 2020-04-23,7130.99 1378 | 2020-04-26,7549.52 1379 | 2020-04-29,7765.33 1380 | 2020-05-02,8824.66 1381 | 2020-05-05,8885.93 1382 | 2020-05-08,10002.48 1383 | 2020-05-11,8754.46 1384 | 2020-05-14,9305.93 1385 | 2020-05-17,9385.7 1386 | 2020-05-20,9785.74 1387 | 2020-05-23,9167.26 1388 | 2020-05-26,8899.66 1389 | 2020-05-29,9569.21 1390 | 2020-06-01,9450.84 1391 | 2020-06-04,9658.04 1392 | 2020-06-07,9670.43 1393 | 2020-06-10,9775.15 1394 | 2020-06-13,9459.97 1395 | 2020-06-16,9426.7 1396 | 2020-06-19,9380.03 1397 | 2020-06-22,9284.78 1398 | 2020-06-25,9276.58 1399 | 2020-06-28,9004.23 1400 | 2020-07-01,9133.97 1401 | 2020-07-04,9072.42 1402 | 2020-07-07,9348.91 1403 | 2020-07-10,9238.04 1404 | 2020-07-13,9295.9 1405 | 2020-07-16,9193.51 1406 | 2020-07-19,9174.71 1407 | 2020-07-22,9392.66 1408 | 2020-07-25,9551.28 1409 | 2020-07-28,11042.4 1410 | 2020-07-31,11114.93 1411 | 2020-08-03,11077.77 1412 | 2020-08-06,11750.28 1413 | 2020-08-09,11767.6 1414 | 2020-08-12,11392.43 1415 | 2020-08-15,11774.38 1416 | 2020-08-18,12293.72 1417 | 2020-08-21,11865.82 1418 | 2020-08-24,11653.02 1419 | 2020-08-27,11467.37 1420 | 2020-08-30,11481.64 1421 | 2020-09-02,11923.25 1422 | 2020-09-05,10467.89 1423 | 2020-09-08,10367.74 1424 | 2020-09-11,10352.66 1425 | 2020-09-14,10330.77 1426 | 2020-09-17,10948.43 1427 | 2020-09-20,11081.43 1428 | 2020-09-23,10532.22 1429 | 2020-09-26,10692.84 1430 | 2020-09-29,10692.33 1431 | 2020-10-02,10619.24 1432 | 2020-10-05,10673.46 1433 | 2020-10-08,10670.8 1434 | 2020-10-11,11302.67 1435 | 2020-10-14,11428.24 1436 | 2020-10-17,11327.57 1437 | 2020-10-20,11758.16 1438 | 2020-10-23,12990.25 1439 | 2020-10-25,13036.77 1440 | 2020-10-28,13289 1441 | 2020-10-31,13810.32 1442 | 2020-11-03,14023.31 1443 | 2020-11-06,15595.77 1444 | 2020-11-09,15328.53 1445 | 2020-11-12,16295.57 1446 | 2020-11-15,15968.16 1447 | 2020-11-18,17798.45 1448 | 2020-11-21,18699.75 1449 | 2020-11-24,19172.52 1450 | 2020-11-27,17138.87 1451 | 2020-11-30,19709.73 1452 | 2020-12-03,19454.54 1453 | 2020-12-06,19377.66 1454 | 2020-12-09,18554.15 1455 | 2020-12-12,18803.44 1456 | 2020-12-15,19439.75 1457 | 2020-12-18,23150.79 1458 | 2020-12-21,22745.48 1459 | 2020-12-24,23715.53 1460 | 2020-12-27,26246.58 1461 | 2020-12-30,28856.59 1462 | 2021-01-02,32195.46 1463 | 2021-01-05,34046.67 1464 | 2021-01-08,40670.25 1465 | 2021-01-11,35544.94 1466 | 2021-01-14,39158.47 1467 | 2021-01-17,35793.01 1468 | 2021-01-20,35538.98 1469 | 2021-01-23,32099.74 1470 | 2021-01-26,32541.8 1471 | 2021-01-29,34314.26 1472 | 2021-02-01,33522.9 1473 | 2021-02-04,37002.09 1474 | 2021-02-07,38928.1 1475 | 2021-02-10,44878.17 1476 | 2021-02-13,47185.19 1477 | 2021-02-16,49160.1 1478 | 2021-02-19,55916.5 1479 | 2021-02-22,54123.4 1480 | 2021-02-25,46800.42 1481 | 2021-02-28,45113.92 1482 | 2021-03-03,50477.7 1483 | 2021-03-06,48881.59 1484 | 2021-03-09,54881.52 1485 | 2021-03-12,57253.28 1486 | 2021-03-15,55754.72 1487 | 2021-03-18,57665.9 1488 | 2021-03-21,57411.17 1489 | 2021-03-24,52508.23 1490 | 2021-03-27,55863.93 1491 | 2021-03-31,58730.13 1492 | 2021-04-03,59031.32 1493 | 2021-04-06,59054.1 1494 | 2021-04-09,58048.59 1495 | 2021-04-12,59964.87 1496 | 2021-04-15,62969.12 1497 | 2021-04-18,60087.09 1498 | 2021-04-21,56507.91 1499 | 2021-04-24,51153.13 1500 | 2021-04-27,54056.64 1501 | 2021-04-30,53584.15 1502 | 2021-05-03,56610.46 1503 | 2021-05-06,57473.23 1504 | 2021-05-09,58928.81 1505 | 2021-05-12,56750 1506 | 2021-05-15,49922.52 1507 | 2021-05-18,43596.24 1508 | 2021-05-21,40784.32 1509 | 2021-05-24,34754.54 1510 | 2021-05-27,39266.04 1511 | 2021-05-30,34647.67 1512 | 2021-06-02,36662.64 1513 | 2021-06-05,36885.51 1514 | 2021-06-08,33514.87 1515 | 2021-06-11,36704.57 1516 | 2021-06-14,39066.82 1517 | 2021-06-17,38324.87 1518 | 2021-06-20,35524.17 1519 | 2021-06-23,32447.59 1520 | 2021-06-26,31640.58 1521 | 2021-06-29,34456.67 1522 | 2021-07-02,33536.88 1523 | 2021-07-05,35309.3 1524 | 2021-07-08,33839.04 1525 | 2021-07-11,33515.57 1526 | 2021-07-14,32686.56 1527 | 2021-07-17,31421.25 1528 | 2021-07-20,30815.94 1529 | 2021-07-23,32297.89 1530 | 2021-07-26,35365.2 1531 | 2021-07-29,40002.53 1532 | 2021-08-01,41659.06 1533 | 2021-08-04,38138 1534 | 2021-08-07,42825.95 1535 | 2021-08-10,46333.46 1536 | 2021-08-13,44417.78 1537 | 2021-08-16,47056.41 1538 | 2021-08-19,44777.86 1539 | 2021-08-22,48932.02 1540 | 2021-08-25,47744.58 1541 | 2021-08-28,49056.86 1542 | 2021-08-31,47074.77 1543 | 2021-09-03,49329.01 1544 | 2021-09-06,51769.06 1545 | 2021-09-09,46078.38 1546 | 2021-09-12,45144.79 1547 | 2021-09-15,47072.12 1548 | 2021-09-18,47263.6 1549 | 2021-09-21,42901.56 1550 | 2021-09-24,44888.96 1551 | 2021-09-27,43182.63 1552 | 2021-09-30,41522.38 1553 | 2021-10-03,47727.1 1554 | 2021-10-06,51505.83 1555 | 2021-10-09,53867.3 1556 | 2021-10-12,57452.01 1557 | 2021-10-15,57397.74 1558 | 2021-10-18,61546.21 1559 | 2021-10-21,66063.56 1560 | 2021-10-24,61277.28 1561 | 2021-10-27,60345.17 1562 | 2021-10-30,62249.18 1563 | 2021-11-01,61029.5 1564 | 2021-11-04,61441.83 1565 | 2021-11-07,63293.22 1566 | 2021-11-10,64976.73 1567 | 2021-11-13,64420.94 1568 | 2021-11-16,60172.26 1569 | 2021-11-19,58133.02 1570 | 2021-11-22,56301.52 1571 | 2021-11-25,58935.45 1572 | 2021-11-28,57292.28 1573 | 2021-12-01,57229.76 1574 | 2021-12-04,49253.86 1575 | 2021-12-07,50645.41 1576 | 2021-12-10,47137.46 1577 | 2021-12-13,46757.09 1578 | 2021-12-16,47658.38 1579 | 2021-12-19,46689.28 1580 | 2021-12-22,48628.35 1581 | 2021-12-25,50470.89 1582 | 2021-12-28,47601.26 1583 | 2021-12-31,46249.56 1584 | 2022-01-03,46441.99 1585 | 2022-01-06,43120.63 1586 | 2022-01-09,41864.44 1587 | 2022-01-12,43926 1588 | 2022-01-15,43146.53 1589 | 2022-01-18,42381.48 1590 | 2022-01-21,36480.85 1591 | 2022-01-24,36678.82 1592 | 2022-01-27,37146.85 1593 | 2022-01-30,37918.62 1594 | 2022-02-02,36912.68 1595 | 2022-02-05,41435.43 1596 | 2022-02-08,44133.28 1597 | 2022-02-11,42401.27 1598 | 2022-02-14,42580.94 1599 | 2022-02-17,40565.69 1600 | 2022-02-20,38382.32 1601 | 2022-02-23,37291.48 1602 | 2022-02-26,39103.91 1603 | 2022-03-01,44418.83 1604 | 2022-03-04,39141.25 1605 | 2022-03-07,38032.5 1606 | 2022-03-10,39437.89 1607 | 2022-03-13,37820.39 1608 | 2022-03-16,41133.08 1609 | 2022-03-19,42222.32 1610 | 2022-03-22,42372.67 1611 | 2022-03-25,44334.33 1612 | 2022-03-29,47115.93 1613 | -------------------------------------------------------------------------------- /ex00/input.csv: -------------------------------------------------------------------------------- 1 | 2005-02-02 | 0.1 2 | 2011-09-14 | 390.57 3 | 2010-11-03 | 517.239 4 | 2020-06-26 | 998.808 5 | 2012-07-09 | 1242.2 6 | 2019-07-11 | 700.492 7 | 2019-06-25 | 416.636 8 | 2017-05-22 | 507.753 9 | 2012-12-23 | 1146.69 10 | 2013-12-02 | 1293.19 11 | 2016-12-12 | 1602.81 12 | 2017-04-22 | 737.216 13 | 2014-11-26 | 782.601 14 | 2015-07-13 | 583.763 15 | 2013-04-12 | 353.688 16 | 2009-11-06 | 1018.34 17 | 2010-11-19 | 396.835 18 | 2020-03-29 | 1558.83 19 | 2014-01-26 | 1800.22 20 | 2016-07-30 | 515.044 21 | 2014-03-16 | 632.64 -------------------------------------------------------------------------------- /ex00/main.cpp: -------------------------------------------------------------------------------- 1 | #include "BitcoinExchange.hpp" 2 | 3 | void BitcoinExchange::ReadBase() 4 | { 5 | std::ifstream input; 6 | std::string database; 7 | 8 | input.open("./data.csv"); 9 | while (!input.eof()) 10 | { 11 | input >> database; 12 | std::string fulldate = database.substr(0,10).erase(4,1).erase(6,1); 13 | float rate = 0.0; 14 | std::stringstream convert; 15 | convert << database.substr(11); 16 | convert >> rate; 17 | _database.insert(std::make_pair(fulldate,rate)); 18 | } 19 | input.close(); 20 | } 21 | 22 | int BitcoinExchange::Parsing(int year, int month, int day, std::string raate ,float rate, std::string line) 23 | { 24 | size_t idx = line.find("|"); 25 | if (line[idx + 1] != ' ' || line[idx - 1] != ' ') 26 | { 27 | std::cerr << "Invalid Pipe\n"; 28 | return (-1); 29 | } 30 | 31 | if (line.substr(4,1) != "-" && line.substr(7,1) != "-") 32 | { 33 | std::cerr << "Invalid Date Format\n"; 34 | return (-1); 35 | } 36 | 37 | int count = 0; 38 | for (size_t i = 0; i < raate.length(); i++) 39 | { 40 | if (raate[0] == '.') 41 | { 42 | std::cerr << "Invalid Rate Format\n"; 43 | return (-1); 44 | } 45 | if (raate[i] == '.') 46 | count++; 47 | if (!(isdigit(raate[i])) && raate[i] != '.' && (count == 1 || count == 0)) 48 | { 49 | std::cerr << "Invalid Rate Format\n"; 50 | return (-1); 51 | } 52 | } 53 | 54 | int month_limits[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 55 | if (year < 2009 || month < 1 || month > 12) 56 | { 57 | std::cerr << "Invalid Date Format\n"; 58 | return (-1); 59 | } 60 | if (day > month_limits[month - 1] || day < 1) 61 | { 62 | std::cerr << "Out of month range\n"; 63 | return (-1); 64 | } 65 | if (rate < 0.00 || rate > 1000.00 ) 66 | { 67 | std::cerr << "Rate out of range\n"; 68 | return (-1); 69 | } 70 | return (0); 71 | } 72 | 73 | void BitcoinExchange::PrintOuput(std::string inputdate, float bitcoins) 74 | { 75 | std::map::iterator itb = this->_database.begin(); 76 | std::map::iterator ite = this->_database.end(); 77 | bool flag = false; 78 | 79 | for (; itb != ite; itb++) 80 | { 81 | if (itb->first == inputdate) 82 | { 83 | flag = true; 84 | break; 85 | } 86 | } 87 | if (flag == true) 88 | { 89 | std::cout << inputdate.insert(4,"-").insert(7,"-") << " => " << bitcoins << " = " << std::fixed << std::setprecision(2) << bitcoins * itb->second << "\n"; 90 | flag = false; 91 | } 92 | else 93 | { 94 | ite = this->_database.lower_bound(inputdate); 95 | std::cout << inputdate.insert(4,"-").insert(7,"-") << " => " << bitcoins << " = " << std::fixed << std::setprecision(2) << bitcoins * ite->second << "\n"; 96 | } 97 | } 98 | 99 | void BitcoinExchange::ReadInput(std::string file) 100 | { 101 | std::ifstream input; 102 | std::string line; 103 | 104 | input.open(file); 105 | 106 | if (input.fail()) 107 | { 108 | std::cerr << "Cannot Open File\n"; 109 | input.close(); 110 | exit(0); 111 | } 112 | 113 | while (!input.eof()) 114 | { 115 | std::string fulldate; 116 | std::getline(input, line); 117 | 118 | int year, month, day = 0; 119 | std::stringstream y, m, d; 120 | y << line.substr(0,4); 121 | m << line.substr(5,2); 122 | d << line.substr(8,2); 123 | y >> year; 124 | m >> month; 125 | d >> day; 126 | 127 | if (line.length() < 14) 128 | { 129 | std::cerr << "Invalid Format\n"; 130 | continue ; 131 | } 132 | 133 | std::string raate = line.substr(13, line.find('\0')); 134 | 135 | float bitcoins = 0.00; 136 | std::stringstream bit; 137 | bit << raate; 138 | bit >> bitcoins; 139 | 140 | if (month < 10 && day < 10) 141 | fulldate = std::to_string(year * 10) + std::to_string(month * 10) + std::to_string(day); 142 | else if (day < 10) 143 | fulldate = std::to_string(year) + std::to_string(month * 10) + std::to_string(day); 144 | else if (month < 10) 145 | fulldate = std::to_string(year * 10) + std::to_string(month) + std::to_string(day); 146 | else 147 | fulldate = std::to_string(year) + std::to_string(month) + std::to_string(day); 148 | 149 | if (Parsing(year, month, day, raate, bitcoins, line) == 0) 150 | PrintOuput(fulldate, bitcoins); 151 | } 152 | } 153 | 154 | int main(int ac, char *av[]) 155 | { 156 | BitcoinExchange A; 157 | if (ac == 2) 158 | { 159 | try 160 | { 161 | A.ReadBase(); 162 | A.ReadInput(av[1]); 163 | } 164 | catch(const std::exception& e) 165 | { 166 | std::cerr << e.what() << '\n'; 167 | } 168 | } 169 | else 170 | std::cerr << "Error: could not open file"; 171 | } 172 | 173 | -------------------------------------------------------------------------------- /ex01/Makefile: -------------------------------------------------------------------------------- 1 | NAME = RPN 2 | 3 | CPP = c++ 4 | 5 | CPP_FLAGS = -Wall -Wextra -Werror -std=c++98 6 | 7 | FILES = main.cpp \ 8 | rpn.cpp \ 9 | 10 | all : $(NAME) 11 | 12 | $(NAME) : $(FILES) 13 | $(CPP) $(CPP_FLAGS) $(FILES) -o $(NAME) 14 | 15 | RM = rm -rf 16 | 17 | clean : 18 | $(RM) $(NAME) 19 | 20 | re : clean all -------------------------------------------------------------------------------- /ex01/main.cpp: -------------------------------------------------------------------------------- 1 | #include "rpn.hpp" 2 | #include 3 | 4 | int main(int ac, char *av[]) 5 | { 6 | rpn obj; 7 | if (ac != 2) 8 | { 9 | std::cerr << "Error\n"; 10 | exit(0); 11 | } 12 | else 13 | { 14 | try 15 | { 16 | obj.ReadInput(av[1]); 17 | } 18 | catch(const std::exception& e) 19 | { 20 | std::cerr << e.what(); 21 | } 22 | 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /ex01/rpn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/ex01/rpn -------------------------------------------------------------------------------- /ex01/rpn.cpp: -------------------------------------------------------------------------------- 1 | #include "rpn.hpp" 2 | 3 | rpn ::rpn () 4 | { 5 | } 6 | 7 | /*--------------------------------------------------------*/ 8 | rpn::rpn (const rpn &a) 9 | { 10 | this->operator=(a); 11 | } 12 | 13 | /*--------------------------------------------------------*/ 14 | rpn::~rpn () 15 | { 16 | } 17 | 18 | /*--------------------------------------------------------*/ 19 | rpn & rpn::operator = (const rpn &a) 20 | { 21 | (void)a; 22 | return (*this); 23 | } 24 | 25 | int rpn::CalculationResult(int n1, int n2, char o) 26 | { 27 | switch (o) 28 | { 29 | case '+': 30 | return (n1 + n2); 31 | case '-': 32 | return (n2 - n1); 33 | case '*': 34 | return (n1 * n2); 35 | case '/': 36 | { 37 | if (n2 == 0) 38 | throw std::invalid_argument("Floating Point Exception Dividing on Zero\n"); 39 | return (n2 / n1); 40 | } 41 | } 42 | return (0); 43 | } 44 | 45 | 46 | void rpn::ReadInput(std::string input) 47 | { 48 | std::string ope = "+/*-"; 49 | size_t op, num; 50 | op = num = 0; 51 | for (size_t i = 0; i < input.length() ; i++) 52 | { 53 | if (isdigit(input[i])) 54 | { 55 | num++; 56 | this->_numbers.push(input[i] - '0'); 57 | } 58 | else if (ope.find(input[i]) != std::string::npos) 59 | { 60 | op++; 61 | int n1 = _numbers.top(); 62 | _numbers.pop(); 63 | _numbers.top() = CalculationResult(n1, _numbers.top(), input[i]); 64 | } 65 | 66 | else if (isspace(input[i])) 67 | continue; 68 | else 69 | throw std::invalid_argument("Invalid Input\n"); 70 | } 71 | if ((op + 1) != num) 72 | throw std::invalid_argument("Number of operators less or greater than numbers\n"); 73 | std::cout << _numbers.top() << "\n"; 74 | } -------------------------------------------------------------------------------- /ex01/rpn.hpp: -------------------------------------------------------------------------------- 1 | #ifndef RPN_H 2 | #define RPN_H 3 | 4 | #include 5 | #include 6 | 7 | class rpn 8 | { 9 | private: 10 | std::stack _numbers; 11 | public: 12 | rpn (); 13 | rpn (const rpn &a); 14 | ~rpn (); 15 | rpn & operator = (const rpn &a); 16 | 17 | void ReadInput(std::string input); 18 | int CalculationResult(int n1, int n2, char o); 19 | }; 20 | 21 | #endif -------------------------------------------------------------------------------- /ex01/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | GREEN="\033[32m" 4 | BLUE="\033[34m" 5 | RESET="\033[0m" 6 | RED="\033[31m" 7 | 8 | 9 | 10 | printf "$BLUE%s""Test[0] => 3 2 1 + *\n" 11 | out=$(./RPN "3 2 1 + *") 12 | if [ "$out" = "9" ]; then 13 | printf "$GREEN%s"" Good\n"$RESET 14 | else 15 | { 16 | printf "$RED%s""Wrong\n"$RESET 17 | printf "$BLUE%s""[$out]\n"$RESET 18 | printf "$GREEN%s""[9]\n"$RESET 19 | } 20 | fi 21 | 22 | 23 | printf "$BLUE%s""Test[1] => 2 4 8 + *\n" 24 | out=$(./RPN "2 4 8 + *") 25 | if [ "$out" = "24" ]; then 26 | printf "$GREEN%s"" Good\n"$RESET 27 | else 28 | { 29 | printf "$RED%s""Wrong\n"$RESET 30 | printf "$BLUE%s""[$out]\n"$RESET 31 | printf "$GREEN%s""[24]\n"$RESET 32 | } 33 | fi 34 | 35 | 36 | printf "$BLUE%s""Test[2] => 2 5 * 4 + 3 2 * 1 + / \n" 37 | out=$(./RPN "2 5 * 4 + 3 2 * 1 + / ") 38 | if [ "$out" = "2" ]; then 39 | printf "$GREEN%s"" Good\n"$RESET 40 | else 41 | { 42 | printf "$RED%s""Wrong\n"$RESET 43 | printf "$BLUE%s""[$out]\n"$RESET 44 | printf "$GREEN%s""[2]\n"$RESET 45 | } 46 | fi 47 | 48 | printf "$BLUE%s""Test[3] => 12 * 2 / 5 + 46 * 6 / 8 * 2 / + 2 * 2 -\n" 49 | out=$(./RPN "12 * 2 / 5 + 46 * 6 / 8 * 2 / + 2 * 2 -") 50 | if [ "$out" = "42" ]; then 51 | printf "$GREEN%s"" Good\n"$RESET 52 | else 53 | { 54 | printf "$RED%s""Wrong\n"$RESET 55 | printf "$BLUE%s""[$out]\n"$RESET 56 | printf "$GREEN%s""[42]\n"$RESET 57 | } 58 | fi 59 | 60 | 61 | printf "$BLUE%s""Test[4] => 89 * 9 - 9 - 9 - 4 - 1 +\n" 62 | out=$(./RPN "89 * 9 - 9 - 9 - 4 - 1 +") 63 | if [ "$out" = "42" ]; then 64 | printf "$GREEN%s"" Good\n"$RESET 65 | else 66 | { 67 | printf "$RED%s""Wrong\n"$RESET 68 | printf "$BLUE%s""[$out]\n"$RESET 69 | printf "$GREEN%s""[42]\n"$RESET 70 | } 71 | fi 72 | 73 | 74 | 75 | 76 | printf "$BLUE%s""Test[5] => 98 * 4 * 4 / 2 + 9 - 8 - 8 - 1 - 6 -\n" 77 | out=$(./RPN "98 * 4 * 4 / 2 + 9 - 8 - 8 - 1 - 6 -") 78 | if [ "$out" = "42" ]; then 79 | printf "$GREEN%s"" Good\n"$RESET 80 | else 81 | { 82 | printf "$RED%s""Wrong\n"$RESET 83 | printf "$BLUE%s""[$out]\n"$RESET 84 | printf "$GREEN%s""[42]\n"$RESET 85 | } 86 | fi 87 | -------------------------------------------------------------------------------- /ex01/tester.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | GREEN="\033[32m" 4 | BLUE="\033[34m" 5 | RESET="\033[0m" 6 | RED="\033[31m" 7 | 8 | 9 | printf "$BLUE%s""Test[0] => 3 2 1 + *\n" 10 | out=$(./RPN "3 2 1 + *") 11 | if [ "$out" = "9" ]; then 12 | printf "$GREEN%s"" Good\n"$RESET 13 | else 14 | { 15 | printf "$RED%s"" Wrong\n"$RESET 16 | printf "$BLUE%s""Your Output = [$out]\n"$RESET 17 | printf "$GREEN%s""Correct Value = [9]\n"$RESET 18 | } 19 | fi 20 | 21 | 22 | printf "$BLUE%s""Test[1] => 2 4 8 + *\n" 23 | out=$(./RPN "2 4 8 + *") 24 | if [ "$out" = "24" ]; then 25 | printf "$GREEN%s"" Good\n"$RESET 26 | else 27 | { 28 | printf "$RED%s"" Wrong\n"$RESET 29 | printf "$BLUE%s""Your Output = [$out]\n"$RESET 30 | printf "$GREEN%s""Correct Value = [24]\n"$RESET 31 | } 32 | fi 33 | 34 | 35 | printf "$BLUE%s""Test[2] => 2 5 * 4 + 3 2 * 1 + / \n" 36 | out=$(./RPN "2 5 * 4 + 3 2 * 1 + / ") 37 | if [ "$out" = "2" ]; then 38 | printf "$GREEN%s"" Good\n"$RESET 39 | else 40 | { 41 | printf "$RED%s"" Wrong\n"$RESET 42 | printf "$BLUE%s""Your Output = [$out]\n"$RESET 43 | printf "$GREEN%s""Correct Value = [2]\n"$RESET 44 | } 45 | fi 46 | 47 | printf "$BLUE%s""Test[3] => 12 * 2 / 5 + 46 * 6 / 8 * 2 / + 2 * 2 -\n" 48 | out=$(./RPN "12 * 2 / 5 + 46 * 6 / 8 * 2 / + 2 * 2 -") 49 | if [ "$out" = "42" ]; then 50 | printf "$GREEN%s"" Good\n"$RESET 51 | else 52 | { 53 | printf "$RED%s"" Wrong\n"$RESET 54 | printf "$BLUE%s""Your Output = [$out]\n"$RESET 55 | printf "$GREEN%s""Correct Value = [42]\n"$RESET 56 | } 57 | fi 58 | 59 | 60 | printf "$BLUE%s""Test[4] => 89 * 9 - 9 - 9 - 4 - 1 +\n" 61 | out=$(./RPN "89 * 9 - 9 - 9 - 4 - 1 +") 62 | if [ "$out" = "42" ]; then 63 | printf "$GREEN%s"" Good\n"$RESET 64 | else 65 | { 66 | printf "$RED%s"" Wrong\n"$RESET 67 | printf "$BLUE%s""Your Output = [$out]\n"$RESET 68 | printf "$GREEN%s""Correct Value = [42]\n"$RESET 69 | } 70 | fi 71 | 72 | 73 | 74 | 75 | printf "$BLUE%s""Test[5] => 98 * 4 * 4 / 2 + 9 - 8 - 8 - 1 - 6 -\n" 76 | out=$(./RPN "98 * 4 * 4 / 2 + 9 - 8 - 8 - 1 - 6 -") 77 | if [ "$out" = "42" ]; then 78 | printf "$GREEN%s"" Good\n"$RESET 79 | else 80 | { 81 | printf "$RED%s"" Wrong\n"$RESET 82 | printf "$BLUE%s""Your Output = [$out]\n"$RESET 83 | printf "$GREEN%s""Correct Value = [42]\n"$RESET 84 | } 85 | fi 86 | -------------------------------------------------------------------------------- /ex02/Makefile: -------------------------------------------------------------------------------- 1 | NAME = PmergeMe 2 | 3 | CPP = c++ 4 | 5 | CPP_FLAGS = -std=c++98 6 | 7 | FILES = main.cpp \ 8 | PmergeMe.cpp\ 9 | 10 | all : $(NAME) 11 | 12 | $(NAME) : $(FILES) 13 | $(CPP) $(CPP_FLAGS) $(FILES) -o $(NAME) 14 | 15 | RM = rm -rf 16 | 17 | clean : 18 | $(RM) $(NAME) 19 | 20 | re : clean all -------------------------------------------------------------------------------- /ex02/PmergeMe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/ex02/PmergeMe -------------------------------------------------------------------------------- /ex02/PmergeMe.cpp: -------------------------------------------------------------------------------- 1 | #include "PmergeMe.hpp" 2 | 3 | PmergeMe::PmergeMe () 4 | { 5 | } 6 | 7 | /*--------------------------------------------------------*/ 8 | PmergeMe::PmergeMe (const PmergeMe &a) 9 | { 10 | this->operator=(a); 11 | } 12 | 13 | /*--------------------------------------------------------*/ 14 | PmergeMe::~PmergeMe () 15 | { 16 | } 17 | 18 | /*--------------------------------------------------------*/ 19 | PmergeMe & PmergeMe::operator = (const PmergeMe &a) 20 | { 21 | (void)a; 22 | return(*this); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /ex02/PmergeMe.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PMERGEME_H 2 | #define PMERGEME_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | 14 | class PmergeMe 15 | { 16 | private: 17 | // your private members here 18 | public: 19 | PmergeMe (); 20 | PmergeMe (const PmergeMe &a); 21 | ~PmergeMe (); 22 | PmergeMe & operator = (const PmergeMe &a); 23 | }; 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /ex02/main.cpp: -------------------------------------------------------------------------------- 1 | #include "PmergeMe.hpp" 2 | 3 | bool flag = false; 4 | unsigned int tmp; 5 | 6 | template 7 | 8 | void algo(int ac, char *av[], T &container, S &cont, V &conta, char choice) 9 | { 10 | // Time 11 | struct timeval start, end; 12 | long sec, micro; 13 | 14 | gettimeofday(&start, NULL); 15 | for (size_t i = 0; i < container.size(); i++) 16 | { 17 | if (container[i].first > container[i].second) 18 | std::swap(container[i].first, container[i].second); 19 | } 20 | 21 | for (size_t i = 0; i < container.size(); i++) 22 | conta.push_back(container[i].first); 23 | 24 | for (size_t i = 0; i < container.size(); i++) 25 | cont.push_back(container[i].second); 26 | 27 | std::sort(conta.begin(), conta.end()); 28 | 29 | for (size_t i = 0; i < cont.size(); i++) 30 | conta.insert(std::lower_bound(begin(conta), conta.end(), cont[i]), cont[i]); 31 | if (flag) 32 | conta.insert(std::lower_bound(conta.begin(), conta.end(), tmp), tmp); 33 | 34 | std::cout << "\nAfter : "; 35 | 36 | for (size_t i = 0; i < conta.size(); i++) 37 | std::cout << conta[i] << " "; 38 | 39 | gettimeofday(&end, NULL); 40 | sec = end.tv_sec - start.tv_sec; 41 | micro = end.tv_usec - start.tv_usec; 42 | long diff = (sec / 1000000) + (micro); 43 | if (choice == 'v') 44 | std::cout << "\nTime to process a range of " << ac << " elements with std::vector : " << diff << " us" << "\n"; 45 | if (choice == 'd') 46 | std::cout << "\nTime to process a range of " << ac << " elements with std::deque : " << diff << " us" << "\n"; 47 | } 48 | 49 | void checkInput(char *av1, char *av2) 50 | { 51 | if (std::atoi(av1) < 0 || std::atoi(av2) < 0) 52 | { 53 | std::cerr << "Invalid Input: Number Less Than 0\n"; 54 | exit(0); 55 | } 56 | } 57 | 58 | 59 | 60 | int main(int ac, char *av[]) 61 | { 62 | if ((ac - 1) % 2 != 0) 63 | { 64 | flag = true; 65 | tmp = std::atoi(av[ac - 1]); 66 | if (std::atoi(av[ac - 1]) < 0) 67 | exit(1); 68 | ac-=1; 69 | } 70 | 71 | std::cout << "Before : "; 72 | if (ac < 6) 73 | { 74 | for (size_t i = 1; i < ac; i++) 75 | std::cout << av[i] << " "; 76 | } 77 | else 78 | { 79 | for (size_t i = 1; i < 6; i++) 80 | std::cout << av[i] << " "; 81 | std::cout << "[...]"; 82 | } 83 | 84 | 85 | // VECTOR 86 | 87 | std::vector > vec; 88 | for (int i = 1; i < ac; i+=2) 89 | { 90 | if (isdigit(*av[i])) 91 | { 92 | checkInput(av[i], av[i + 1]); 93 | vec.push_back(std::make_pair(std::atoi(av[i]), std::atoi(av[i + 1]))); 94 | } 95 | } 96 | std::vector vec_a, vec_b; 97 | algo(ac, av, vec, vec_a, vec_b, 'v'); 98 | 99 | // DEQUE 100 | 101 | std::deque > dec; 102 | for (int i = 1; i < ac; i+=2) 103 | { 104 | if (isdigit(*av[i])) 105 | { 106 | checkInput(av[i], av[i + 1]); 107 | dec.push_back(std::make_pair(std::atoi(av[i]), std::atoi(av[i + 1]))); 108 | } 109 | } 110 | std::deque dec_a, dec_b; 111 | algo(ac, av, dec, dec_a, dec_b, 'd'); 112 | } -------------------------------------------------------------------------------- /ex02/mainn.cpp: -------------------------------------------------------------------------------- 1 | #include "PmergeMe.hpp" 2 | 3 | bool flag = false; 4 | unsigned int tmp; 5 | 6 | void PrintContainer(const std::vector &vec) 7 | { 8 | for (size_t i = 0; i < vec.size(); i++) 9 | { 10 | std::cout << vec[i] << " "; 11 | } 12 | } 13 | 14 | void SortPair(std::vector > &a) 15 | { 16 | for (size_t i = 0; i < a.size(); i++) 17 | { 18 | if (a[i].first > a[i].second) 19 | std::swap(a[i].first, a[i].second); 20 | } 21 | } 22 | 23 | void GetAndInsert(std::vector &largest, std::vector &smallest) 24 | { 25 | for (size_t i = 0; i < largest.size(); i++) 26 | smallest.insert(std::lower_bound(smallest.begin(), smallest.end(), largest[i]), largest[i]); 27 | if (flag) 28 | smallest.insert(std::lower_bound(smallest.begin(), smallest.end(), tmp), tmp); 29 | PrintContainer(smallest); 30 | } 31 | 32 | 33 | void ExtractingLargestNumbers(std::vector > &a) 34 | { 35 | std::vector largest, smallest; 36 | 37 | for (size_t i = 0; i < a.size(); i++) 38 | smallest.push_back(a[i].first); 39 | 40 | for (size_t i = 0; i < a.size(); i++) 41 | largest.push_back(a[i].second); 42 | 43 | std::sort(smallest.begin(), smallest.end()); 44 | GetAndInsert(largest, smallest); 45 | } 46 | 47 | 48 | 49 | // void PrintStat(char **av, int ac) 50 | // { 51 | // std::cout << "Before : "; 52 | // if (ac < 6) 53 | // { 54 | // for (size_t i = 1; i < 6; i++) 55 | // std::cout << av[i] << " "; 56 | // } 57 | // else 58 | // { 59 | // for (size_t i = 1; i < 6; i++) 60 | // std::cout << av[i] << " "; 61 | // std::cout << "[...]"; 62 | // } 63 | // } 64 | 65 | int main(int ac, char *av[]) 66 | { 67 | if ((ac - 1) % 2 != 0) 68 | { 69 | flag = true; 70 | tmp = std::atoi(av[ac - 1]); 71 | ac-=1; 72 | } 73 | 74 | std::vector > myvec; 75 | for (int i = 1; i < ac; i+=2) 76 | { 77 | if (isdigit(*av[i])) 78 | myvec.push_back(std::make_pair(std::atoi(av[i]), std::atoi(av[i + 1]))); 79 | } 80 | SortPair(myvec); 81 | ExtractingLargestNumbers(myvec); 82 | } -------------------------------------------------------------------------------- /explanation/Page 1.svg: -------------------------------------------------------------------------------- 1 | ./rpn "8 9 * 9 - 9 - 9 - 4 - 1 +" 2 | 8 3 | If it's an operator 4 | Remember I push things reverse just for better syntax understanding 5 | 6 | And during the parse, i check the errors and in this notation, there's no preference means no need to start with * or / at the first 7 | 9 8 | 9 9 | 9 10 | 9 11 | 4 12 | 1 13 | * 14 | - 15 | - 16 | - 17 | - 18 | + 19 | If it's a digit 20 | Popping elements : 21 | 8 22 | * 23 | 9 24 | 8 25 | 72 26 | 9 27 | 9 28 | 9 29 | 4 30 | 1 31 | * 32 | - 33 | - 34 | - 35 | - 36 | + 37 | I pop only the first element then i push the result 38 | 39 | on the top of the stack again 40 | 72 41 | Popping elements : 42 | 72 43 | - 44 | 9 45 | 63 46 | 72 47 | 63 48 | 9 49 | 9 50 | 4 51 | 1 52 | - 53 | - 54 | - 55 | - 56 | + 57 | Popping elements : 58 | 63 59 | - 60 | 9 61 | 54 62 | 63 63 | 54 64 | 9 65 | 4 66 | 1 67 | - 68 | - 69 | - 70 | + 71 | Popping elements : 72 | 54 73 | - 74 | 9 75 | 45 76 | 54 77 | 45 78 | 4 79 | 1 80 | - 81 | - 82 | + 83 | Popping elements : 84 | 45 85 | - 86 | 4 87 | 41 88 | 45 89 | 41 90 | 1 91 | - 92 | + 93 | Popping elements : 94 | 41 95 | + 96 | 1 97 | 41 98 | 42 99 | + 100 | 101 | Errors ⚠️ 102 | 103 | 104 | ❌ if (number of numbers != number of operator + 1) 105 | 106 | ❌ The syntax starts with the operator 107 | 108 | ❌ After the first digit there's an operator 109 | 110 | ❌ The syntax have something else than - + / * and digit or space or even tab 111 | 112 | anything else it's not valid 113 | -------------------------------------------------------------------------------- /explanation/Screen Shot 2023-03-25 at 6.20.26 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/explanation/Screen Shot 2023-03-25 at 6.20.26 PM.png -------------------------------------------------------------------------------- /explanation/Screen Shot 2023-03-26 at 5.56.08 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/explanation/Screen Shot 2023-03-26 at 5.56.08 PM.png -------------------------------------------------------------------------------- /explanation/deque.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/explanation/deque.png -------------------------------------------------------------------------------- /explanation/last.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/explanation/last.gif -------------------------------------------------------------------------------- /explanation/rpn_stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/explanation/rpn_stack.png -------------------------------------------------------------------------------- /explanation/swap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/explanation/swap.gif -------------------------------------------------------------------------------- /explanation/vector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/explanation/vector.png -------------------------------------------------------------------------------- /explanation/vector2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/explanation/vector2.gif -------------------------------------------------------------------------------- /explanation/vector_pair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Toufa7/CPP09/588ad29df59ec76f82f54ab849c62273a9785a3d/explanation/vector_pair.png -------------------------------------------------------------------------------- /file.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main() 8 | { 9 | struct timeval start, end; 10 | long sec, micro; 11 | 12 | gettimeofday(&start, NULL); 13 | gettimeofday(&end, NULL); 14 | 15 | sec = end.tv_sec - start.tv_sec; 16 | micro = end.tv_usec - start.tv_usec; 17 | long diff = (sec / 1000000) + (micro); 18 | 19 | std::cout << "Micro " << diff; 20 | } -------------------------------------------------------------------------------- /list.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void PrintStats(std::list > &lst) 6 | { 7 | std::list >::iterator ite = lst.begin(); 8 | for (; ite != lst.end() ; ++ite) 9 | { 10 | std::cout << "{"<< ite->first << " , " << ite->second << "}" << "\n"; 11 | 12 | } 13 | } 14 | 15 | int main(int ac, char *av[]) 16 | { 17 | std::list > lst; 18 | for (int i = 1; i < ac ; i+=2) 19 | { 20 | if (isdigit(*av[i])) 21 | lst.push_back(std::make_pair(std::atoi(av[i]), std::atoi(av[i + 1]))); 22 | } 23 | 24 | PrintStats(lst); 25 | 26 | std::list >::iterator ite = lst.begin(); 27 | std::cout << "\n******\n"; 28 | for (; ite != lst.end() ; ++ite) 29 | { 30 | if (ite->first > ite->second) 31 | std::swap(ite->first, ite->second); 32 | } 33 | PrintStats(lst); 34 | 35 | 36 | std::list lst_a; 37 | ite = lst.begin(); 38 | for (; ite != lst.end() ; ++ite) 39 | lst_a.push_back(ite->first); 40 | 41 | 42 | std::list lst_b; 43 | ite = lst.begin(); 44 | for (; ite != lst.end() ; ++ite) 45 | lst_b.push_back(ite->second); 46 | 47 | lst_a.sort(); 48 | 49 | std::list::iterator itb = lst_b.begin(); 50 | 51 | for (; ite != lst_b.end() ; ++ite) 52 | lst_a.push_back(ite->first); 53 | 54 | } 55 | 56 | 57 | 58 | // LIST 59 | 60 | // std::list > lst; 61 | // for (int i = 1; i < ac; i+=2) 62 | // { 63 | // if (isdigit(*av[i])) 64 | // lst.push_back(std::make_pair(std::atoi(av[i]), std::atoi(av[i + 1]))); 65 | // } 66 | // std::list lst_a, lst_b; 67 | // algo(ac, av, lst, lst_a, lst_b); --------------------------------------------------------------------------------