例如: s1 =“ABC”
s2 =“qwerty”
s3将是“AqBwCerty”
让所有人都成为大写字母
它将是“AQBWCERTY”
如何创建它?
谢谢〜这是我在main函数中的当前代码:
char w[100];
char s[50] = "abcderf";
char t[50] = "ARTYY";
int len = strlen(s);
int len1 = strlen(t);
int i, j;
if (len > len1) {
t[50] + s[50];
}
printf("%s", w);
答案 0 :(得分:0)
#include<stdio.h>
#include<string.h>
int main(){
int i,j;
char string_one[100];
char string_two[50]="ASDF";
char string_three[50]="anands";
int len_two=strlen(string_two);
int len_three=strlen(string_three);
if(len_two<=len_three){
for(i=0;i<len_two;i++){
string_one[i*2]=string_two[i];
string_one[i*2+1]=string_three[i];
}
for(j=i*2;i<len_three;i++,j++){
string_one[j]=string_three[i];
}
string_one[j]='\0';
}
else{
for(i=0;i<len_three;i++){
string_one[i*2]=string_two[i];
string_one[i*2+1]=string_three[i];
}
for(j=i*2;i<len_two;i++,j++){
string_one[j]=string_two[i];
}
string_one[j]='\0';
}
puts(string_two);
puts(string_three);
puts(string_one);
puts(strupr(string_one));
return 0;
}