Yes I have read the policy about the homework, and no I'm not pretending you to do my HW; I just need some help to find out what's wrong with my code, since it won't compile - or at least it compiles but block itself and gives an error-
Code:
#include <string>
#include <cctype>
#include <algorithm>
#include <iostream>
using namespace std;
const int ROWS = 5;
const int COLS = 5;
int main(int argc, char *argv[])
{
string convert(char [ROWS][COLS], string);
char val[ROWS][COLS] = {'a', 'b', 'c', 'd', 'e',
'f', 'g', 'h', 'i', 'j',
'l', 'm', 'n', 'o', 'p',
'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z'};
string text;
int i;
cout << "please enter a string: ";
getline(cin, text);
convert(val, text);
system("PAUSE");
return EXIT_SUCCESS;
}
string convert(char val[ROWS][COLS], string text) {
int i, j, k;
for (k=0; i<text.length(); k++){
for (i = 0; i < ROWS; ++i) {
for (j = 0; j < COLS; ++j) {
if(val[i][j] = text.at(k) ) {
cout << i << "/" << j << " ";
}
}
}
}
}
an example of output should be:
Code:
please enter a string: qwe
4/1 5/2 1/5
thank you