I am using dev C++ trying to use functions on this program. I got it to compile with out error but coming up with only the first lind of the output function. I have a feeling it is probably something small that I just for some reason just cant see.
here is the code. Any help would be appreciated.
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
I've only had a quick look, but I think it's probably the way you are passing the variable n into your functions. You are passing by copy. The effect of this is that a copy of n is passed into each function and the function manipulates the copy, so when the function returns, the original n is unchanged. So you are not changing the value of n between each function. You need to pass a pointer to nor pass it by reference, in your case the easier change would be to make it by reference.
change the prototypes so that instead of passing int you pass int &
This passes the memory location of n to the function so that it modifies the same variable.
Hi tdigdug. Im not 100% sure (because i am still learning myself) but I dont think you can directly pass an array as a function argument, you need to use pointers to do so. Check out some tutorials on pointers if you are really keen to get this working.
Also, could you please use the code tags when posting code. They are [c0de][/c0de] (replace 0 with o)