Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char text1[LINES2][MAX_LETTERS2];
- char text2[LINES2][MAX_LETTERS2];
- char text3[LINES2][18];
- int i = 0, lettersCounter = 0, sumText1 = 0, sumText2 = 0, sumTwoAndOne = 0;
- cout << "Please fill text 1 with " << LINES2 << " lines and max " << MAX_LETTERS2 << " letters" << endl;
- for (i = 0; i <= LINES2; i++)
- cin.getline(text1[i], MAX_LETTERS2);
- cout << "Please fill text 2 with " << LINES2 << " lines and max " << MAX_LETTERS2 << " letters" << endl;
- for (i = 1; i <= LINES2; i++)
- cin.getline(text2[i], MAX_LETTERS2);
- for (i = 1; i <= LINES2; i++, sumTwoAndOne = 0)
- {
- sumText1 = strlen(text1[i]);
- sumText2 = strlen(text2[i]);
- sumTwoAndOne = sumText1 + sumText2;
- if (sumTwoAndOne <= MAX_LETTERS2)
- {
- strcpy_s(text3[i], text1[i]);
- strcat_s(text3[i], text2[i]);
- }
- else if (sumTwoAndOne > MAX_LETTERS2)
- text3[i] == " ";
- }
- cout << "text 3 is : \n";
- for (i = 1; i <= LINES2; i++)
- cout << text3[i] << endl;
Advertisement
Add Comment
Please, Sign In to add comment