include stdafx include stdio include conio include string char str1 40

 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
#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "string.h"
char str1[40], str2[40], str[80];
int i = 0, len1 = 0, len2 = 0, len = 0, count = 0;
int main()
{
printf("Pervaya stroka: \n");
gets(str1);
printf("Vtoraya stroka: \n");
gets(str2);
do {
len1++;
} while (str1[len1] != '\0');
do {
len2++;
} while (str2[len2] != '\0');
int len=0;
for ( i = 0; i<len; i++ ) {
if (str1[i] != ' ') {
str[len] = str1[i]; len++;}
}
for ( i = 0; i<len; i++ ) {
if (str2[i] != ' ') {
str[len] = str2[i]; len++;}
}
i = 1; /* обязательно сначала объявляем переменную */
while ( i < str[len] ) {
if(str[i] != 32) {str[i]=' ';}
i+=2;
}
}