Here are my 3 files

interface file

#ifndef INTERFACE_H_INCLUDED
#define INTERFACE_H_INCLUDED
#include <time.h>
class timer
{
    public:
    void start();
    void end();
    int elapsed();
    int subtract();
    int add();
    int output(unsigned int seconds);
    private:
    bool running;
    int begin;
    int finish;
};
#endif // INTERFACE_H_INCLUDED



implementation file
using namespace std;
#include "Interface.h"
#include <time.h>


timer::timer()
{
    running=false;
    begin=0;
}
void timer::start()
{
    if(! running)
    {
        begin=(unsigned int) clock();
        running=true;
    }
}

void timer::end()
{
    if(running)
    {
        finish=(unsigned int) clock();
        running=false;
    }
}

int timer::elapsed()
{
    if(running)
    {
        return((unsigned int) clock()-begin);
    }
    else
    {
        return finish-begin;
    }
}

int timer::output(unsigned int seconds)
{
    return seconds >= elapsed();
}


Test file
#include <iostream>
using namespace std;
#include "Interface.h"
#include <conio.h>
class Test
{
int main()
{
    bool quit = false;
    char choice;

    choice=getch();
    timer t;
    while(! quit)
    {
        t.start();
        t.end();
        cout<<"the time is"<<t.output();
    }
}
}



ERROR::::::No matching call for function 'timer::output()

1. You need to Post like this:

#ifndef INTERFACE_H_INCLUDED
#define INTERFACE_H_INCLUDED
#include <time.h>
class timer
{
    public:
    void start();
    void end();
    int elapsed();
    int subtract();
    int add();
    int output(unsigned int seconds);
    private:
    bool running;
    int begin;
    int finish;
};
#endif // INTERFACE_H_INCLUDED



implementation file
using namespace std;
#include "Interface.h"
#include <time.h>


timer::timer()
{
    running=false;
    begin=0;
}
void timer::start()
{
    if(! running)
    {
        begin=(unsigned int) clock();
        running=true;
    }
}

void timer::end()
{
    if(running)
    {
        finish=(unsigned int) clock();
        running=false;
    }
}

int timer::elapsed()
{
    if(running)
    {
        return((unsigned int) clock()-begin);
    }
    else
    {
        return finish-begin;
    }
}

int timer::output(unsigned int seconds)
{
    return seconds >= elapsed();
}


Test file
#include <iostream>
using namespace std;
#include "Interface.h"
#include <conio.h>
class Test
{
int main()
{
    bool quit = false;
	char choice;

    choice=getch();
	timer t;
	while(! quit)
	{
        t.start();
        t.end();
        cout<<"the time is"<<t.output();
	}
}
}

2. The problem is at line 12...you use int output(unsigned int seconds); , but later in your program you're using that function without the unsigned int parameter

Line 87 should have a parameter that is unsigned int

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.