2014-02-24 39 views
1

即時新在這裏,並在一般proggraming新。 whem我嘗試運行此代碼:‘使用’「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()) 
{ 
    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」? 這是「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

錯誤太多。在各個地方以及其他地方缺少';'。 – juanchopanza

回答

8
const void ex_point(point[],float) 

main.h末端缺少分號。

+0

它救了我。只是同樣的愚蠢的問題! –

相關問題