Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] Timer + source code (good for beginners like me)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Travis13
Expert Cheater
Reputation: 0

Joined: 17 Feb 2007
Posts: 199

PostPosted: Mon Dec 01, 2008 2:23 am    Post subject: [C++] Timer + source code (good for beginners like me) Reply with quote

Hey guys, i jsut made a little program and I'm proud of it Smile
I had the timer part done for a while but I put more user control into it by asking for the delay and everything. hope it helps someone.

Code:
#include <iostream>
#include <windows.h>
using namespace std;

bool Exit = false;
bool repeatseconds = false;
bool repeatminutes = false;
bool repeathours = false;
int hours = 0;
int seconds = 0;
int delay;
   
void timerseconds()
{

   

    while(repeatseconds == false)
    {
    seconds ++;
    Sleep(delay * 1000); // change the delay higher or lower to test out the minutes and hours wihtout having to wait a long time
    cout << "The # of seconds is:               " << seconds << endl;
    if(GetAsyncKeyState(VK_F2))
    {
    int minutes = seconds / 60;
    int hhours = minutes / 60;
    int mmodulus = minutes % 60;
    int smodulus = seconds % 60;
   
    repeatseconds = true;
   
    cout << "\n\nTime counted up to: " << hhours << " hour(s) " << mmodulus << " minute(s) and " << smodulus << " second(s)." << endl;
    }
}
}

int main()
{
    SetConsoleTitle("                         ~*~*~*~*~*~*~*~*~*~*~ C++ TIMER ~*~*~*~*~*~*~*~*~*~*~");
    cout << "Welcome to a c++ timer made by Travis13 of cef." << endl << endl << endl;
    cout << "Please enter the delay (in seconds) you want between each number." << endl << endl;
   cin >> delay;
   cout << "\n";
   cout << "F1 = start" << endl;
    cout << "F2 = stop" << endl;
    cout << "F3 = EXIT" << endl;
    cout << "\n" << endl;
   
while (Exit == false)
    {
    if(GetAsyncKeyState(VK_F1))
    {
    timerseconds();                           
    }
    else if(GetAsyncKeyState(VK_F3))
    {
    Exit = true;
    }
}
return 0;
}


So ya play with the hotkeys do w/e u want, but TRY TO LEARN OFF OF IT.

edit: no one likes it?

_________________
Learning C++, trying, failing, never gonna give up tho Razz
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites