Class function updating 2 variable

You need to post something that demonstrates the problem instead of some random crap.
nothing here does that. does this sample have the bug when you run it?
use <cmath> and <cstdlib>
Last edited on
The compiler is your friend: it tells what is wrong or likely to be wrong.

This is the output from cpp.sh with -Wall -Wextra -pedantic-errors turned on. One can click on the link in your code in your post to do the same thing. Take note of these errors and warnings and fix them.


8:1: error: new types may not be defined in a return type
8:1: note: (perhaps a semicolon is missing after the definition of 'Player')
21:20: error: return type specification for constructor invalid
 In function 'void market(Player&, int)':
27:7: error: 'failedHaggle' was not declared in this scope
 At global scope:
26:30: warning: unused parameter 'playerNum' [-Wunused-parameter]
 In function 'int main()':
36:11: error: 'playerMove' was not declared in this scope
38:23: error: invalid initialization of non-const reference of type 'Player&' from an rvalue of type 'Player (*)()'
26:6: note: in passing argument 1 of 'void market(Player&, int)
'

Btw, you could not have run this code with errors: compilation has failed.

Learn about scope, basically braces {} introduce a new scope.

... using output and debugging ...

It doesn't make sense to do both of these, are you sure that you know what debugging is? One cannot do either of these if the code doesn't compile.
Topic archived. No new replies allowed.