Ok so i need to ask the user for rows and columns for the array, it should be
between 2 and 50. Then I have to fill the array with random numbers; The
program will then ask the user to provide a user to provide a file name, the
file name will be used to open a file, for output, with this name.
heres my program:
#include<iostream>
#include<fstream>
usingnamespace std;
int RowTest();
int ColumnTest();
ArrayFiller();
int main()
{
int Row , Column;
int Array[Row][Column];
int i , k;
return(0);
}
int rowtest()
{
int Row;
cout << " Please enter a value for the row of the array that is between 2 and 50. \n";
cin >> Row ;
while ( 2 >= Row || Row >= 50 )
{
cout << " Invalid input, please try again \n";
}
}
return( Row );
int ColumnTest()
{
int Column;
cout << " Please enter a value for the column of the array that is between 2 and 50 as well.\n";
cin >> Column;
while ( 2 >= Column || Column >= 50 )
{
cout << " Invalid input, please try again \n";
}
}
return ( Column );
int Arrayfiller()
{
for ( i = 0; i < Row; i++ )
for ( k = 0; k < Column; k++)
{
output << Array[i][k] = rand() % 100 ;
}
}
return( ArrayFiller )
am I doing it correctly ?
im not too sure what I'm doing.;/
Even if your code performed the way that you want it, the program will/should not compile as is. On line 4, your function declarations should be on separate lines and all end with a semicolon, that is:
int RowTest();
int ColumnTest();
int ArrayFiller();
Personally that is where I would start, gettting the program to compile. Then I would probably use a debugger to check values of variables if I had any logic errors.