24СʱÈÈÃŰæ¿éÅÅÐаñ    

²é¿´: 1684  |  »Ø¸´: 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µÄ»ØÌû

zyj8119

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

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

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

´ËÌù½áÌù¡£
ºÃºÃѧϰ£¬ÌìÌìÏòÉÏ¡£
4Â¥2010-11-03 07:25:52
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢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µÄ»ØÌû

magic7004

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

¡ï
Сľ³æ(½ð±Ò+0.5):¸ø¸öºì°ü£¬Ð»Ð»»ØÌû½»Á÷
ÄѵÀÂ¥Ö÷ÓõÄÊÇVC6Âð£¿
Á÷Ã¥²»¿ÉÅ£¬¿ÉŵÄÊÇÁ÷Ã¥ÓÐÎÄ»¯£¬ÓÐÎÄ»¯ÓÖBHµÄÁ÷Ã¥ÎÞµÐ~~£¡
5Â¥2010-11-03 18:08:01
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¹«Åɳö¹ú] ÊÛSCIÒ»ÇøÎÄÕ£¬ÎÒ:8.O.551.O.5.4,¿ÆÄ¿È«,¿ÉÙ¤¼± +3 PbwVEMK5haaE 2026-08-25 4/200 2026-08-26 03:20 by cNXvBfCpiZOM
[¿¼ÑÐ] ÊÛSCIÒ»ÇøT0PÎÄÕ£¬ÎÒ:8.O.55.1.O.5.4,¿ÆÄ¿È«,¿É+¼± +3 7K1CJE38xLG4 2026-08-25 4/200 2026-08-26 02:04 by cNXvBfCpiZOM
[ÂÛÎÄͶ¸å] ÊÛSCIÒ»ÇøT0PÎÄÕ£¬ÎÒ:8O.55.1.O.5.4,¿ÆÄ¿ÆëÈ«,¿É+¼± +3 7K1CJE38xLG4 2026-08-25 4/200 2026-08-26 02:04 by cNXvBfCpiZOM
[»ù½ðÉêÇë] 2026Äê8ÔÂ25ÈÕ¹ú×ÔÈ»·Å°ñǰͻȻÊÕµ½ÁÐÈëÆÀÉóר¼ÒÓʼþ£¬ÓйØÏµÂ𣿠+17 ľˮ˼¶¹ 2026-08-25 20/1000 2026-08-26 01:26 by chengyan1220
[»ù½ðÉêÇë] ÔÚ¼á±ù»¹¸Ç×ű±º£µÄʱºò£¬ÎÒ¿´µ½ÁËÅ­·ÅµÄ÷»¨¡£ (½ð±Ò+10) +6 ziyangfang 2026-08-25 9/450 2026-08-25 20:26 by huagongfeihu
[»ù½ðÉêÇë] ÓÐûÓдóÉñ°ïÎÒ¿´¿´»ù½ð´úÂë 28+4 1234567wang 2026-08-24 10/500 2026-08-25 19:15 by lfy8008
[»ù½ðÉêÇë] ·Å°ñǰµÄ²»µ­¶¨ 20+4 snowwithsea 2026-08-19 19/950 2026-08-25 17:57 by chick875
[»ù½ðÉêÇë] ijЩ»ú¹¹£¬ÒÔЧÂʵÍΪÈÙ£¬ÒÔЧÂʵÍ×÷Ϊ´æÔڸР+9 yuleib84 2026-08-25 10/500 2026-08-25 17:14 by alexon
[»ù½ðÉêÇë] ½ñÈÕ²»·Å°ñ£¿Íø´«¹ú×ÔȻԤ¼Æ 8 Ô 27 Èտɲé½á¹û +17 ҽѧÀÏÄк¢ 2026-08-20 22/1100 2026-08-25 15:36 by ҽѧÀÏÄк¢
[»ù½ðÉêÇë] ÈËÆø²»ÐÐÁË +11 fansofjerry 2026-08-21 11/550 2026-08-25 11:04 by ¹Â¶ÀµÄÓ¢ÐÛ6
[»ù½ðÉêÇë] 2026ÄêµÄ¹ú¼ÒÉç¿Æ»ù½ðÏîĿͨѶÆÀÉóµÄйæÔòÓëж¯Ïò¡¢ÐÂÌôÕ½ +5 process2012 2026-08-23 7/350 2026-08-25 09:42 by huixian257
[»ù½ðÉêÇë] ·¶½øÖоÙÒ»ÎĵÄÖÐÐÄ˼Ïë +7 Ñ׻ƹóëÐ 2026-08-22 8/400 2026-08-25 08:48 by ZJTJZ
[»ù½ðÉêÇë] Ö»ÓÐÿÄêÕâÖÖʱºòÀ´¹ä¹äСľ³æ +25 yaoyewhu2008 2026-08-20 27/1350 2026-08-25 08:01 by Equinoxhua
[»ù½ðÉêÇë] ÄÜ·ñÍ˳ö²ÎÓëµÄÃæÉÏÏîÄ¿½â³ýÏÞÏî +21 koalala 2026-08-24 24/1200 2026-08-24 19:25 by ¼ÒÓëÔ¶·½
[»ù½ðÉêÇë] ÈÃÎÒÖÐÒ»¸öÃæÉϰɣ¡ +13 ´óƼ1987 2026-08-20 16/800 2026-08-24 10:23 by ̫ɵÁË
[»ù½ðÉêÇë] ¿ÆÑй¶ùÌ«ÄÑÁË +18 ÎÒ4´ó°×²Ë 2026-08-20 19/950 2026-08-24 09:47 by ¿­¶÷¹ãÊ¢´ß»¯·ÖÎ
[»ù½ðÉêÇë] ½ñÌì·Å°ñÂ𣿠+15 ²¼²¼ºÍÒ»¶þ 2026-08-19 16/800 2026-08-23 09:55 by ÕÅ´ºÉú
[»ù½ðÉêÇë] ʱ¼ä´ÁÓÖ±äÁË +13 wuchongjun 2026-08-20 19/950 2026-08-21 17:21 by ×Ïɼ´¼
[»ù½ðÉêÇë] Ó¦¸ÃÊÇÏÂÖÜÈý26ÈÕ¹«²¼Á˰ɣ¿ +4 ¹þ¹þ¸ò£¿ 2026-08-21 4/200 2026-08-21 10:58 by Vivilian
[»ù½ðÉêÇë] »ù½ð°¡»ù½ð +4 longfie172 2026-08-20 4/200 2026-08-21 08:58 by mark mao
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û