void showProgram()
{
cout<<"Welcome to Mission Plan program!"<<endl<<
"1)Input statistical data."<<endl<<
"2)Compute civ. index value (for all records)"<<endl<<
"3)Print top 5 exploration destinations."<<endl<<
"4)Print total travel distance."<<endl;
}
int main()
{
locationData data;
string sunT;
int xCord,yCord,noOfEarthPlanet,noOfEarthMoon;
int choice;
float aveParticulateDensity;
float avePlasmaDensity;
showProgram();
cout<<"Please select your choice :";
cin>>choice;
switch(choice)
{
case 1 : cout<<"Input statistical data"<<endl;
cout<<"Please enter x-cordinate:";
cin>>xCord;
cout<<"Please enter y-cordinate:";
cin>>yCord;
cout<<"Please enter sun type: TYPE:";
cin>>sunT;
data.setSunType(sunT);
//data.getSunType(sunT);
cout<<"Please enter no. of earth-like planets:";
cin>>noOfEarthPlanet;
//data.getNoOfEarthLikePlanets(noOfEarthPlanet);
//data.setNoOfEarthLikePlanets(noOfEarthPlanet);
cout<<"Please enter no. of earth-like moons:";
cin>>noOfEarthMoon;
//data.getNoOfEarthLikeMoon(noOfEarthMoon);
//data.setNoOfEarthLikeMoon(noOfEarthMoon);
cout<<"Please enter ave. particulate density (%-tage):";
cin>>aveParticulateDensity;
// data.setAveParticulateDensity(aveParticulateDensity);
//data.getAveParticulateDensity(aveParticulateDensity);
cout<<"Please enter ave. plasma density (%-tage):";
cin>>avePlasmaDensity;
//data.getAvePlasmaDensity(avePlasmaDensity);
//data.setAvePlasmaDensity(avePlasmaDensity);
cout<<"Record succesfully stored. Going back to main menu."<<endl;
break;
default: cout<<"Invalid choice, please re-enter your choice."<<endl;
}
return 0;
}
may i know what is wrong with the code. I have been trying to debug it for hours.
Edit: i am using an ubuntu developer environment.
Edit: problem has been solved, however i would like to enquire. Why does a locationData.h.gch file appear?
Hi hutch, the problem was because i had another locationData.h.gch in the same directory. I removed it and it worked fine. I have no idea why that file appeared as i had no impression of creating it.
I have seen .gch files being created when I press the compile button while viewing a header file in Geany. Maybe you did something similar with your IDE.
A few compilers do it. It's a precompiled header file that saves on compilation times. Sometimes, libraries are written as huge header files that are included rather than linking them at runtime. So if you include these huge headers, you often recompile them needlessly every time you build.
Some compilers will create these precompiled headers that'll get linked into the build, rather than doing a fresh compile of the header each time.