½«Á½¸ö×Ö·û´®Á¬½ÓÔÚÒ»Æð

ʱ¼ä£º2015.10.25 ·¢²¼ÈË£ºw123_2015_2015

½«Á½¸ö×Ö·û´®Á¬½ÓÔÚÒ»Æð

Òѽâ¾öÎÊÌâ

¹È¸èw123_2015_2015Óû§ÔÚ2015.10.25Ìá½»Á˹ØÓÚ¡°º£×Ó½«Á½¸ö×Ö·û´®Á¬½ÓÔÚÒ»Æ𡱵ÄÌáÎÊ£¬»¶Ó­´ó¼ÒÓ¿Ô¾·¢±í×Ô¼ºµÄ¹Ûµã¡£Ä¿Ç°¹²ÓÐ1¸ö»Ø´ð£¬×îºó¸üÐÂÓÚ2024-11-14T12:39:00¡£

#include<stdio.h>

typedefstruct

{

chara[100];

intlen;

}str;

voidoutput(str*s)

{

inti;

for(i=0;i<strlen(s);i++)

printf("%c",s->a[i]);

}

voidmain()

{

inti,j;

str*s,*t;

s->a[5]="ascde";

t->a[3]="qaz";

if(s->len+t->len<=100)

for(i=s->len;i<s->len+t->len;i++)

for(j=0;j<t->len;j++)

s->a[i]=t->a[j];

output(s);

}


Ï£Íû´ó¼ÒÄܹ»°ïÖúËý¡£

ÏêϸÎÊÌâÃèÊö¼°ÒÉÎÊ£º

#include<stdio.h>

typedefstruct

{

chara[100];

intlen;

}str;

voidoutput(str*s)

{

inti;

for(i=0;i<strlen(s);i++)

printf("%c",s->a[i]);

}

voidmain()

{

inti,j;

str*s,*t;

s->a[5]="ascde";

t->a[3]="qaz";

if(s->len+t->len<=100)

for(i=s->len;i<s->len+t->len;i++)

for(j=0;j<t->len;j++)

s->a[i]=t->a[j];

output(s);

}


ÆÚ´ýÄúµÄ´ð°¸£¬²»ÖªµÀ˵ʲô,ËÍÄãÒ»¶äСºì»¨°É £¡
Ï£ÍûÒÔϵĻشð£¬Äܹ»°ïÖúÄã¡£

µÚ1¸ö»Ø´ð

Óû§Ãû£º.¼«¿Í´óÊå.  

#include<stdiÀ´×Ôo.h>

#include<stdlib.h>

typedefstruct

{

chara[10ÎÊ´ð0];

intlen;

}str;


voidoutput(strs)

{

i±¶¼ÊÐë¹¥nti;

for(i=0;i<s.len;i++)

priÒ¹ÒËÁپżòÊ©¿ª»÷¾§Ê¯·Éntf("%c",s.a[i]);

}


voidmain()

{

inti,j;

strs,t;

sprintf(s.a,"%s","ascde");

s.len=5;

sprintf(½×Í»ÀïÇëÇáʾº¬t.a,"%s","qaz");

t.le½º¶àͬËõ¿É×󴹺ó±à¸®ÒËn=3;

if(s.len+t.len<=100)

{

for(i=0;i<t.len;i++)

s.a[s.len+i]=t.a[i];

s.len+=t.len;

}

output(s);

}

==================

ÎÊÌâºÍÒâ¼û£º

1¡¢²»ÊÇËùÓеط½¶¼±ØÐëÓýṹ£¬²»Ì«Ã÷°×ÄãÕâô¶àÌâÄ¿¶¼¼ÈÆÚÔÚÓýṹ¡£

2¡¢¶Ô×Ö·ûÊý×鸳ֵ²»ÄܲÉÓÃÖ±½Ó="×Ö·û´®"£¨ÉêÃ÷´¦³ýÍ⣩

3¡¢¼´±ãÓñðµÄº¯Êý¸³Ö**ɹ¦£¬ÆäÖеÄlen³ÉÔ²²»»á×Ô¶¯¸Ä±ä

Õâ¸ö´úÂë½ö½öÊÇ°ïÄã¸Äµ½ÄÜÕý³£ÔËÐУ¬µ«ÕâÑùµÄËã·¨Âß¼­ÊÇû±ØÒªµÄ¡£