zoukankan      html  css  js  c++  java
  • 一个小问题,c++

    void main()
    {
      for(int i=0;i<2;i++)
      {
         //code
      }
    }

    VC++编译器给出以下的信息:
    --------------------Configuration: X - Win32 Debug--------------------
    Compiling...
    X.C
    E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
    E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
    E:\Project\X.C(15) : error C2143: syntax error : missing ')' before 'type'
    E:\Project\X.C(15) : error C2143: syntax error : missing ';' before 'type'
    E:\Project\X.C(15) : error C2065: 'i' : undeclared identifier
    E:\Project\X.C(15) : warning C4552: '<=' : operator has no effect; expected operator with side-effect
    E:\Project\X.C(15) : error C2059: syntax error : ')'
    E:\Project\X.C(16) : error C2143: syntax error : missing ';' before '{'
    执行 cl.exe 时出错.

    X.exe - 1 error(s), 0 warning(s)

    ------------------------------------------------------------------------------------


    现在把程序改成这样:

    void main()
    {
      int i;
      for(i=0;i<2;i++)
      {
         //code
      }
    }

    编译通过.

    很郁闷,为什么啊?
    高手请指教!

  • 相关阅读:
    第二次冲刺第六天
    第二次冲刺第五天
    第二次冲刺第四天
    Java多线程学习篇(三)Lock
    Java多线程学习篇(二)synchronized
    Java多线程学习篇(一)
    codeforces 895D
    模运算的乘法逆元
    codeforces 889B
    codeforces 878C
  • 原文地址:https://www.cnblogs.com/lbk/p/52964.html
Copyright © 2011-2022 走看看