ok im am very much closer. im going to show you the output my program, and you'll see that the last four function performances gives me 1 piece of garbage, and that's the new problem that i can't seem to stop.
here is the output to the screen:
Enter the name of input file to read from...
input.txt
Enter the name of output file to read from...
output.txt
Reading in the matrix...
Printing matrix to the screen...
Abc
DEF
gwr
Performing reverse of major diagonal...
rbc
DEF
gwA
Performing reverse of minor diagonal...
Abg
DEF
cwr
Performing reverse of a row...
Which row would you like to reverse...?
1
Abc
FED
gwr
Performing reverse of a column...
Which column would you like to reverse...?
0
gbc
DEF
Awr
Performing row cycle right...
Which row would you like to cycle right...?
0
╠Ab
DEF
gwr
Performing row cycle left...
Which row would you like to cycle left...?0
bc╠
DEF
gwr
Performing column cycle up...
Which row would you like to cycle up...?
0
Dbc
gEF
╠wr
Performing column cycle up...
Which row would you like to cycle up...?
0
╠bc
AEF
Dwr
Press any key to continue . . .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
void cycleright(char matrix[][noCols], int n)
{
char temp; int row, c;
cout << "Performing row cycle right...\n";
cout << "Which row would you like to cycle right...?\n";
cin >> row;
for(c=n-1; c>-1; c--)
{
temp = matrix[row][c];
matrix[row][c] = matrix[row][c-1];
matrix[row][c-1] = temp;
}
return;
}
void cycleleft(char matrix[][noCols], int n)
{
char temp; int row;
cout << "Performing row cycle left...\n";
cout << "Which row would you like to cycle left...?";
cin >> row;
for(int i=0; i<n; i++)
{
temp = matrix[row][i];
matrix[row][i] = matrix[row][i+1];
matrix[row][i+1] = temp;
}
return;
}
void cycleup(char matrix[][noCols], int n)
{
char temp; int col;
cout << "Performing column cycle up...\n";
cout << "Which row would you like to cycle up...?\n";
cin >> col;
for(int i=0; i<n; i++)
{
temp = matrix[i][col];
matrix[i][col] = matrix[i+1][col];
matrix[i+1][col] = temp;
}
return;
}
void cycledown(char matrix[][noCols], int n)
{
char temp; int col, r;
cout << "Performing column cycle up...\n";
cout << "Which row would you like to cycle up...?\n";
cin >> col;
for(r=n-1; r>-1; r--)
{
temp = matrix[r][col];
matrix[r][col] = matrix[r-1][col];
matrix[r-1][col] = temp;
}
return;
}
|