I am a 17yr old and I use TurboC++. I've made a airline ticket booking program as part of my first project. Now, what I've decided is that I'll put the flight schedule for all destinations in a .txt file. I'll get the desired destination from the user and then search for the specific flight details pertaining to that particular destination in the file. But I'm entirely clueless on how I can achieve this and need urgent help.
Suppose my file has the following text :
London-NewYork
4 Aug
06:10 : 23:30
London-Paris
4 Aug
05:30 : 07:30
Now, if the user says that he wants to go to Paris, I should be able to search my file for 'Paris' and display the above flight timings accordingly. How do I do this?
I'm not putting my already-2000-line code here as it is irrelevant to the problem I face.
Also, I'm kinda new to C++ (~1 year) and pretty much know only the basics thoroughly. So, if you're putting something in your code that you think might not be known to me, it'll be helpful to explain how it all works..
A quick response will be appreciated as I only have 5 more nights to stay up (and around 20 cups of coffee) to get over with this :)
Exactlyy, but how do I search for a string in the file? Do I check for the characters through a loop, or just compare the string altogether? For the second part again, how do I do that?