标题:求助 c语言结构体赋值 编译报错 syntax error : '{'
只看楼主
zhht87
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2013-8-7
结帖率:57.14%
 问题点数:0 回复次数:5 
求助 c语言结构体赋值 编译报错 syntax error : '{'
如题, 结构体赋值的程序如下,编译的时候提示对con[24]赋值的句子出错  syntax error : '{'   求大神帮助修改
int main()
{
struct convert
 {double C[3][3];};
 struct convert con[24]={{1,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0},{0.0,0.0,-1.0,0.0,-1.0,0.0,-1.0,0.0,0.0},{0.0,0.0,-1.0,0.0,1.0,0.0,1.0,0.0,0.0},{-1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,-1.0},{0.0,0.0,1.0,0.0,1.0,0.0,-1.0,0.0,0.0},{1.0,0.0,0.0,0.0,0.0,-1.0,0.0,1.0,0.0}{1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,-1.0}{1.0,0.0,0.0,0.0,0.0,1.0,0.0,-1.0,0.0},{0.0,-1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0},{-1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,1.0},{0.0,1.0,0.0,-1.0,0.0,0.0,0.0,0.0,1.0},{0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0},{0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0},{0.0,0.0,-1.0,-1.0,0.0,0.0,0.0,1.0,0.0},{0.0,-1.0,0.0,0.0,0.0,1.0,-1.0,0.0,0.0},{0.0,1.0,0.0,0.0,0.0,-1.0,-1.0,0.0,0.0},{0.0,0.0,-1.0,1.0,0.0,0.0,0.0,-1.0,0.0},{0.0,0.0,1.0,-1.0,0.0,0.0,0.0,-1.0,0.0},{0.0,-1.0,0.0,0.0,0.0,-1.0,1.0,0.0,0.0},{0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,-1.0},{-1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0},{0.0,0.0,1.0,0.0,-1.0,0.0,1.0,0.0,0.0},{0.0,-1.0,0.0,-1.0,0.0,0.0,0.0,0.0,-1.0},{-1.0,0.0,0.0,0.0,0.0,-1.0,0.0,-1.0,0.0}};
return 0;
}
搜索更多相关主题的帖子: convert double 结构体 c语言 
2013-08-07 18:04
liufashuai
Rank: 9Rank: 9Rank: 9
来 自:冥界-魔域-魂殿
等 级:蜘蛛侠
威 望:1
帖 子:370
专家分:1374
注 册:2012-6-22
得分:0 
我靠,搂猪,你丫的真人才啊,我佩服死你了,你竟然这样害我
我还竟然真的把这扯淡的问题给解决了。

你丫的真淫才!!!!
程序代码:


int main()
{
    struct convert
    {
        double C[3][3];
    };

    struct convert con[24]=
    {
        {1,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0},
        {0.0,0.0,-1.0,0.0,-1.0,0.0,-1.0,0.0,0.0},
        {0.0,0.0,-1.0,0.0,1.0,0.0,1.0,0.0,0.0},
        {-1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,-1.0},
        {0.0,0.0,1.0,0.0,1.0,0.0,-1.0,0.0,0.0},
        {1.0,0.0,0.0,0.0,0.0,-1.0,0.0,1.0,0.0},
        {1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,-1.0},
        {1.0,0.0,0.0,0.0,0.0,1.0,0.0,-1.0,0.0},
        {0.0,-1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0},
        {-1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,1.0},
        {0.0,1.0,0.0,-1.0,0.0,0.0,0.0,0.0,1.0},
        {0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0},
        {0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0},
        {0.0,0.0,-1.0,-1.0,0.0,0.0,0.0,1.0,0.0},
        {0.0,-1.0,0.0,0.0,0.0,1.0,-1.0,0.0,0.0},
        {0.0,1.0,0.0,0.0,0.0,-1.0,-1.0,0.0,0.0},
        {0.0,0.0,-1.0,1.0,0.0,0.0,0.0,-1.0,0.0},
        {0.0,0.0,1.0,-1.0,0.0,0.0,0.0,-1.0,0.0},
        {0.0,-1.0,0.0,0.0,0.0,-1.0,1.0,0.0,0.0},
        {0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,-1.0},
        {-1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0},
        {0.0,0.0,1.0,0.0,-1.0,0.0,1.0,0.0,0.0},
        {0.0,-1.0,0.0,-1.0,0.0,0.0,0.0,0.0,-1.0},
        {-1.0,0.0,0.0,0.0,0.0,-1.0,0.0,-1.0,0.0},
    };
return 0;
} 


 

有一种落差是,你配不上自己的野心,也辜负了所受的苦难。






2013-08-07 18:24
zhht87
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2013-8-7
得分:0 
回复 2楼 liufashuai
果然通过了,是最后一个元素少了逗号吗?
2013-08-07 18:28
liufashuai
Rank: 9Rank: 9Rank: 9
来 自:冥界-魔域-魂殿
等 级:蜘蛛侠
威 望:1
帖 子:370
专家分:1374
注 册:2012-6-22
得分:0 
回复 3楼 zhht87
少的不止一个!

有一种落差是,你配不上自己的野心,也辜负了所受的苦难。






2013-08-07 18:30
zhht87
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2013-8-7
得分:0 
回复 4楼 liufashuai
好吧 还在初学阶段 多谢!
2013-08-07 18:34
jg658237
Rank: 7Rank: 7Rank: 7
来 自:青藏高原
等 级:黑侠
帖 子:224
专家分:529
注 册:2013-8-8
得分:0 
main(void)
{
    struct convert
    {
        double C[3][3];
    };

    struct convert con[24]=
    {
        {1,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0},
        {0.0,0.0,-1.0,0.0,-1.0,0.0,-1.0,0.0,0.0},
        {0.0,0.0,-1.0,0.0,1.0,0.0,1.0,0.0,0.0},
        {-1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,-1.0},
        {0.0,0.0,1.0,0.0,1.0,0.0,-1.0,0.0,0.0},
        {1.0,0.0,0.0,0.0,0.0,-1.0,0.0,1.0,0.0},
        {1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,-1.0},
        {1.0,0.0,0.0,0.0,0.0,1.0,0.0,-1.0,0.0},
        {0.0,-1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0},
        {-1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,1.0},
        {0.0,1.0,0.0,-1.0,0.0,0.0,0.0,0.0,1.0},
        {0.0,0.0,1.0,1.0,0.0,0.0,0.0,1.0,0.0},
        {0.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0},
        {0.0,0.0,-1.0,-1.0,0.0,0.0,0.0,1.0,0.0},
        {0.0,-1.0,0.0,0.0,0.0,1.0,-1.0,0.0,0.0},
        {0.0,1.0,0.0,0.0,0.0,-1.0,-1.0,0.0,0.0},
        {0.0,0.0,-1.0,1.0,0.0,0.0,0.0,-1.0,0.0},
        {0.0,0.0,1.0,-1.0,0.0,0.0,0.0,-1.0,0.0},
        {0.0,-1.0,0.0,0.0,0.0,-1.0,1.0,0.0,0.0},
        {0.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,-1.0},
        {-1.0,0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0},
        {0.0,0.0,1.0,0.0,-1.0,0.0,1.0,0.0,0.0},
        {0.0,-1.0,0.0,-1.0,0.0,0.0,0.0,0.0,-1.0},
        {-1.0,0.0,0.0,0.0,0.0,-1.0,0.0,-1.0,0.0},
    };
return 0;
}


  最好少了一个逗号。而且最上面也修改一下

武功再高也怕菜刀.
2013-08-08 20:07



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-418759-1-1.html




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

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