I am trying to work with a 2D array its 24 by 2. I am getting a error that says, error C2109: subscript requires array or pointer type in VS2008. I am using 4 files, a global includes which is not important, the programs class header, and the driver/program main files. Here is my code I currently have and since I am a student in this language lets assume that if there is a better way out there I can't do that.
- Class Header Code -
- Diver File -Code:/* #include "global_includes.h" class MeteorLogics { public: MeteorLogics(); void GetTemperatures(int, int); double ComputeAverageTemp(int, int); void DisplayTempratures(int, int, double); void ScreenPause(); private: int Temperaturematrices[24][2]; int NumTempratures; int hourdisplay; double AverageTemp; double HighTemp; double LowTemp; int row; int column; }; */
The empty functions are just there for structure, thats just my style and they are declared already. Thanks for the help guys.Code:/* #include "global_includes.h" #include "meteor_logics.h" //BEGIN -- Class implementation // MeteorLogics::MeteorLogics() { Temperaturematrices[24][2]; AverageTemp = 0; HighTemp = 0; LowTemp = 0; row = 0; column = 0; } void MeteorLogics::GetTemperatures(int Temperaturematrices, int NumTempratures) { while (hourdisplay >= 0 && hourdisplay < 24 && hourdisplay != EOF) { for (hourdisplay = 0; hourdisplay < 24; hourdisplay ++) { cout << "Enter temprature recorded for" << hourdisplay << ":00" << endl; cin >> Temperaturematrices[hourdisplay = 0][NumTempratures = 0]; } cout << "If you are finished with todays entries hold down ctrl and press z on your keyboard" << endl; } } double MeteorLogics::ComputeAverageTemp(int, int) { } void MeteorLogics::DisplayTempratures(int, int, double) { } void MeteorLogics::ScreenPause() { } // //END -- Class implementation */



LinkBack URL
About LinkBacks



