This is a weather report from the year of 2012 to 2015. The part that i just post is merely 1% of the data in the notepad.
My task is to make my program be able to read the file. then user can prompt in for monthly stats, total rainfall, average min/max temp, etc..
I know how to make a code to read .txt file. But i dont know how to put it in an array. so i can read each data one by one.
write the data to the file in the form of a class and ofile.write((char *)&obj,sizeof(obj)) and then u can use a while loop to check for the data asked by reasding from fole using ifile.read((char *)&obj,sizeof(obj)) and using strcmpi i think
Please post a the sample input inside code tags so that the formatting is preserved.
Are there any spaces in the "text" field? Are the fields separated by space or by some other character, '\t' for example? Are the records on their own lines?
Have you considered using a structure or class to hold this information?
else if(option==3)
cout << "Please enter the date like this ==> eg: 210112(21st January 2012)\nEnter Date :";
cin >> date;
/* LINE 81-86 IS FOR ENCOUNTERING CHARACTER */
while(cin.fail())
{
cin.clear();
cin.ignore(100000, '\n');
cout << "Please enter the date like this ==> eg: 210112(21st January 2012)\nEnter Date :";
cin >> date;
}
Since this program won't compile, my first suggestion is that you fix the compile errors and warnings then repost the modified code and ask specific questions about that modified code.