请大家帮我看看我这个程序,错误时missing function header,这个程序是要求计算两个时间之间相差的秒数。

[复制链接]
查看11 | 回复2 | 2011-5-27 12:23:48 | 显示全部楼层 |阅读模式
//thisfilewillcalculatethehourminutesecondtellreaderhowmuchsecondsbetweenthem.
#includeiostream
#includestring
#includecmath
usingnamespacestd;

intmain();
{
doubletimetotime(doubleh1,m1,s1,h2,m2,s2);
doubleh1,m1,s1,h2,m2,s2,T;

        cout\"Programsecondscalculatesthenumberofsecondsbetweentwotimes:\"endl;
cout\"Pleaseenteratime(hoursminutesseconds):\"endl;
cinh1m1s1;
cout\"Pleaseenteratime(hoursminutesseconds):\"endl;
cinh2m2s2;
        if(0h124,0h224,0m160,0m2m2,0s160,0s2s2)
        {
                if(h1=h2)
                {
                        T=h2*60*60m2*60s2-(h1*60*60m1*60s1);

                        if(T=1)
                        {
                                cout\"Between\"h1\":\"m1\":\"s1\"and\"h2\":\"m2\":\"s2\"thereis\"T\"second.\"endl;
                        }
                        else
                        {
                        cout\"Between\"h1\":\"m1\":\"s1\"and\"h2\":\"m2\":\"s2\"thereis\"T\"seconds.\"endl;
                        }
                }
                else
                {
                T=h1*60*60m1*60s1-(h2*60*60m2*60s2);

                        if(T=1)
                        {
                                cout\"Between\"h1\":\"m1\":\"s1\"and\"h2\":\"m2\":\"s2\"thereis\"T\"second.\"endl;
                        }
                        else
                        {
                        cout\"Between\"h1\":\"m1\":\"s1\"and\"h2\":\"m2\":\"s2\"thereis\"T\"seconds.\"endl;
                        }
                }
        }
        elseif(h1=24||h10||h1=24||h10)
        {
                cout\"Hoursmustbetween0to23!\"endl;
        }
elseif(m1=60||m10||m1=60||m10)
        {
                cout\"Minutesmustbetween0to60!\"endl;
        }
        elseif(s1=60||s10||s1=60||s10)
        {
                cout\"Secondsmustbetween0to60!\"endl;
        }
        else
        {
                cout\"Can\'tfindthetime!\"endl;
        }
        return0;
}
C:\\C\\HOMEWORK.CPP(420):errorC2447:missingfunctionheader(old-styleformallist?)
回复

使用道具 举报

千问 | 2011-5-27 12:23:48 | 显示全部楼层
好吧,失误,谢了,可是去掉分号之后还是有错误,一个错误六个警告,帮我看看,谢啦~
C:\\C\\HOMEWORK.CPP(422):errorC2061:syntaxerror:identifier\'m1\'
C:\\C\\HOMEWORK.CPP(430):warningC4804:\'\':unsafeuseoftype\'bool\'inoperation
剩下的五个警告跟第一个一样,字数不够了,不好意思啊~
回复

使用道具 举报

千问 | 2011-5-27 12:23:48 | 显示全部楼层
doubletimetotime(doubleh1,doublem1,doubles1,doubleh2,doublem2,doubles2);

这里的引号最好改成用h124,0h224,0m160,0m2m2,0s160,0s2s2)
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行