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
      }
    }

    编译通过.

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

  • 相关阅读:
    814. Binary Tree Pruning
    50. Pow(x, n)
    698. Partition to K Equal Sum Subsets
    416. Partition Equal Subset Sum
    150. Evaluate Reverse Polish Notation
    322. Coin Change
    Vulnerable Kerbals CodeForces
    D. Domino for Young
    C. Long Beautiful Integer
    B. Modulo Equality
  • 原文地址:https://www.cnblogs.com/lbk/p/52964.html
Copyright © 2011-2022 走看看