homework(original function names in () )
i have done most of the job allready, but i can't seem to make it do exactelly what the program should.
My job is to make a program that asks numbers of busses(10,27,33,36) and the departure(valjus) times and save them into a txt document and then how many minutes has passed from the last departure(valjus) of the same buss. and also the program should check that the time(minutes and hours) are in the normal range from 0-24 h and 0-60 minutes and also it should check that the buss number entered is exacetelly the same number as given in the program.
It currently makes a txt document and saves the times, but i can't make the program calculate the time between(vahe) the departure(valjus) of the same number buss, it just doesn't do that. also, when i close the program window and start inserting the times and numbers again, it for some reason prints out the wrong time, but the new inserted buss number. my program doesn't brake, when '0' is entered as the buss number . i don't know what i'm doing wrong...
can you help me.
i have added my homework as well.
Recommended Answers
Jump to Posti can't make the program calculate the time between(vahe) the departure(valjus) of the same number buss
No compiler available so I can't download cpp files. In general there are several ways to approach this:
1) you can transform hours and minutes to seconds, subtract the number of seconds from one …
Jump to Post>> my program doesn't brake, when '0' is entered as the buss number
Because you break from the for loop, but not from the
while loop.
I suggest a flag like "tocont"tocont = 1; while ( tocont ) { for(int i=0;i<4;i++) { if(nr==0) { …
Jump to PostIf you understand the language you're using, then you should have no problem running through the code by hand or in your head to see what happens, given some particular program. So do that.
All 9 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.