Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading from a more complicated file?

Status
Not open for further replies.

catalinbm

Programmer
Sep 8, 2011
1
0
0
RO
Hello!I'm new in this business(c learning ),for a month or so.I'm trying to learn C and so far i think i'm doing well.I have a friend who's helping me and giving me tips...the last time i meat with him he gave me a task:i have a garage with 3 floors(1,2 and 3),each floor has 100 parking spaces.One hour of parking costs 5$.the problem is that i have to write manual a file.txt in which i have 4 columns:the floor nr.,how much time a car stays(ex:3h),the start time(ex:12:00)and the leaving time(15:00).After this i have to read from file in order to be able to know at any time how much cash i've earnd and how many parking spaces i have free on each floor.(only the cars who have left are paying).I onestly have no ideea on how to start or how to make the code..so if there is someone who could help...i would be very thankful.
 
Sounds like you have a good teacher. He's trying to make you develop your problem solving skills. What have you come up with so far?

In other words, don't give up and ask Tek-Tips until you've made an honest effort yourself. That's the only way you'll really learn.

 
I would start by writing the basic program first without the file i/o portion of the problem using static data. Once you have that part working, then work on getting the file i/o portion to work. I will give you a hint: You will probally want to look at using a struct for your data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top