cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Help With c++ HW
Help With c++ HW
Nov 12, 2017 at 5:06am UTC
LordFarquaad
(1)
Seeing as how I cant reply for whatever reason ill post here. Thank you repeater for your help.
Last edited on
Nov 15, 2017 at 4:46am UTC
Nov 12, 2017 at 11:29am UTC
Repeater
(3046)
You are passing, to your functions,
copies
of variables. This is known as
pass by value
.
The functions are then working on those
copies
. When the function finishes, the copies are discarded. The original values, in
main
, are not touched.
If you need a function to change a value in the caller, pass by
reference
.
http://www.cplusplus.com/doc/tutorial/functions/
, half way down;
Arguments passed by value and by reference
You're also ignoring what you pass to the function and creating whole new variables inside the functions. I don't know what you expected to happen. You need to stop, go back, and learn about functions before you go any further.
Last edited on
Nov 12, 2017 at 11:31am UTC
Topic archived. No new replies allowed.