打印九九乖法表:
#include<stdio.h>
main()
{int i,j;
for(j=1;j<=9;j++)
{for(i=1;i<=j;i++)
printf("%d*%d=%2d ",i,j,i*j);
printf("\n");
}
(经网友介绍,我真的很想用它来调试C程序)为什么总是出现这样错误,不知道是不是操作不当:--------------------Configuration: Cpp8 - Win32 Debug--------------------
Compiling...
Cpp8.cpp
D:\vc\Debug\Cpp8.cpp(9) : fatal error C1004: unexpected end of file found
Error executing cl.exe.Cpp8.exe - 1 error(s), 0 warning(s)

解决方案 »

  1.   

    #include<stdio.h>
    main()
    {
     int i,j;
     for(j=1;j<=9;j++)
     { 
      for(i=1;i<=j;i++)
        printf("%d*%d=%2d ",i,j,i*j);
      printf("\n");
     }
    }
      

  2.   

    重新建个工程copy一下就可以了,这是C++编译器毛病,English版也有这个问题
    在MFC中没有.
      

  3.   

    OnceILoveLinda(我爱你) (  ) 信誉:100  2002-10-15 12:32:00  得分:0  
     
     
      main函数没有}号结束阿
     
     
      

  4.   

    少了一个}括号#include<stdio.h>main()
    {
      int i,j;
      for(j=1;j<=9;j++)
      {
        for(i=1;i<=j;i++)
          printf("%d*%d=%2d ",i,j,i*j);
        printf("\n");
      }
    }
      

  5.   

    也是一样错误,我觉得绝不程序问题.我以前按上楼(小吴)那样成功过一次.我的操作是新建>c++source file>输入程序>F7>保存到前debug.(拷上一个调试)错误:-------------------Configuration: Cpp0 - Win32 Debug--------------------
    Compiling...
    Cpp0.cpp
    d:\vc\debug\cpp0.cpp(7) : error C2065: 'printf' : undeclared identifier
    d:\vc\debug\cpp0.cpp(10) : warning C4508: 'main' : function should return a value; 'void' return type assumed
    Error executing cl.exe.Cpp0.exe - 1 error(s), 1 warning(s)
    请各位再看看.我操作有没错?原因所在?
      

  6.   

    你应该这样操作~
    新建工程
    Windows Console 程序
    A Hello World Project
    然后你就可以调试、运行自己的程序了~
      

  7.   

    warning就不用理它了~
    你可以给main函数加个返回值void……
      

  8.   

    以前我一直用TC,第一次用创天中文VC++:还是较不定它.失礼失礼.我输入很多简单的程序,不可能是程序错误的啊!真的不知道怎样较了?
      

  9.   

    不是main函数没有}号结束.是我粘贴错的!
      

  10.   

    hehe ..interesting for newcomers .....:)but .....u'd use a neat style of programming ...it's nice for ur future ...
      

  11.   

    按我说的~建立一个工程……
    然后……
    #include "stdafx.h"
    #include <stdio.h>void main()
    {
    int i,j;
    for(j=1;j<=9;j++)
    {
    for(i=1;i<=j;i++)
    printf("%d*%d=%2d",i,j,i*j);

    printf("\n");
    }
    }结果……
    1*1= 1
    1*2= 22*2= 4
    1*3= 32*3= 63*3= 9
    1*4= 42*4= 83*4=124*4=16
    1*5= 52*5=103*5=154*5=205*5=25
    1*6= 62*6=123*6=184*6=245*6=306*6=36
    1*7= 72*7=143*7=214*7=285*7=356*7=427*7=49
    1*8= 82*8=163*8=244*8=325*8=406*8=487*8=568*8=64
    1*9= 92*9=183*9=274*9=365*9=456*9=547*9=638*9=729*9=81
      

  12.   

    搂住: 
    Compiling...
    Cpp8.cpp
    D:\vc\Debug\Cpp8.cpp(9) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.Cpp8.exe - 1 error(s), 0 warning(s)
    你提出这个错误就是缺少了} 号,加了就可以运行了。
    没有缺少}你怎么出现这个错误的??
    然后加了之后是什么错误呢?
    至于你说:
      d:\vc\debug\cpp0.cpp(7) : error C2065: 'printf' : undeclared identifier
    d:\vc\debug\cpp0.cpp(10) : warning C4508: 'main' : function should return a value是另外的错误了
    改成void main()
    而且,看清楚 printf
                 ~~~~~~你不会写成pritnf之类的进去把?。
    应该没问题的
      

  13.   

    根本不用新建工程,你建立好cpp,点编译,她会提示你是否为
    该程序做个工程,点yes,Then ok
    ,楼主最上面的代码只要加上}号就行了,除非她装的vc有问题(那就重装)
    。我在这运行的很好。