| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3858 人关注过本帖
标题:大家帮忙看看我的程序啊!急!
只看楼主 加入收藏
liaobiao0903
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2008-7-26
收藏
 问题点数:0 回复次数:34 
大家帮忙看看我的程序啊!急!
对C语言不精通,我编了个程序希望,大家帮忙看看啊,看我的程序错在哪里啊,谢谢!

#include "math.h"
  double fftsf(x)             (定义积分函数)
  double x;
  { double y;
    y=f11(x);
    return(y);
  }

   double fftsf(x)
  { double y;
    y=f(12);
    return(y);
  }

double f11(double x,double e,double fc,double z)      ( 定义被积分函数)
  {
 if((e<=0.002)&&(e>=0))
  f11=fc*((2*(e-z*x))/0.002-((e-z*x)/0.002)*((e-z*x)/0.002));
     else if((e<=0.0033)&&(e>=0.002))
    f11=fc*(1-0.15*((e-z*x)-0.002)/0.0013);
         return (f11);
          else
        printf("error\n");
       }

      double f12(double x,double z,double fc,double e)
      {
      f12=fc*((2*(e-z*x))/0.002-((e-z*x)/0.002)*((e-z*x)/0.002))
      return (f12);
      }

  #include "stdio.h"
    #include "9ffts.c"
    main()
    {
      double a,eps,e,k,fc,ft,fy1,fy2,es1,es2,h,as1,as2,as,ey1,ey2;
      double z,xx1,xx2,gh1,gh2,t11;b;
      double a12,b12,t12,h0;      
      k=0.50;
      fc=16.7;
      ft=1.78;
      fy1=354.00;
      fy2=354.00;
      es1=210000.00;
      es2=210000.00;
      h=350.00;
      as1=0.0;
      as2=461.0;
      as=35.0;
      h0=h-as;
      ey1=fy1/es1;
      ey2=fy2/es2;
      while(e<=0.0033)
      z=e/(k*h0);
      xx1=300.00;
      xx2=-300.00;
      gh1=0.002/z;
      gh2=0.0001/z;
    a=0.0; b=k*h0-gh1; eps=0.000001;     (积分上限,下限,积分精度)
      t11=ffts(a,b,eps,f11);
    a=k*h0-gh1; b=k*h0; eps=0.000001;
      t12=ffts(a,b,eps,f12);
  yn=t11+t12;                             (积分求和)     
while ((xx2<=yn)&&(yn<=xx1))
       z=e/(k*h0);
       scanf("%f,%f,%f",&e,&k,&z);
        if(yn<xx2)
         do {k=k+0.0001;}
         while (xx2<=yn);
        if(yn>xx1)
          do {k=k-0.0001;}
         while (yn<=xx1);
            printf("%f\n","%f\n",&z,&yn);  ( 输出结果)                  
          return 0;
     }

[[it] 本帖最后由 liaobiao0903 于 2008-7-29 10:36 编辑 [/it]]
搜索更多相关主题的帖子: C程序 
2008-07-28 21:15
leilei88
Rank: 2
来 自:青岛
等 级:论坛游民
帖 子:217
专家分:27
注 册:2008-3-30
收藏
得分:0 
你才学会一点就急着编程序?先把C基础学会,你现在离编程还比较远。。
2008-07-28 23:18
liaobiao0903
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2008-7-26
收藏
得分:0 
楼上的怎么这样打击人呢?我是学过C语言,计算机二级也过了,但是就没编过大的程序,函数多了就有些晕,如果楼主是高手的话就应该指出我的程序问题出在哪,而不是在打击人。如果你提出了问题,本人将不甚感激!
2008-07-29 08:57
fxstudenting
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2008-7-28
收藏
得分:0 
这个问题我能帮你解答,去这个两博客其中的一个,把问题写到留言版上,我马上给你解答。
http://dlstudenting.
http://fxstudenting.blog.
2008-07-29 09:27
liaobiao0903
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2008-7-26
收藏
得分:0 
请各位大侠看看啊!
2008-07-29 10:36
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
人家不是打击你,我编译了一下,你看看结果吧:

