#include <stdio.h>
/*
*explain:请用户分别输入firstName和lastName,把它们接在一起。
*time: 2013-09-12
*version:1.0
*/
int main()
{
char firstName[100] = {0};
char lastName[100] = {0};
int i = 0,j = 0;
printf("Please enter your firstname:");
scanf("%s",firstName);
printf("Please enter your lastName:");
scanf("%s",lastName);
for(i = 0;i <= 100;i++)
{
if(firstName[i] == '\0')
{
break;
}
}
//现在i的值就是firstName的个数,那么就要循环i次
for(; j < 100;j++)
{
firstName[i] = lastName[j];
i++;
}
printf("%s\n",firstName);
system("pause");
return 0;
}
/*
*explain:请用户分别输入firstName和lastName,把它们接在一起。
*time: 2013-09-12
*version:1.0
*/
int main()
{
char firstName[100] = {0};
char lastName[100] = {0};
int i = 0,j = 0;
printf("Please enter your firstname:");
scanf("%s",firstName);
printf("Please enter your lastName:");
scanf("%s",lastName);
for(i = 0;i <= 100;i++)
{
if(firstName[i] == '\0')
{
break;
}
}
//现在i的值就是firstName的个数,那么就要循环i次
for(; j < 100;j++)
{
firstName[i] = lastName[j];
i++;
}
printf("%s\n",firstName);
system("pause");
return 0;
}