Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- switch (option)
- {
- case 2:
- {
- char text1[LINES2][MAX_LETTERS2];
- char text2[LINES2][MAX_LETTERS2];
- char text3[LINES2][MAX_LETTERS2];
- int i = 0, lettersCounter = 0, sum1=0, sum2=0, sum3=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 = 0; i < LINES2; i++)
- cin.getline(text2[i], MAX_LETTERS2);
- while (i < LINES2)
- {
- sum1 = strlen(text1[0]) + strlen(text2[0]);
- sum2 = strlen(text1[1]) + strlen(text2[1]);
- sum3 = strlen(text1[2]) + strlen(text2[2]);
- if (sum1 < MAX_LETTERS2)
- {
- strcpy_s(text3[0], text1[0]);
- strcat_s(text3[0], text2[0]);
- }
- if (sum2 < MAX_LETTERS2)
- {
- strcpy_s(text3[1], text1[1]);
- strcat_s(text3[1], text2[1]);
- }
- if (sum3 < MAX_LETTERS2)
- {
- strcpy_s(text3[2], text1[2]);
- strcat_s(text3[2], text2[2]);
- }
- i++;
- }
- cout << "text 3 is : \n";
- for (i = 0; i < LINES2; i++)
- cout << text3[i];
- cout << endl;
Advertisement
Add Comment
Please, Sign In to add comment