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

²é¿´: 1687  |  »Ø¸´: 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):¸ø¸öºì°ü£¬Ð»Ð»»ØÌû½»Á÷
ÒýÓûØÌû:
Originally posted by zyj8119 at 2010-11-09 20:13:11:

Êǵġ£¡£¡£

VC6²»Ö§³ÖC++±ê×¼µÄ£¬Íæ´¿C++µÄ»°Ò»¶¨ÒªÔ¶ÀëVC6£¬Õæ°®ÉúÃü¡£
Á÷Ã¥²»¿ÉÅ£¬¿ÉŵÄÊÇÁ÷Ã¥ÓÐÎÄ»¯£¬ÓÐÎÄ»¯ÓÖBHµÄÁ÷Ã¥ÎÞµÐ~~£¡
7Â¥2010-11-09 20:35:07
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢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µÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[»ù½ðÉêÇë] 2026Äê8ÔÂ25ÈÕ¹ú×ÔÈ»·Å°ñǰͻȻÊÕµ½ÁÐÈëÆÀÉóר¼ÒÓʼþ£¬ÓйØÏµÂ𣿠+20 ľˮ˼¶¹ 2026-08-25 23/1150 2026-08-26 06:35 by echo8914667
[¹«Åɳö¹ú] ÊÛSCIÒ»ÇøÎÄÕ£¬ÎÒ:8.O.551.O.5.4,¿ÆÄ¿È«,¿ÉÙ¤¼± +3 PbwVEMK5haaE 2026-08-25 5/250 2026-08-26 05:09 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
[»ù½ðÉêÇë] ÔÚ¼á±ù»¹¸Ç×ű±º£µÄʱºò£¬ÎÒ¿´µ½ÁËÅ­·ÅµÄ÷»¨¡£ (½ð±Ò+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
[»ù½ðÉêÇë] 2026¹ú×ÔÈ»º¯ÆÀ·Ñµ½ÕË +20 ÑòÑü°å 2026-08-21 23/1150 2026-08-25 16:34 by zsna
[»ù½ðÉêÇë] ½ñÈÕ²»·Å°ñ£¿Íø´«¹ú×ÔȻԤ¼Æ 8 Ô 27 Èտɲé½á¹û +17 ҽѧÀÏÄк¢ 2026-08-20 22/1100 2026-08-25 15:36 by ҽѧÀÏÄк¢
[»ù½ðÉêÇë] ûÓÐÈκÎÏûÏ¢-ÊDz»ÊǾÍÁ¹ÁË +9 ͼÀ²Í¼À² 2026-08-24 10/500 2026-08-25 11:59 by ÄϺ£Ð¡¸ç
[»ù½ðÉêÇë] ½ñÌì»ù½ð»á³ö½á¹ûÂð£¿20260819 +17 kkkl_v 2026-08-19 18/900 2026-08-25 09:41 by windflowerwy
[»ù½ðÉêÇë] ·¶½øÖоÙÒ»ÎĵÄÖÐÐÄ˼Ïë +7 Ñ׻ƹóëÐ 2026-08-22 8/400 2026-08-25 08:48 by ZJTJZ
[»ù½ðÉêÇë] ÄÜ·ñÍ˳ö²ÎÓëµÄÃæÉÏÏîÄ¿½â³ýÏÞÏî +21 koalala 2026-08-24 24/1200 2026-08-24 19:25 by ¼ÒÓëÔ¶·½
[»ù½ðÉêÇë] filecode£¬4¸öjtjcÁË +14 ziyangfang 2026-08-19 17/850 2026-08-24 18:37 by ¹þ¹þ¸ò£¿
[»ù½ðÉêÇë] ½¨Òé»ù½ð·¢²¼Ìáǰ¸ø³öÃ÷È·µÄʱ¼äµã +13 kulium 2026-08-21 16/800 2026-08-24 16:27 by superceng
[»ù½ðÉêÇë] ¿ÆÑй¶ùÌ«ÄÑÁË +18 ÎÒ4´ó°×²Ë 2026-08-20 19/950 2026-08-24 09:47 by ¿­¶÷¹ãÊ¢´ß»¯·ÖÎ
[½Ìʦ֮¼Ò] Ìø²ÛºóÔÚÑÐÏîÄ¿Ôõô°ì£¿ +5 ¼òµ¥»¯xn 2026-08-22 10/500 2026-08-23 12:38 by ¼òµ¥»¯xn
[»ù½ðÉêÇë] ½ñÌì·Å°ñÂ𣿠+15 ²¼²¼ºÍÒ»¶þ 2026-08-19 16/800 2026-08-23 09:55 by ÕÅ´ºÉú
[»ù½ðÉêÇë] ¿´À´½ñÌì²»»á·Å°ñÁË£¿ +8 chengyan1220 2026-08-21 11/550 2026-08-21 17:52 by dcqxinyang
[»ù½ðÉêÇë] Ó¦¸ÃÊÇÏÂÖÜÈý26ÈÕ¹«²¼Á˰ɣ¿ +4 ¹þ¹þ¸ò£¿ 2026-08-21 4/200 2026-08-21 10:58 by Vivilian
[»ù½ðÉêÇë] ½ñÌì·Å°ñûϷÁ衃 +9 yuleib84 2026-08-19 11/550 2026-08-21 10:06 by gltch
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û