±±¾©Ê¯ÓÍ»¯¹¤Ñ§Ôº2026ÄêÑо¿ÉúÕÐÉú½ÓÊÕµ÷¼Á¹«¸æ
²é¿´: 1475  |  »Ø¸´: 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µÄ»ØÌû

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µÄ»ØÌû

magic7004

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

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

zyj8119

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

ÒýÓûØÌû:
Originally posted by magic7004 at 2010-11-03 18:08:01:
ÄѵÀÂ¥Ö÷ÓõÄÊÇVC6Âð£¿

Êǵġ£¡£¡£
ºÃºÃѧϰ£¬ÌìÌìÏòÉÏ¡£
6Â¥2010-11-09 20:13:11
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢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µÄ»ØÌû

zyj8119

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

ÒýÓûØÌû:
Originally posted by magic7004 at 2010-11-09 20:35:07:


VC6²»Ö§³ÖC++±ê×¼µÄ£¬Íæ´¿C++µÄ»°Ò»¶¨ÒªÔ¶ÀëVC6£¬Õæ°®ÉúÃü¡£

ÄÇôdev-c++ºÍmingw-studioÄØ£¿
ºÃºÃѧϰ£¬ÌìÌìÏòÉÏ¡£
8Â¥2010-11-09 20:42:18
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ zyj8119 µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] Äܶ¯µ÷¼Á326ר˶ +4 wan112233 2026-04-04 4/200 2026-04-04 22:47 by yu221
[¿¼ÑÐ] 081200-11408-276ѧ˶Çóµ÷¼Á +3 ´Þwj 2026-04-04 4/200 2026-04-04 22:12 by à£à£à£0119
[¿¼ÑÐ] ²ÄÁϵ÷¼Á +10 ÀÁÑòÑòÇáÖÃÓñÍÎ 2026-04-02 11/550 2026-04-04 21:56 by laoshidan
[¿¼ÑÐ] Ò»Ö¾Ô¸ÉϺ£´óѧÉúÎïѧ346 +3 ÉϺ£´óѧ346µ÷¼Á 2026-04-03 3/150 2026-04-04 20:20 by dongzh2009
[¿¼ÑÐ] 277¹¤¿ÆÇóµ÷¼Á +7 1915668 2026-04-04 7/350 2026-04-04 17:21 by °¡¿¡£¡
[¿¼ÑÐ] ÍÁľ304Çóµ÷¼Á +4 ÍÃͻͻͻ£¬ 2026-03-31 4/200 2026-04-04 13:34 by 1753564080
[¿¼ÑÐ] »¯¹¤Çóµ÷¼Á +11 ÀóÏã֥ʿҬÄÌ 2026-04-03 11/550 2026-04-03 22:06 by à£à£à£0119
[¿¼ÑÐ] Çóµ÷¼Á +4 ѹÁ¦??´ó 2026-04-03 4/200 2026-04-03 21:36 by à£à£à£0119
[¿¼ÑÐ] 285Çóµ÷¼Á +5 AZMK 2026-04-03 8/400 2026-04-03 18:17 by AZMK
[¿¼ÑÐ] 266Çóµ÷¼Á +3 08µçÆø¹¤³Ì 2026-04-03 3/150 2026-04-03 14:05 by 1753564080
[¿¼ÑÐ] 0705Àíѧ294Çóµ÷¼Á +3 ³É¹û³É¹ûcg5 2026-04-03 3/150 2026-04-03 14:04 by simons1972
[¿¼ÑÐ] ר˶ 351 086100 Ò²ÊÇ¿¼µÄ²Ä¿Æ»ù ±¾¿ÆÒ²ÊDzÄÁÏ +8 202451007219 2026-04-02 8/400 2026-04-03 09:50 by À¶ÔÆË¼Óê
[¿¼ÑÐ] 366Çóµ÷¼ÁÒ»Ö¾Ô¸¶«±±´óѧ +8 ÔËÆøÀ´µÃÈôÓÐËÆÎ 2026-04-02 8/400 2026-04-02 21:39 by dongzh2009
[¿¼ÑÐ] 372·Ö²ÄÁÏÓ뻯¹¤£¨085600£©Ò»Ö¾Ô¸ºþÄÏ´óѧÇóµ÷¼Á +5 À¶¼ãƬ 2026-04-02 6/300 2026-04-02 21:37 by dongzh2009
[¿¼ÑÐ] 285Çóµ÷¼Á +14 AZMK 2026-04-02 14/700 2026-04-02 15:54 by ÉϾÅÌìÀ¿Ô£¨ºÃÔ
[¿¼ÑÐ] 275ѧ˶081000·þ´Óµ÷¼Áµ½ÆäËûרҵ£¬±£²»×¡±¾×¨ÒµÁË +7 һֻССˮţ 2026-04-02 8/400 2026-04-02 14:23 by alice-2022
[¿¼ÑÐ] Ò»Ö¾Ô¸346ÉϺ£´óѧÉúÎïѧ +3 ÉϺ£´óѧ346µ÷¼Á 2026-04-01 3/150 2026-04-02 08:36 by w³æ³æ123
[¿¼ÑÐ] 08ÉúÎïÓëҽҩר˶³õÊÔ346ÕÒµ÷¼Á +6 dianeeee 2026-04-01 7/350 2026-04-02 08:23 by guoweigw
[¿¼ÑÐ] 311Çóµ÷¼Á +10 ÀîÜÆÐÂ1 2026-03-31 10/500 2026-04-01 14:38 by chenqifeng666
[¿¼ÑÐ] µ÷¼ÁÉêÇë +8 ÕÅÕÅÕÅÕÅzy 2026-03-31 9/450 2026-04-01 08:29 by zjbkx
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û