错误“使用''c ++之前的预期初始化程序

时间:2014-02-24 19:58:14

标签: c++

我是新来的,并且在一般的程序上是新的。 我试图运行这段代码:

#include<fstream>
#include <iostream>
#include "main.h"
using namespace std;
int main()
{
 short arr_size ()
float temp;
point point_arr[99];
ifstream my_file   ("points.txt");
while(!my_file.eof())
{
    my_file>>temp ;
    point_arr[arr_size].set_x(temp);
    my_file>>temp ;
    point_arr[arr_size].set_y(temp);
    arr_size++;
}
arr_size--;
my_file.close();
ex_point(point_array,arr_size);
cout<<"the middle point is:("<<mid_p(point_array,arr_size).get_x()<<","<<mid_p(point_array,arr_size).get_y()<<")\n";
return 0;
}

我收到此错误:“错误”预期初始化程序在'使用'之前“c ++” 这是我第一次收到这个错误。 “main.h”可能有些不对劲? 这是“main.h”:

    #ifndef MAIN_H_INCLUDED
#define MAIN_H_INCLUDED
#include<iostream>
class point
{
    float x ,y ;
public :
    point(float a,float b){x=a;y=b;}
    point(){};
    void set_x(float a){x=a;};
    void set_y(float b){x=b;};
    const float get_x(){return x; };
    const float get_y(){return y; };
    const void show();
    const float pitagoras();
};
const point mid_p(point[],float);
const void ex_point(point[],float)



#endif // MAIN_H_INCLUDED
谢谢你! 象牙

1 个答案:

答案 0 :(得分:12)

const void ex_point(point[],float)
main.h末尾的

缺少分号。