鱼C论坛

 找回密码
 立即注册
查看: 3143|回复: 8

求大神解释????

[复制链接]
发表于 2014-8-12 10:46:57 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#include,stdio.h>
int main(){
        int, total=;
        for(i=1;i=<100; i++){
                total+=i;
        }
        printf("1+2+3+...+99+100=%d\n", total);
        return0;
}
那里错啦  求大神解释??
c:\documents and settings\administrator\桌面\helloworde\helloworde.c(7) : error C2143: syntax error : missing '{' before 'string'
c:\documents and settings\administrator\桌面\helloworde\helloworde.c(7) : error C2059: syntax error : '<Unknown>'
c:\documents and settings\administrator\桌面\helloworde\helloworde.c(7) : error C2059: syntax error : ')'
c:\documents and settings\administrator\桌面\helloworde\helloworde.c(9) : error C2059: syntax error : '}'
执行 cl.exe 时出错.
helloworde.obj - 1 error(s), 0 warning(s)
提示的什么看不懂??
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2014-8-12 10:53:51 | 显示全部楼层
#include,stdio.h> 改成#include <stdio.h>
int, total=; 改成 int total=0;
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-8-12 11:05:50 | 显示全部楼层
machimilk 发表于 2014-8-12 10:53
#include,stdio.h> 改成#include
int, total=; 改成 int total=0;

#include<stdio.h>
int main(){
        int i, total=0;
        for(i=1;i<=100; i++){
                total+=i;
        }
        printf("1+2+3+...+99+100=%d\n", total);
        return=0;
}
改啦还是不行啊  
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2014-8-12 11:12:02 | 显示全部楼层
本帖最后由 yvqiang 于 2014-8-12 11:14 编辑
hmz 发表于 2014-8-12 11:05
#include
int main(){
        int i, total=0;

我的可以,你再试试:
  1. #include<stdio.h>

  2. int main()
  3. {
  4.     int i, total=0;
  5.         
  6.     for(i = 1;i <= 100; i++)
  7.     {
  8.         total += i;
  9.     }
  10.         
  11.     printf("1+2+3+...+99+100=%d\n", total);
  12.    
  13.     return 0;
  14.    
  15. }
复制代码

                               
登录/注册后可看大图



小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-8-12 11:19:06 | 显示全部楼层
yvqiang 发表于 2014-8-12 11:12
我的可以,你再试试:

--------------------Configuration: helloworde - Win32 Debug--------------------
Compiling...
helloworde.c
C:\Documents and Settings\Administrator\桌面\helloworde\helloworde.c(8) : error C2143: syntax error : missing ';' before '='
C:\Documents and Settings\Administrator\桌面\helloworde\helloworde.c(8) : warning C4033: 'main' must return a value
执行 cl.exe 时出错.

helloworde.obj - 1 error(s), 0 warning(s)
不行
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2014-8-12 11:25:14 | 显示全部楼层
本帖最后由 yvqiang 于 2014-8-12 11:26 编辑
hmz 发表于 2014-8-12 11:19
--------------------Configuration: helloworde - Win32 Debug--------------------
Compiling...
hel ...

那很有可能是你的vc问题了,我复制的,可以运行:

                               
登录/注册后可看大图


小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-8-12 11:26:45 | 显示全部楼层
yvqiang 发表于 2014-8-12 11:25
那很有可能,是你的vc问题了,我复制的,可以运行:

我复制也是可以运行可是到自己编的时候就执行出错,
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2014-8-12 11:35:49 | 显示全部楼层
hmz 发表于 2014-8-12 11:05
#include
int main(){
        int i, total=0;

return=0;改成 return 0;

编辑的时候认真点 就不会出现那么多错误
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-8-12 11:39:17 | 显示全部楼层
machimilk 发表于 2014-8-12 11:35
return=0;改成 return 0;

编辑的时候认真点 就不会出现那么多错误

好的  谢啦
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-12 21:11

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表