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.

Recommended Answers

All 3 Replies

I suspect you're simply being overwhelmed by the requirements. It helps to break things down into manageable pieces. For example, you can start by writing code that only reads the file and prints it out. Then that code can be modified to extract individual fields. After extracting the fields, you can start crunching numbers to get the desired output.

This is a simple iterative process that adds to a working foundation at every step. The two benefits are you're never overwhelmed by too many features, and you're never too far from working code at any given time. The two biggest problems beginners have is not knowing where to start and writing too much code without testing it. This process solves both problems.

"Then that code can be modified to extract individual fields."
Can you give some pointers on how to do this.I made the first part.Thank you.

"Then that code can be modified to extract individual fields."
Can you give some pointers on how to do this.I made the first part.Thank you.

How about strtok()?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.