Fix the variable typo and add the function call (#109)
This commit is contained in:
@@ -17,6 +17,7 @@ void greet(std::string name) {
|
|||||||
cout << "Hello, " + name + "!" << endl;
|
cout << "Hello, " + name + "!" << endl;
|
||||||
greet2(name);
|
greet2(name);
|
||||||
cout << "Getting ready to say bye..." << endl;
|
cout << "Getting ready to say bye..." << endl;
|
||||||
|
bye();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ T sum(std::vector<T> arr) {
|
|||||||
|
|
||||||
T last_num = arr.back(); // save last number value
|
T last_num = arr.back(); // save last number value
|
||||||
arr.pop_back(); // and remove it from array for next recursive call
|
arr.pop_back(); // and remove it from array for next recursive call
|
||||||
return first_num + sum(arr);
|
return last_num + sum(arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user