I have the following Timer.cpp, Timer.h, and main.cpp files. I am trying to call functions from the Timer.cpp file in my main.cpp file and have included the Timer.h in the main, but it is still not working. Can someone please explain why? I am a little rusty with C++ and feel like I am making a silly mistake. Thanks in advance for any help.
#Timer.h file
#ifndef __Notes__Timer__
#define __Notes__Timer__
#include <iostream>
class Timer {
public:
Timer();
void start();
void stop();
void clear();
float getDelta();
};
#endif
#Timer.cpp file
#include "Timer.h"
clock_t startTime;
clock_t stopTime;
Timer::Timer(){
startTime = 0;
stopTime = 0;
}//Timer
void start(){
startTime = clock();
}//start
void stop(){
stopTime = clock();
}//stop
float getDelta(){
return stopTime-startTime;
}//getDelta
#main.cpp file
#include "Timer.h"
#include <iostream>
using namespace std;
int main(){
char quit;
start();
cout << "Would you like to quit? Y or N: ";
cin >> quit;
if (quit != 'Y' || quit != 'y'){
while (quit != 'Y' || quit != 'y'){
cout << "Would you like to quit? Y or N: ";
cin >> quit;
}//while
}//if
else {
stop();
cout << getDelta();
exit(0);
}//else
}//main