---------- GCC C/C++ ----------
正在编译 C 程序:C:\Documents and Settings\QQ\桌面\tt.c ...
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\168' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\182' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\168' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\210' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\229' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\187' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\253' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\183' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\214' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\186' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\175' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\202' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\253' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:2: error: stray '\169' in program
C:\Documents and Settings\QQ\桌面\tt.c: In function `fftsf':
C:\Documents and Settings\QQ\桌面\tt.c:6: warning: implicit declaration of function `f11'
C:\Documents and Settings\QQ\桌面\tt.c: At top level:
C:\Documents and Settings\QQ\桌面\tt.c:11: error: redefinition of 'fftsf'
C:\Documents and Settings\QQ\桌面\tt.c:4: error: previous definition of 'fftsf' was here
C:\Documents and Settings\QQ\桌面\tt.c: In function `fftsf':
C:\Documents and Settings\QQ\桌面\tt.c:13: warning: implicit declaration of function `f'
C:\Documents and Settings\QQ\桌面\tt.c: At top level:
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\168' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\182' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\168' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\210' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\229' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\177' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\187' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\187' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\253' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\183' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\214' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\186' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\175' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\202' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\253' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:17: error: stray '\169' in program
C:\Documents and Settings\QQ\桌面\tt.c:18: error: conflicting types for 'f11'
C:\Documents and Settings\QQ\桌面\tt.c:6: error: previous implicit declaration of 'f11' was here
C:\Documents and Settings\QQ\桌面\tt.c: In function `f11':
C:\Documents and Settings\QQ\桌面\tt.c:20: error: invalid lvalue in assignment
C:\Documents and Settings\QQ\桌面\tt.c:22: error: invalid lvalue in assignment
C:\Documents and Settings\QQ\桌面\tt.c:23: error: incompatible types in return
C:\Documents and Settings\QQ\桌面\tt.c:24: error: syntax error before "else"
C:\Documents and Settings\QQ\桌面\tt.c: In function `f12':
C:\Documents and Settings\QQ\桌面\tt.c:31: error: invalid lvalue in assignment
C:\Documents and Settings\QQ\桌面\tt.c:31: error: syntax error before "return"
C:\Documents and Settings\QQ\桌面\tt.c:35:19: 9ffts.c: No such file or directory
C:\Documents and Settings\QQ\桌面\tt.c: At top level:
C:\Documents and Settings\QQ\桌面\tt.c:37: warning: return type defaults to `int'
C:\Documents and Settings\QQ\桌面\tt.c: In function `main':
C:\Documents and Settings\QQ\桌面\tt.c:39: error: `b' undeclared (first use in this function)
C:\Documents and Settings\QQ\桌面\tt.c:39: error: (Each undeclared identifier is reported only once
C:\Documents and Settings\QQ\桌面\tt.c:39: error: for each function it appears in.)
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\168' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\187' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\253' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\183' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\214' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\201' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\207' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\207' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\222' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\172' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\207' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\194' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\207' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\222' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\172' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\187' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\253' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\183' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\214' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\190' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\171' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\182' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\200' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:61: error: stray '\169' in program
C:\Documents and Settings\QQ\桌面\tt.c:62: warning: implicit declaration of function `ffts'
C:\Documents and Settings\QQ\桌面\tt.c:65: error: invalid lvalue in assignment
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\168' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\187' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\253' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\183' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\214' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\199' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\243' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\186' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\205' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:65: error: stray '\169' in program
C:\Documents and Settings\QQ\桌面\tt.c:66: error: invalid operands to binary <=
C:\Documents and Settings\QQ\桌面\tt.c:66: error: invalid operands to binary <=
C:\Documents and Settings\QQ\桌面\tt.c:68: warning: float format, double arg (arg 2)
C:\Documents and Settings\QQ\桌面\tt.c:68: warning: float format, double arg (arg 3)
C:\Documents and Settings\QQ\桌面\tt.c:68: warning: float format, double arg (arg 4)
C:\Documents and Settings\QQ\桌面\tt.c:69: error: invalid operands to binary <
C:\Documents and Settings\QQ\桌面\tt.c:71: error: invalid operands to binary <=
C:\Documents and Settings\QQ\桌面\tt.c:72: error: invalid operands to binary >
C:\Documents and Settings\QQ\桌面\tt.c:74: error: invalid operands to binary <=
C:\Documents and Settings\QQ\桌面\tt.c:75: warning: double format, pointer arg (arg 2)
C:\Documents and Settings\QQ\桌面\tt.c:75: warning: too many arguments for format
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\168' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\202' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\228' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\179' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\246' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\189' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\225' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\185' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\251' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\163' in program
C:\Documents and Settings\QQ\桌面\tt.c:75: error: stray '\169' in program
C:\Documents and Settings\QQ\桌面\tt.c:40: warning: unused variable `a12'
C:\Documents and Settings\QQ\桌面\tt.c:40: warning: unused variable `b12'
C:\Documents and Settings\QQ\桌面\tt.c:77:2: warning: no newline at end of file
编译失败!请检查错误!

