Adding characters to a string

I'm trying to make a game, and this part of the code used to work, but it stopped.

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
int TempVal;
    char Input[50];
    string Word1;
    string Word2;
    string Word3;
    int OnWord = 1;


    OnWord = 1;
    TempVal = 0;
    Word1 = "";
    Word2 = "";
    Word3 = "";

        text(white on black);
       cout << "String: ";
       cin >> Input;
       for (int i = 0; i < 6; i++)
       {
           cout << "1\n";
           if (Input[i] != '-')
           {
               cout << "2-2\n";
               if (OnWord == 1)
               {
               Word1 += Input[i];
               }
               if (OnWord == 2)
               {
                Word2 += Input[i];
               }
               if (OnWord == 3)
               {
                Word3 += Input[i];
               }
           }
           else
           {
               OnWord++;
            }
       }
       cout << Word1 << endl;
       cout << Word2 << endl;
       cout << Word3 << endl;


Errors on lines 26, 30, and 34.

Is there something wrong with += to a char[]?
Last edited on
Topic archived. No new replies allowed.