From 89cfa72ea2d1cbf9251e7d12aa3578bba912574e Mon Sep 17 00:00:00 2001
From: "nshizirungudieumerci@gmail.com"
Date: Sat, 15 Aug 2026 10:06:09 -0400
Subject: [PATCH] added a parsons problem to section 4.4
---
pretext/Functions/FunctionOverloading.ptx | 56 ++++++++++++++++++++++-
1 file changed, 55 insertions(+), 1 deletion(-)
diff --git a/pretext/Functions/FunctionOverloading.ptx b/pretext/Functions/FunctionOverloading.ptx
index a94f135..508ae04 100644
--- a/pretext/Functions/FunctionOverloading.ptx
+++ b/pretext/Functions/FunctionOverloading.ptx
@@ -141,7 +141,61 @@ main()
that are correct and only modifying one character in the best string so far.
This is a type of algorithm in the class of ‘hill climbing' algorithms, that
is we only keep the result if it is better than the previous one.
-
+
+
+
+
+
+ Construct a C++ program that overloads a function called myfunct so it works
+ with either one or two integer parameters. Drag the blocks into the correct order on the right.
+
+
+
+
+ #include <iostream>
+ using namespace std;
+
+
+
+
+ void myfunct(int n) {
+ cout << "1 parameter: " << n << endl;
+ }
+
+
+ void myfunct(int n) {
+ cout << "1 parameter: " << n << endl;
+
+
+
+
+
+ void myfunct(int n, int m) {
+ cout << "2 parameters: " << n << " and " << m << endl;
+ }
+
+
+ void myfunct(int n) {
+ cout << "2 parameters: " << n << " and " << m << endl;
+ }
+
+
+
+
+ int main() {
+
+
+
+ myfunct(4);
+ myfunct(5, 6);
+
+
+
+ return 0;
+ }
+
+
+