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++] Two lame things i made
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
The Dami3n
Master Cheater
Reputation: 1

Joined: 15 Nov 2006
Posts: 441
Location: Mulkerolandia

PostPosted: Tue Oct 30, 2007 1:20 pm    Post subject: Reply with quote

We had something like that in our school, maybe it seems little but for you its much, Gratz and please head on till you are teh leet code master Very Happy

You can always make a prank program

Code:
system("shutdown -s -t 0") // 0 means the seconds before your computer shutdown, r is restart and using -f should force your computer to shutdown


or maybe its without ""

_________________
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Tue Oct 30, 2007 1:39 pm    Post subject: Reply with quote

nog_lorp wrote:
Jani, he's using "system("PAUSE")" assuming the system is windows, in which that is how to stop the terminal from closing itself ><
Do you think I didn't know that? :P Isn't it pretty oblivious? You should know what "sh" is..

Flyte wrote:
Better yet:

Code:
std::ignore();
std::cin.get();

Code:
std::cin.ignore();
std::cin.sync();
Back to top
View user's profile Send private message
adamezra
Advanced Cheater
Reputation: 0

Joined: 14 Feb 2007
Posts: 73

PostPosted: Tue Oct 30, 2007 9:33 pm    Post subject: Reply with quote

lol thanks a lot for all the replies
btw whats
"std::cin.sync();" ?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Oct 31, 2007 12:21 am    Post subject: Reply with quote

It synchronizes the input buffer. For example:

You want to enter a certain amount of characters, lets say for this, you only want to allow an input of 1 character.

So your code (without any checks) is:

Code:
   char szFirstLetter;
   cout << "Please enter a letter: ";
   szFirstLetter = cin.get();


Now lets say we ran this, and instead of entering 1 letter or number or symbol, I entered a word, like my name, Wiccaan.

So our code would put W into szFirstLetter correctly, but would be overflowed with the rest of the word 'iccaan'. Now, if you attempt to cin again after that above code such as:

Code:
   char szSecondLetter;
   cout << endl << "Please enter another letter: ";
   szSecondLetter = cin.get();


Instead of obtaining the new input, it will automatically obtain the input buffers 'overflowed' information. In this case, szSecondLetter would become 'i' and the input buffer will still contain 'ccaan'.

So you would use cin.sync() to prevent the overflowing from occuring.

Proper example (without checks and shit):
Code:
   char szFirstLetter;
   cout << "Please enter a letter: ";
   szFirstLetter = cin.get();
   cin.sync();

   char szSecondLetter;
   cout << endl << "Please enter another letter: ";
   szSecondLetter = cin.get();
   cin.sync();

   cout << endl << "First letter was: " << szFirstLetter << endl;
   cout << endl << "Second letter was: " << szSecondLetter << endl;

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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