I am trying to store strings in a 2d array to seperate the text that is between certain charators. It outputs the strings, but with other charactors what i don't wan't also. Can anyone tell me how to correct this? Thankyou for your time.
Code:#include <iostream.h> int main() { char string[5][8]; char words[30] = "TEXT+TEST+TEXT+TEXT"; int x,y; for (y = 0; y < 4; y++) { for (x = 0; x < 4; x++) { if (words [x] == '+') continue; string[y][x] = words[x]; } } for (x = 0; x < 4; x++) { cout << string[x] <<endl; } cin.get(); return 0; }



LinkBack URL
About LinkBacks


