Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

cºÍc++ÖеÄconstµÄÇø±ð

ÏÈ¿´Ò»¸ö³ÌÐò
#include <stdio.h>

int main()
{
const int a = 5;
int b[a];

return 0;
}
ÔÚvc6.0ÖÐÃüÃûΪ.cÎļþ£¬±àÒë»á³ö´í£¬ÊÇint b[a]ÕâÒ»ÐУºexpected constant expression
        ÃüÃûΪ.cppÎļþ£¬Ã»ÎÊÌâ¡£
ÔÚcodeblocks(Ò»¸öÃâ·Ñ¿ªÔ´µÄ±àÒëÆ÷)ÖбàÒ붼ûÎÊÌâ

»¹ÓÐÒ»¸ö³ÌÐò
#include <stdio.h>

int main()
{
const int a = 5;
int b = 4;

switch (b)
{
    case 3:
    case a:
    case 4:
    printf("asdf");
    break;
}
return 0;
}
ÔÚvc6.0ÖÐÃüÃûΪ.cÎļþ£¬±àÒë»á³ö´í£¬ÊÇcase a:ÕâÒ»ÐУºcase expression not constant
        ÃüÃûΪ.cppÎļþ£¬Ã»ÎÊÌâ¡£
ÔÚcodeblocksÖÐн¨c¹¤³ÌÎļþ±àÒë»á³ö´í£¬Ð½¨c++¹¤³ÌÎļþ²»»á³ö´í¡£

´ÓÉÏÃæÁ½¸öÀý×ÓÊDz»ÊÇ˵ÔÚcÖÐÓÃconst¶¨ÒåµÄaÊÇÒ»¸öÖ»¶ÁµÄ±äÁ¿£¬¶øÔÚc++ÖÐÓÃconst¶¨ÒåµÄa±»µ±³ÉÒ»¸ö³£Á¿ÁË£¿
Chiyer¡¿:
constÊÇÒ»¸öCÓïÑԵĹؼü×Ö£¬ËüÏÞ¶¨Ò»¸ö±äÁ¿²»ÔÊÐí±»¸Ä±ä¡£Ê¹ÓÃconstÔÚÒ»¶¨³Ì¶ÈÉÏ¿ÉÒÔÌá¸ß³ÌÐòµÄ½¡×³ÐÔ£¬ÁíÍ⣬ÔÚ¹Û¿´±ðÈË´úÂëµÄʱºò£¬ÇåÎúÀí½âconstËùÆðµÄ×÷Ó㬶ÔÀí½â¶Ô·½µÄ³ÌÐòÒ²ÓÐһЩ°ïÖú¡£ 
      ËäÈ»ÕâÌýÆðÀ´ºÜ¼òµ¥£¬µ«Êµ¼ÊÉÏ£¬constµÄʹÓÃÒ²ÊÇcÓïÑÔÖÐÒ»¸ö±È½Ï΢ÃîµÄµØ·½£¬Î¢ÃîÔںδ¦ÄØ£¿Çë¿´ÏÂÃ漸¸öÎÊÌâ¡£

¡¡¡¡ÎÊÌ⣺const±äÁ¿ & ³£Á¿

¡¡¡¡ÎªÊ²Ã´


Ïà¹ØÎÊ´ð£º

²ËÄñÇó½â:cͼÐÎÎÊÌâ

#include <stdio.h>
#include <graphics.h>
void main()
{
  int x0,y0,x1,y1,driver,mode,i;
  driver=VGA;
  mode=VGAHI;
  initgraph(&driver,&mode,&qu ......

C ³ÌÐòÎÊÌâ (¶þ) - C/C++ / CÓïÑÔ

ÎÊһϣº
#include <stdio.h>
int main()
{
  char x, y, z;
  int i;
  int a[16];
  for(i=0; i<=16; i++)
  {
  a[i] = 0;
  ......

ÄÜÓÃC/C++¼òµ¥ÊµÏÖÎå×ÓÆå³ÌÐòÂð?

×î½üͻȻÏë×Ô¼ºÀ´ÊµÏÖÒ»¸öÎå×ÓÆå³ÌÐò,µ«²»ÖªµÀÔõô¿ªÊ¼,×Ô¼ºÒ²Ã»Ñ§»­Í¼Ðκ¯Êý,ÄÜÔÚ¿ØÖÆ̨ÏÂÖ±½ÓдÂð>>>?????
¿ØÖÆ̨£¿±ÈͼÐνçÃæ¸üÂé·³¡£
http://search.download.csdn.net/search/%E4%BA%94%E5%AD%90% ......

[Çó¸Ö²ÄÇиîÎÊÌâµÄC/C++Ë㷨ʵÏÖ]

ÎÊÌâ:¹¤µØÉÏÐèÒª³¤¶ÈΪA1µÄ¸Ö½îX¸ù,³¤¶ÈΪA2µÄ¸Ö½îY¸ù,³¤¶ÈΪA3µÄ¸Ö½îZ¸ù......ÒÔ´ÎÀàÍÆ.
ÆäÖÐA1,A2,A3,...³¤¶ÈÈÎÒâÖ¸¶¨,X,Y,Z,...ÊýÁ¿Ò²ÈÎÒâÖ¸¶¨.

µ«²Ö¿âÖеĸֽîΪ±ê×¼³¤¶È,Ö»ÓÐ9Ã׺Í15Ã×Á½ÖÖ³¤¶È,ÊýÁ¿² ......

ÇóÕäÆ·£¬´ÓÍ·ÎļþÖн«C½á¹¹½âÎö²¢Êä³ö³öÀ´¡£

±³¾°£º
£­£­£­£­£­£­£­£­
Í·Îļþdb_method.h¾­¹ýÃÀ»¯ºó´æÔÚÏÂÃ漸Öֽṹ¶¨ÒåÀàÐÍ
typedef struct
{
BYTE id;
BYTE idAsync;
DM_T dmInfo;
CHAR tbName[MAX_TBNAME_LEN];
} REC ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