QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2489|回复: 3

有谁好心来帮帮我看看我的程序到底那里错了呀!!

[复制链接]
发表于 2006-7-12 18:46:26 | 显示全部楼层 |阅读模式
# include  <iostream.h>
# include  <iomanip.h>

  void pr_scores(float scores[ ]);                                                                        
  void  calr_average(float, float scores,char s_name[ ]);        
int  main ( )

{
     char  s_name[ ] ="Tri star University";
     float scores[6] = {54.6,48.6, 36.6,66.6,72.6, 78.6};
     float average =0.0;
                                                                    // call all function to print array.

    pr_scores(scores);
   void  calr_average(float,scores, s_name);        
   return0;
   }

                                                                  
      void pr_scores (float scores[6])

     {
   
      int ctr ;
     cout << "Here are your scores: ";
     for (ctr=0;ctr<6; ctr++)
           
          cout << setprecision(2) << scores[ctr] <<"\n";
  
    return;
      }
                             

     void calr_average(float acerage, float scores[6], char s_name[ ]);           
{

            int ctr;
      //  float * scores=scores;
      //  char * s_name = s_name;  (要了这2个和没有这2个好像都一样亚)
           for (ctr=0;ctr< 6;ctr++)
                        {
                            average += scores[ctr];
                         }
                    
         
           average /= float(6);
   
             cout << "At" <<s_name<<", your class average is "<< setprecision(2) << average ;

           return;
      }
 楼主| 发表于 2006-7-12 18:48:29 | 显示全部楼层
我编译的时候的错误提示为:

In file included from /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../../include/c++/3.4.3/backward/iostream.h:31,
                 from c++test.cpp:1:
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../../include/c++/3.4.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecatedheader <iostream.h>. To disable this warning use -Wno-deprecated.
c++test.cpp:5: error: stray '\129' in program
c++test.cpp:5: error: expected unqualified-id before numeric constant
c++test.cpp:5: error: expected `,' or `;' before numeric constant
c++test.cpp:5: error: stray '\132' in program
c++test.cpp:5: error: stray '\129' in program
c++test.cpp:5: error: stray '\132' in program
c++test.cpp:5:40: invalid suffix "scores" on integer constant
c++test.cpp:5: error: stray '\129' in program
c++test.cpp:5: error: stray '\132' in program
c++test.cpp:5: error: expected unqualified-id before numeric constant
c++test.cpp:5: error: expected `,' or `;' before numeric constant
c++test.cpp:5: error: stray '\129' in program
c++test.cpp:5: error: stray '\132' in program
c++test.cpp:15: error: stray '\129' in program
c++test.cpp:15: error: stray '\132' in program
c++test.cpp:15: error: stray '\129' in program
c++test.cpp:15: error: stray '\132' in program
c++test.cpp:35: error: expected unqualified-id before '{' token
c++test.cpp:35: error: expected `,' or `;' before '{' token
回复

使用道具 举报

 楼主| 发表于 2006-7-12 19:45:36 | 显示全部楼层
我 等待的人在那里?
回复

使用道具 举报

发表于 2006-7-12 20:25:19 | 显示全部楼层
void calr_average(float, float scores,char s_name[ ]);

这样也可以?第一个参数没写名字之后的又都写了名字?

另外你要用[code:1]和[/code:1]把代码包起来这样显示时才会有缩进
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-11-2 12:29 , Processed in 0.051760 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表