#include<iostream>
#include<fstream>
#include<cstdlib>
#include<ctime>
#include<string>
usingnamespace std;
int RowTest();
int ColumnTest();
string GetFileName();
void ArrayFiller();
int main()
{
int Row = RowTest();
int Column = ColumnTest();
int Array [50][50] ;
string FileName = GetFileName();
srand ((time(NULL)));
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 ( Row <= 2 || 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 (1 >= Column || Column >= 51)
{
cout << " Invalid input, please try again \n";
}
return Column;
}
string GetFileName()
{
string FileName;
cout << " Please enter the name of the file \n";
cin >> FileName;
return(FileName);
}
void ArrayFiller( int Array[50][50] , int Row , int Column )
{
string FileName;
ofstream FileOut;
FileName = GetFileName();
FileOut.open(FileName);
for (int i = 0; i < Row; i++)
for (int k = 0; k < Column; k++)
{
FileOut << Array[i][k] = rand() % 100 << ;
FileOut.close();
}
}
#include<iostream>
#include<fstream>
#include<cstdlib>
#include<ctime>
#include<string>
usingnamespace std;
int RowTest();
int ColumnTest();
void ArrayFiller();
string GetFileName();
void PrintArray();
int main()
{
int Row = RowTest();
int Column = ColumnTest();
int Array [50][50] ;
string FileName = GetFileName();
srand ((time(NULL)));
return(0);
}
int RowTest()
{
int Row;
do
{
cout << "Enter the number of rows you would like in the array, that is between 2 and 50 \n";
cin >> Row;
}
while ( (Row < 2) || (Row > 50) );
return (Row);
}
int ColumnTest()
{
int Column;
do
{
cout << " Please enter a value for the column of the array that is between 2 and 50.\n";
cin >> Column;
}
while ( (Column < 2) || (Column > 50) );
return Column;
}
string GetFileName()
{
string FileName;
cout << " Please enter the name of the file \n";
cin >> FileName;
return(FileName);
}
void ArrayFiller( int Array[50][50] , int Row , int Column )
{
for ( int i = 0; i < Row; i++ )
for ( int k = 0; k < Column; k++ )
{
Array[i][k] = rand() % 100 ;
}
}
void PrintArray( ostream& out, int Array[50][50], int Row, int Column )
{
int input( string text )
{
int value = 2; // safe default, in case the input fails
do {
cout << text << " the array, that is between 2 and 50, inclusive\n";
} while ( cin >> value && ((value < 2) || (50 < value)) );
return value;
}
auto row = input( "Enter the number of rows you would like in" );
auto col = input( "Please enter a value for the column of" );