display undeclared

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
# include <stdio.h>
#include <conio.h>
# include <windows.h>
using namespace std;
int main ()
{


int sec = 0;
int min = 0;
int hour = 0;

    int a; 
while(1)
{
   Sleep(1000); 
   ++sec;
    if(sec == 60)
    {
      sec = 0;
      ++min;
       if(min == 60)
       {
           min = 0;
          ++hour;
          if(hour == 24)
          {
             hour = 0;
          }
       }
    }
   display(hour,min,sec);
}

scanf ("%d%",&a);

return 0;
}

this is the code for showing hour,min n sec ...but it gives and error as "display is undeclared"
Because the display(int,int,int) function is not defined.
He means you should add this to the beginning of your program:
short display(int, int, int);

and add this to the end of your program:
short display(int a, b, c)
{
cout << a << " " << b << " " << c << endl;
return 0;
}

To get it to 'tick' look into the getconsolecursorposition functions declared in windows.h and also setconsolecursorposition.
Topic archived. No new replies allowed.