²é¿´: 1709  |  »Ø¸´: 7
±¾Ìû²úÉú 1 ¸ö ³ÌÐòÇ¿Ìû £¬µã»÷ÕâÀï½øÐв鿴
µ±Ç°Ö»ÏÔʾÂú×ãÖ¸¶¨Ìõ¼þµÄ»ØÌû£¬µã»÷ÕâÀï²é¿´±¾»°ÌâµÄËùÓлØÌû

zyj8119

ľ³æ (ÖøÃûдÊÖ)

[½»Á÷] ¡¾ÇóÖú¡¿Ò»¸ö³ÌÐò£¬²»Í¬±àÒëÆ÷½á¹û²»Í¬¡¾ÒÑÍê½á¡¿ ÒÑÓÐ2È˲ÎÓë

CODE:
#include
#include
struct STRU
{     char s1[5],s2[5];
      int a,b;
};

char *str_num(int n)
{    int k=0,m=n,i=0;
     while(m){k++;m/=10;}
         char *str=new char[k+1];
         while(n){
                 str[k-i-1]=n%10+'0';
                 n/=10;i++;
         }
         str[i]='\0';
         return str;
}

char *fun(STRU *p1,int n)
{   int k=0;
    for(int i=0;i                 k+=strlen(p1[i].s1)+strlen(p1[i].s2);
                int t1=p1[i].a,t2=p1[i].b;
                while(t1){k++;t1/=10;}
                while(t2){k++;t2/=10;}
        }
        char *p2=new char[k+1];
        strcpy(p2," ");
        for(i=0;i                 strcat(p2,p1[i].s1);
                strcat(p2,p1[i].s2);
                char *temp=str_num(p1[i].a);
                strcat(p2,temp);
                delete []temp;
                temp=str_num(p1[i].b);
                strcat(p2,temp);
                delete []temp;
                temp=0;
        }
        return p2;
}

void main()
{    STRU st[2]={"AAA","BBB",234,1535,"CCCC","DDDD",9559,453};
     char *p=fun(st,2);
         cout<          delete []p;
}

Õâ¸ö³ÌÐòÓÃVC±àÒëûÎÊÌ⣬µ«ÊÇÓÃmingw develop studio±àÒë³öÏÖÒÔÏ´íÎó£º
In file included from C:\MinGWStudio\MinGW\include\c++\3.3.1\backward\iostream.h:31,
from ggg.cpp:1:
C:\MinGWStudio\MinGW\include\c++\3.3.1\backward\backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated.
ggg.cpp: In function `char* fun(STRU*, int)':
ggg.cpp:30: error: name lookup of `i' changed for new ISO `for' scoping
ggg.cpp:22: error:   using obsolete binding at `i'
ggg.cpp: At global scope:
ggg.cpp:45: error: `main' must return `int'
ggg.cpp:45: error: return type for `main' changed to `int'

ggg.o - 4 error(s), 1 warning(s)

[ Last edited by nono2009 on 2010-11-11 at 07:31 ]
»Ø¸´´ËÂ¥
ºÃºÃѧϰ£¬ÌìÌìÏòÉÏ¡£
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

magic7004

½ð³æ (Ö°Òµ×÷¼Ò)

¡ï
Сľ³æ(½ð±Ò+0.5):¸ø¸öºì°ü£¬Ð»Ð»»ØÌû½»Á÷
ÄѵÀÂ¥Ö÷ÓõÄÊÇVC6Âð£¿
Á÷Ã¥²»¿ÉÅ£¬¿ÉŵÄÊÇÁ÷Ã¥ÓÐÎÄ»¯£¬ÓÐÎÄ»¯ÓÖBHµÄÁ÷Ã¥ÎÞµÐ~~£¡
5Â¥2010-11-03 18:08:01
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
²é¿´È«²¿ 8 ¸ö»Ø´ð

gd88

½ð³æ (СÓÐÃûÆø)

¡ï
zyj8119(½ð±Ò+10):ллÄú¾«²ÊµÄ»Ø¸´£¡£¡£¡£¡ 2010-11-03 07:21:37
nono2009(½ð±Ò+1, ³ÌÐòÇ¿Ìû+1):¹ÄÀøÓ¦Öú 2010-11-11 07:31:20
´ÓĿǰµÄ±àÒëÐÅÏ¢À´¿´£º
warning: #warning This file includes at least one deprecated or antiquated header.
ÄãÕâ¶Î´úÂë°üº¬Á˲»Ô޳ɵĻòÕßÊÇÀϱê×¼µÄÎļþÍ·£¬

Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard.
²Î¿´ C£«£« Standard µÄ 17.4.1.2 (ÎÒ¿´ÁË£¬ÀïÃæÃ»ÓÐ .h )

Examples include substituting the header for the header for C++ includes, or instead of the deprecated header .
ÓÃ<******>´úÌæ<******.h>£¨°Ñ.hÈ¥µô£©£¬
»òÕßÓôúÌæ

To disable this warning use -Wno-deprecated.

