pleaseeee help me what is my mistake

Tell me what is wrong please I have got headache with it already i cant fix problem help please

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  #include <iostream>
using namespace std;
int i,h,m,s,ms;
main () {
for (i=0, i<=1000, i++) {
         if(ms>9)
          {
            ms=0;
            ss++;
            }
         else if(ss>59)
          {
            ss=0;
            mm++;
            }
         else if(mm>59)
          {
            mm=0;
            hh++;
            }
         cout<<hh<<":"<<mm<<":"<<ss<<":"<<ms;
         }
         }

Please tell us more about what the problem is. What is the program doing wrong? What would you like for it to do instead? Can you tell us what your complete program is supposed to do?
Please follow the guidelines located here when asking for help:
http://www.cplusplus.com/forum/beginner/1/

I noticed on line 5 your for loop has commas instead of semicolons.
I also noticed that ms, ss, and mm variables do not have any number value assigned to them before the if-else if-else if statement begins.

Edit: Also I hope you do not plan to use this as an actual clock. If you would like to know more about time in c++, you might check out the ctime library:
http://www.cplusplus.com/reference/ctime/time/
Last edited on
thank you very much :) it worked
Edit: No, in fact i need it for my homework in arduino. creating stopwatch using monitor. but i dont have own arduino and decided to use c++ for it.
Last edited on
Topic archived. No new replies allowed.