| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 669 人关注过本帖, 1 人收藏
标题:c错误cpp(9) : error C2064: term does not evaluate to a function
只看楼主 加入收藏
lilicup
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2011-12-21
结帖率:100%
收藏(1)
已结贴  问题点数:10 回复次数:2 
c错误cpp(9) : error C2064: term does not evaluate to a function
#include<stdio.h>
main()
{
 int n;float x1,x2,y1,y2,max;
 printf("please input two points:");
 scanf("%f,%f %f,%f",&x1,&y1,&x2,&y2);
 printf("please input the coordinate:");
 scanf("%d",&n);
 max=max(x2,y1,y2);

 
 putchar('^');
 putchar('\n');
 for(int i=1;i<=n-1;i++)
 {
 putchar('+');
 for(int j=1;j<=n-1;j++)
     putchar(' ');
     putchar('\n');
 }
 for(int a=1;a<=n;a++)
 {putchar('+');putchar(' ');}
 putchar('>');
 return(0);
 }
float max(float a, float b, float c)
{float z,x;
z=a>b?a:b;
x=z>c?z:c;
return(x);
}
搜索更多相关主题的帖子: max function include 
2012-11-08 16:01
星闪夜空
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:50
专家分:119
注 册:2012-9-15
收藏
得分:10 
回复 楼主 lilicup
  
  首先,你用的是C++的语法,记住C语言的语法应该将变量先定义后使用,所以最好不要有for(int i;i<n;i++)这种形式。
 
  其次,你应该函数使用前定义函数原型。
  
  如下是我给你改的源码:

#include<stdio.h>

float max(float a, float b, float c);

main()
{
    int n,i,j,a;
    float x1,x2,y1,y2,maxnum;
    printf("please input two points:");
    scanf("%f,%f %f,%f",&x1,&y1,&x2,&y2);
    printf("please input the coordinate:");
    scanf("%d",&n);
    maxnum=max(x2,y1,y2);
   
   
    putchar('^');
    putchar('\n');
    for(i=1;i<=n-1;i++)
    {
        putchar('+');
        for(j=1;j<=n-1;j++)
            putchar(' ');
        putchar('\n');
    }
    for(a=1;a<=n;a++)
    {putchar('+');putchar(' ');}
    putchar('>');
    return(0);
}

float max(float a, float b, float c)
{float z,x;
z=a>b?a:b;
x=z>c?z:c;
return(x);
}
2012-11-08 18:05
lilicup
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2011-12-21
收藏
得分:0 
回复 2楼 星闪夜空
谢谢
2012-11-09 11:17
快速回复:c错误cpp(9) : error C2064: term does not evaluate to a function
数据加载中...
 
   



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

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