±àÒëÆ÷°æ±¾µÄÎÊÌ⣬ĿǰµÄÐÅÏ¢¿´À´¡£
¸ù¾Ý±àÒëµÄÐÅÏ¢×÷ÐÞ¸ÄÏÈ£¬²»ÐеĻ°È¥¿´ C£«£« standard µÄ 17.4.1.2 ²¿·ÖµÄÄÚÈÝ¡£
ÔÙ²»Ðеϰ£¬Ìû³ö±àÒëÐÅÏ¢¡£

---------------------------Áí£º
¸Õ²ÅÎÒÔÚÐéÄâ»úÀï×°Á˸öWinGW 2.05£¬
ÖØÏÖÁËÄãµÄ´úÂë´íÎó£¬
C:\MinGWStudio\MinGW\include\c++\3.3.1\backward\backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated.

È¥µô     .h     ºó£¬
·´ÕýÉÏÃæÖØÏÖµÄÕâ¶Î±àÒë´íÎóûÓÐÁË¡£

£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­
°¥£¬²éÁ˲飬ÊÔÁËÊÔ£¬
±àÒëÆ÷µÄÎÊÌ⣬»òÕß˵±ê×¼µÄÎÊÌâ¡£
ÄãÊÔÏÂÕâ¶Î´úÂë°Ñ£¬ÎÒÕâÀï½ö½öÊDZàÒëͨ¹ýÁË¡£  revised    ÊÇÐ޸ĵĵط½¡£
ΪʲôÕâôÐ޸ģ¬ÎÒÒ²ÊǸù¾ÝÄãµÄ±àÒëÐÅÏ¢£¬googleÁËһ϶øÒÑ¡£
Òª·ûºÏÄãµÄ³ÌÐòÐèÇ󣬿ÉÄÜ»¹Òªµ÷һϡ£

±àÒëÆ÷Ö®¼äµÄÎÊÌ⻹ÊÇÒªÖØÊӵġ£
CODE:
#include /*revised*/
#include /*revised*/
struct STRU
{     char s1[5],s2[5];
      int a,b;
};

char *str_num(int n)
{    int k=0,m=n,i=0;
     while(m){k++;m/=10;}
         char *str=new char[k+1];
         while(n){
                 str[k-i-1]=n%10+'0';
                 n/=10;i++;
         }
         str[i]='\0';
         return str;
}

char *fun(STRU *p1,int n)
{   int k=0;
    for(int i=0;i                 k+=strlen(p1[i].s1)+strlen(p1[i].s2);
                int t1=p1[i].a,t2=p1[i].b;
                while(t1){k++;t1/=10;}
                while(t2){k++;t2/=10;}
        }
        char *p2=new char[k+1];
        strcpy(p2," ");
        for(int i=0;i                 strcat(p2,p1[i].s1);
                strcat(p2,p1[i].s2);
                char *temp=str_num(p1[i].a);
                strcat(p2,temp);
                delete []temp;
                temp=str_num(p1[i].b);
                strcat(p2,temp);
                delete []temp;
                temp=0;
        }
        return p2;
}

int main() /*revised*/
{    STRU st[2]={"AAA","BBB",234,1535,"CCCC","DDDD",9559,453};
     char *p=fun(st,2);
         std::cout<          delete []p;
         return 0; /*revised*/
}

[ Last edited by gd88 on 2010-11-3 at 04:47 ]
2Â¥2010-11-03 03:05:06
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

zyj8119

ľ³æ (ÖøÃûдÊÖ)

ÒýÓûØÌû:
Originally posted by gd88 at 2010-11-03 03:05:06:
´ÓĿǰµÄ±àÒëÐÅÏ¢À´¿´£º
warning: #warning This file includes at least one deprecated or antiquated header.
ÄãÕâ¶Î´úÂë°üº¬Á˲»Ô޳ɵĻòÕßÊÇÀϱê×¼µÄÎļþÍ·£¬

Please consider using one of the 32 he ...

·Ç³£¸Ðл£¡£¡£¡£¡
ºÃºÃѧϰ£¬ÌìÌìÏòÉÏ¡£
3Â¥2010-11-03 07:21:19
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

zyj8119

ľ³æ (ÖøÃûдÊÖ)

ÒýÓûØÌû:
Originally posted by zyj8119 at 2010-11-03 07:21:19:

·Ç³£¸Ðл£¡£¡£¡£¡

