Functions Part II

Channel:
Subscribers:
2,640
Published on ● Video Link: https://www.youtube.com/watch?v=a6YF1eUmV-I



Duration: 1:10:36
142 views
3


Today we started by talking about the Times Tables assignment and an extra credit opportunity for more practice with loops. In general, if you're going to be iterating over a 2D region, a doubly-nested for loop is the most natural way to do it. If you're doing something like adding up everything in a 3D region, then a triply-nested for loop is the most natural way of doing it.


We then talked a lot about functions today, including most importantly that not all of them are like functions in algebra. Some take no parameters, and some return no values. In those cases, they usually have a side effect of some sort (like couting something to the screen, which is very different from returning a value).


We then talked about different ways of working with strings, including using push_back to add a character, += to append another string, .at() to grab or set a character in the string, reverse() to reverse it, to_string() to convert an int to string, stoi() to convert a string to int, and so forth.







Tags:
csci 40
functions
strings
doubly nested loops