#include <iostream>
using namespace std;
#include "Interface.h"
#include <conio.h>




int main()
{
    apple t;

    bool quit = false;


    while(! quit)
    {
        cout<<"the original value at beginning of clock is\n"<<clock()<<"\n";
        t.start();
        cout<<"hit enter when you want to stop timer\n";
        if(cin.get()=='\n')
        {
            t.end();
            int time =t.elapsed();
            cout<<"the time difference is\n"<<time<<"\n";
            cout<<"enter yes if you want to find out time differences for more times\n";
            if(cin.get()=='y')
            {
                cout<<"from yes";
            }
            else
            {
                cout<<"from no";
                quit=false;
                break;
            }
        }
    }
    return 0;
}

so after you hit yes, it should print out original time and then wait for user to hit enter,then enter loop

It already prompts for enter again. I'm going to guess that the problem is with extra stuff being stuck in the stream when you prompt again. You should clear it out. A good way to do that is to use strings and getline so that there isn't ever any extra stuff. Here's your code with that change, but I removed the timer parts because I don't have your header:

#include <iostream>
#include <string>

using namespace std;

int main()
{
    bool quit = false;
    string line;

    while(! quit)
    {
        cout<<"hit enter when you want to stop timer\n";
        if(getline(cin, line) && line.empty())
        {
            cout<<"enter yes if you want to find out time differences for more times\n";
            if(getline(cin, line) && line == "yes")
            {
                cout<<"from yes\n";
            }
            else
            {
                cout<<"from no\n";
                quit=false;
                break;
            }
        }
    }
    return 0;
}

my problem is when it prompts again. it never goes and asks the user to hit enter. because once they hit enter it stops.

thanks that was really helpful.

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.