Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/135.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ “错误”;在'之前应为初始值设定项;使用'&引用;c++;_C++ - Fatal编程技术网

C++ “错误”;在'之前应为初始值设定项;使用'&引用;c++;

C++ “错误”;在'之前应为初始值设定项;使用'&引用;c++;,c++,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()) {

我在这里是新来的,在编程方面也是新来的。 当我尝试运行此代码时:

#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;
}
#包括
#包括
#包括“main.h”
使用名称空间std;
int main()
{
短arr_尺寸()
浮子温度;
点_arr[99];
ifstream my_文件(“points.txt”);
而(!my_file.eof())
{
我的文件>>温度;
点阵列[阵列大小]。设置x(温度);
我的文件>>温度;
点阵列[阵列大小]。设置y(温度);
arr_size++;
}
arr_大小--;
my_file.close();
ex_point(点阵列、阵列大小);
库特

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
const void ex_point(point[],float)