I need to give the user the option to write the name for a new file and then write an array to the file. I already did the array and it looks something like this. ( the program is done using functions so do i have to point the "inputted_row and _column to following function? ) How do i do all of this??
you know how to ask the question, do you know how to use cin for user input? do you know the string class? do you know about ofstream class? Between everything I have mentioned I can set up the code I need to dump the file.
I dont understand what you're trying to say but i managed to get the file out. im having trouble now pointing the variables and printing them to the output file, the adresses come up when i do this. how do i fix it?
int File_WriteOut ( int random_number , int *matrix , int *inputted_row ) //fxn 3
{
ofstream yourfile ;
string filename ;
i actually get errors if i i make this declaration like this
// int *matrix = new int[inputted_row] [inputted_column];
error C2540: non-constant expression as array bound
error C2440: 'initializing' : cannot convert from 'int (*)[1]' to 'int *'
error C2109: subscript requires array or pointer type
what i need to do is write "inputted_row" and "inputted_column" to the first line of the file and then the rest of the random numbers array. when i point these variables to the next function and attempt to print them to the file, only the hex addresses come up. I kno its got to do with the poor use of pointers, but what?
note all the changes I put in the line you need for the other stuff..
I have never dynamically allocated an multi dimensional array like that nor had a need, so I didn't know it wouldn't compile like that. I know ways to get around it but those are complicated for a new programmer.