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.

also i have a problem with my project, i need to get some info from a xml file and compare and print out few things.
everything is working fine, but the smallest countries area is 315,6 and every other area is a normal number like 12345 or something like that.
my problem is that that i can't get the 0,6 out from the xml, only the 315(i actually need 315+0,6)
what should i do?
should i just find the coma and then add the value after the coma or something else, but i have no idea how to put this into c++
i added my code and the xml file

i 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 time to the other and then convert back into hours and minutes.

2) Do routine math using base 60.

>> 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)
               {
               tocont = 0;
               break;
               }
           
 
         }
     }

inline int pmin(int h, int m){return (h*60 + m); }
is that the conversion i should use to convert hours to minutes?

>> 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)
               {
               tocont = 0;
               break;
               }
 
 
         }
     }

i really don't get it? do i have to declare docont as an intiger?:confused:

Yes , you might declare tocont as integer or even
as char.

but where do i put it in my code - after, between or before the for statment that makes my program print?

If 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.

If 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.

but i don't understand the language, that is my big problem :sad: if did understand the code i wouldn't be her and asking but helping others...
please don't make me feel even more miserable then i allready am

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.