´ËÌù½áÌù¡£
ºÃºÃѧϰ£¬ÌìÌìÏòÉÏ¡£
4Â¥2010-11-03 07:25:52
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[»ù½ðÉêÇë] ÎÒ¾ÍÊÇÉêÇëÒ»¸öÃæÉÏÏîÄ¿¶øÒÑ£¬ÕâÆÀÉóÒâ¼ûÊǰ´ÕÕ½ÜÇàµÄÌõ¼þÆÀµÄ°É£¿ +3 gouxfjh 2026-08-28 3/150 2026-08-29 01:01 by jurkat.1640
[»ù½ðÉêÇë] ͶƱ:  ÓжàÉÙÈËÊǽñÌì²éϵͳ֪µÀ½á¹ûµÄ£¿ +16 °®¿´ÊéµÄ¿ÉÀÖ 2026-08-26 18/900 2026-08-29 00:28 by winsaint
[»ù½ðÉêÇë] ¹ú×ÔÈ»ÆÀÉóÒâ¼û +11 wangmingqi 2026-08-28 15/750 2026-08-29 00:17 by fangyl2005
[»ù½ðÉêÇë] ¹ú×ÔÈ»ÃæÉϸ´ÅÌ~»¶Ó­ÌÖÂÛ (½ð±Ò+15) +13 ÇçÌì¼ÓÓÍ 2026-08-26 14/700 2026-08-28 18:36 by huagongfeihu
[»ù½ðÉêÇë] ÓÐûÓÐÈÔûÊÕµ½ÐÅÏ¢µÄ +3 µÂÉÐÖÐÐÐ 2026-08-27 3/150 2026-08-28 15:24 by rongshuxia
[½Ìʦ֮¼Ò] µ¼Ê¦Í²ۣºÎÒÔõô̯ÉÏÁËÕâô¸ö¼«Æ·Ñо¿Éú£¡ +8 ËÕ¶«ÆÂ¶þÊÀ 2026-08-23 8/400 2026-08-28 14:41 by lkforward
[»ù½ðÉêÇë] »ù½ð²»ÖУ¬¹²Ãã +11 eulota 2026-08-26 11/550 2026-08-28 14:22 by »ðÐdz¬ÈËxi
[»ù½ðÉêÇë] Â鷳ר¼ÒÃÇ¿´¿´ÆÀίÃǵÄÒâ¼û£¨F¿ÚÃæÉÏ£© +4 gdd2018 2026-08-28 9/450 2026-08-28 14:22 by jklily
[»ù½ðÉêÇë] »ù½ðδÖУ¬ÕâÖÖ´ð¸´ÊÇÄ£°åÂ𣿠+5 zhaosm1982 2026-08-27 6/300 2026-08-27 16:00 by lfy8008
[»ù½ðÉêÇë] ¿´°åÉÏÕâô¶àÖеģ¬ÓеãÏñ50ÈËȺÀï49¸öÈ˶¼ÊÇÆ­×ÓµÄÄÇÖָоõ¡­¡­ +5 a089 2026-08-26 6/300 2026-08-27 14:05 by jonewore
[»ù½ðÉêÇë] Ôõô¿´Çà»ùÖÐÁËûÓа¡ +5 Ò¶¾Å΢ 2026-08-26 5/250 2026-08-27 10:35 by l_zh2008
[ÎÄѧ·¼²ÝÔ°] ÃÎÏë +3 myrtle 2026-08-26 3/150 2026-08-27 10:01 by angelyueyi
[»ù½ðÉêÇë] ÎÒ²»Àí½â£¡ +15 Edward_pc 2026-08-26 23/1150 2026-08-26 20:34 by zzuzxg
[»ù½ðÉêÇë] 2026Äê8ÔÂ25ÈÕ¹ú×ÔÈ»·Å°ñǰͻȻÊÕµ½ÁÐÈëÆÀÉóר¼ÒÓʼþ£¬ÓйØÏµÂ𣿠+25 ľˮ˼¶¹ 2026-08-25 28/1400 2026-08-26 14:53 by draco1987
[»ù½ðÉêÇë] ¹úºÏÀïÃæÄÜ¿´µ½ÁË +7 Ò»»³Ü°Çï 2026-08-26 7/350 2026-08-26 11:23 by zhaosm1982
[»ù½ðÉêÇë] ÏîÄ¿ÐÅÏ¢ºÍ¾­·ÑÐÅÏ¢ÔÚϵͳÀï¶¼¿ÉÒÔ¿´µ½ÁË +6 wittyboy 2026-08-26 14/700 2026-08-26 10:55 by wittyboy
[»ù½ðÉêÇë] ¹úºÏ¿É²éÁË +3 paperzjh 2026-08-26 3/150 2026-08-26 10:41 by LemmonTr
[Ö°³¡ÈËÉú] ѧÉúײ¼û¸¨µ¼Ô±ËÍÍâÂô£¬µÚ¶þÌìÈ«°à¶¼³ÁĬÁË +3 ¾¨ÓãÈÚ½ð_Õã½­_É 2026-08-22 3/150 2026-08-26 09:01 by zzuzxg
[»ù½ðÉêÇë] ijЩ»ú¹¹£¬ÒÔЧÂʵÍΪÈÙ£¬ÒÔЧÂʵÍ×÷Ϊ´æÔڸР+9 yuleib84 2026-08-25 10/500 2026-08-25 17:14 by alexon
[»ù½ðÉêÇë] ûÓÐÈκÎÏûÏ¢-ÊDz»ÊǾÍÁ¹ÁË +9 ͼÀ²Í¼À² 2026-08-24 10/500 2026-08-25 11:59 by ÄϺ£Ð¡¸ç
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û