error when calling a function

I have been trying to write a code that converts a string to ASCII and reverse.
When I call the functions at case 1 and 2 of main(), it says an error:expected expression. I would appreciate if someone helped me... :)
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
57
58
59
60
61
62
63
64
65
  #include <iostream>
#include <string>

using namespace std;
void ASCIIconvert(string , char [ ] [2]);
void charConvert(string, char tab [ ] [2]);
int main()
{
    string alphabet= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    char tabela[52] [2];
        for (int i=0; i<=52; i++)
            tabela[i] [0]=alphabet.at(i);

        for (int i=0; i<52; i++)
            tabela[i] [1]= static_cast<int>(tabela[i] [0]);



    string text, kodi;
    int k;
        cout << "press 1 for converting a text to ASCII and 2 for the opposite";
        cin>>k;
        switch (k)
        {
        case 1:
            cout<< "write the text" <<endl;
            cin >> text;
            ASCIIconvert(text , tabela[ ] [2]);

        case 2:
            cout<< "Write ASCII code" <<endl;
            cin >> kodi;  //suppose that each character should be separated with space
            charConvert(kodi, tabela [ ] [2]);

        default: cout<< "Error" <<endl;
        }

  return 0;
}

void ASCIIconvert(string letter, char tab[ ] [2])
{   char c;
    for (int a = 0; a < letter.length(); a++)
    {
        char x = letter.at(a);
        for (int i=0; i<= 51; i++){
            if (tab [i] [0]==x)
                char c= c + tab [i] [1];
                }
    }
    cout<< c <<endl;
}
void charConvert(string kodi, char tab [ ] [2])
{
    for (int i=0; i<=kodi.length(); i+=7)
        {char c= kodi.at(i)+kodi.at(i+1)+kodi.at(i+2)+kodi.at(i+3)+kodi.at(i+4)+kodi.at(i+5)+kodi.at(i+6);
        for (int r=0; r<=51; r++)
            {if (c==tab[r][1])
                cout<< tab [r][0];
            }
        }


}
I don't see why you would want to convert a string into a 2 dimensional char array...
Maybe you are looking to use ifstream & ofstream so that you could save the ascii into a txt, and read afterwards...
If you REALLY want to continue this, you can make this return a string / char array, or have a reference "&" to the variable to change it. There are too many problems for me to count, so just redo it in a more simple / shorter way until it works.
Topic archived. No new replies allowed.