输出完成 (耗时: 1 秒)

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-07-29 11:20
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
修改了一下明显的错误,结果是这样的:

---------- GCC C/C++ ----------
正在编译 C 程序:C:\Documents and Settings\QQ\桌面\tt.c ...
C:\Documents and Settings\QQ\桌面\tt.c: In function `fftsf':
C:\Documents and Settings\QQ\桌面\tt.c:6: warning: implicit declaration of function `f11'
C:\Documents and Settings\QQ\桌面\tt.c: At top level:
C:\Documents and Settings\QQ\桌面\tt.c:11: error: redefinition of 'fftsf'
C:\Documents and Settings\QQ\桌面\tt.c:4: error: previous definition of 'fftsf' was here
C:\Documents and Settings\QQ\桌面\tt.c: In function `fftsf':
C:\Documents and Settings\QQ\桌面\tt.c:13: warning: implicit declaration of function `f'
C:\Documents and Settings\QQ\桌面\tt.c: At top level:
C:\Documents and Settings\QQ\桌面\tt.c:18: error: conflicting types for 'f11'
C:\Documents and Settings\QQ\桌面\tt.c:6: error: previous implicit declaration of 'f11' was here
C:\Documents and Settings\QQ\桌面\tt.c: In function `f11':
C:\Documents and Settings\QQ\桌面\tt.c:20: error: invalid lvalue in assignment
C:\Documents and Settings\QQ\桌面\tt.c:22: error: invalid lvalue in assignment
C:\Documents and Settings\QQ\桌面\tt.c:23: error: incompatible types in return
C:\Documents and Settings\QQ\桌面\tt.c:24: error: syntax error before "else"
C:\Documents and Settings\QQ\桌面\tt.c: In function `f12':
C:\Documents and Settings\QQ\桌面\tt.c:31: error: invalid lvalue in assignment
C:\Documents and Settings\QQ\桌面\tt.c:31: error: syntax error before "return"
C:\Documents and Settings\QQ\桌面\tt.c:35:19: 9ffts.c: No such file or directory
C:\Documents and Settings\QQ\桌面\tt.c: At top level:
C:\Documents and Settings\QQ\桌面\tt.c:37: warning: return type defaults to `int'
C:\Documents and Settings\QQ\桌面\tt.c: In function `main':
C:\Documents and Settings\QQ\桌面\tt.c:39: error: `b' undeclared (first use in this function)
C:\Documents and Settings\QQ\桌面\tt.c:39: error: (Each undeclared identifier is reported only once
C:\Documents and Settings\QQ\桌面\tt.c:39: error: for each function it appears in.)
C:\Documents and Settings\QQ\桌面\tt.c:62: warning: implicit declaration of function `ffts'
C:\Documents and Settings\QQ\桌面\tt.c:68: warning: float format, double arg (arg 2)
C:\Documents and Settings\QQ\桌面\tt.c:68: warning: float format, double arg (arg 3)
C:\Documents and Settings\QQ\桌面\tt.c:68: warning: float format, double arg (arg 4)
C:\Documents and Settings\QQ\桌面\tt.c:75: warning: double format, pointer arg (arg 2)
C:\Documents and Settings\QQ\桌面\tt.c:75: warning: too many arguments for format
C:\Documents and Settings\QQ\桌面\tt.c:40: warning: unused variable `a12'
C:\Documents and Settings\QQ\桌面\tt.c:40: warning: unused variable `b12'
编译失败!请检查错误!

输出完成 (耗时: 0 秒)

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-07-29 11:24
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
[bo][un]fxstudenting[/un] 在 2008-7-29 09:27 的发言:[/bo]

这个问题我能帮你解答,去这个两博客其中的一个,把问题写到留言版上,我马上给你解答。
http://dlstudenting.
http://fxstudenting.blog.


强烈鄙视人肉广告机……

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-07-29 11:25
虔诚学C
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2008-5-13
收藏
得分:0 
你这个错误太多了。。语法,逻辑,等等
2008-07-29 11:37
lingluoz
Rank: 2
来 自:苏州科技学院
等 级:新手上路
威 望:4
帖 子:749
专家分:0
注 册:2008-2-2
收藏
得分:0 
先從簡單的程序寫起試試

Murphy's Law :
If there are two or more ways to do something, and one of those ways can result in a catastrophe, then someone will do it.
2008-07-29 11:42
快速回复:大家帮忙看看我的程序啊!急!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013964 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved