Ask your own question, for FREE!
Engineering 7 Online
OpenStudy (anonymous):

reading and writeing from a file

OpenStudy (anonymous):

OpenStudy (anonymous):

int year,month,day,hour,minute,second; ifstream fin; fin . open("time.txt",ios::in); if (fin == NULL){ cout << "file can not be opened\n"; exit(0); } while (!fin.eof()) { fin >> year,month,day,hour,minute,second; cout << year << " / "; if (month < 10) cout << "0"; else cout << ""; cout << month << " / "; if (day < 10) cout << "0"; else cout << ""; cout << day << "\n"; cout << hour << ":"; if (minute < 10) cout << "0"; else cout << ""; cout << minute << ":"; if (second < 10) cout << "0"; else cout << ""; cout << second; if (hour < 12) cout << " AM" << endl; else cout << " PM" << endl; } fin.close();

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!