- [Instructor] According to Wikipedia,…the factorial of a non-negative number, n,…is the product of all positive integers…less than or equal to n.…So, the factorial of five is equal to five times four…times three times two times one, or 120.…Let's see how to implement this…using template metaprogramming.…We have our include iostream, include vector,…using namespace std.…We have some commented out code…that's going to print the results,…but before we get to that let's first…write a regular C++ function,…and it's going to be recursive, to do factorials…so we get an idea of what it looks like…with something that's more familiar to us.…
We're going to say factorial const int input…const int sum, and we're going to get…sum a default value of one.…So if no sum is called it has a value of one…because one times anything is the number.…Then we're going to say if input is greater than one…we're going to return, and we're going to do a recursive call.…So we're going to call factorial,…and we're going to say input minus one.…
- Unit testing and functional programming
- Function and Lambda functions
- C++ templates
- Working with the Standard Template Library and Boost.Hana
- Functional reactive programming
Skill Level Intermediate
2. Functional Programming in Modern C++
3. Template Metaprogramming
4. Functional Reactive Programming
RxCpp library5m 21s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.