| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 334 人关注过本帖
标题:【求助】结构体作返回值
取消只看楼主 加入收藏
stevenwu
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2013-12-7
结帖率:90.91%
收藏
已结贴  问题点数:10 回复次数:1 
【求助】结构体作返回值
#include "math.h"
#include "stdio.h"

struct cir_area
{
    float l,s;};
    struct cir_area c_area(float a,float b,float c)
    {
        struct cir_area result;
        result.l=(a+b+c)/2;
        reault.s=sqrt(reault.l*(result.l-a)*(result.l-b)*(result.l-c));
        return result;
    }
    void main()
    {
        float a,b,c;
        struct cir_aera triangle;
        printf("输入三角形的3条边长: \n");
        scanf("%f,%f,%f",&a,&b,&c);

        triangle=c_area(a,b,c);
        printf("半周长是: %f\n面积是: %f\n",triangle.l,triangle.s);
    }

哪里错了,运行不了,书上例题,照打的
错误信息------Configuration: 23 - Win32 Debug--------------------
Compiling...
23.cpp
C:\Program Files\Microsoft Visual Studio\23\23.cpp(14) : error C2065: 'reault' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\23\23.cpp(14) : error C2228: left of '.s' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\23\23.cpp(14) : error C2228: left of '.l' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\23\23.cpp(20) : error C2079: 'triangle' uses undefined struct 'cir_aera'
C:\Program Files\Microsoft Visual Studio\23\23.cpp(24) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'struct cir_area' (or there is no acceptable conversion)
C:\Program Files\Microsoft Visual Studio\23\23.cpp(25) : error C2228: left of '.l' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\23\23.cpp(25) : error C2228: left of '.s' must have class/struct/union type
执行 cl.exe 时出错.

23.exe - 1 error(s), 0 warning(s)
搜索更多相关主题的帖子: triangle include return result 结构体 
2013-12-16 19:09
stevenwu
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2013-12-7
收藏
得分:0 
回复 2楼 韶志
还真没看到。。谢谢
2013-12-16 20:32
快速回复:【求助】结构体作返回值
数据加载中...
 
   



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

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