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 


[REQUEST] Tut in Visual C++ that will..

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

Joined: 22 Feb 2009
Posts: 1358

PostPosted: Thu Mar 26, 2009 5:25 pm    Post subject: [REQUEST] Tut in Visual C++ that will.. Reply with quote

I request a tutorial that will teach me how to make a windows console application in Visual C++ that will tell me something when I type something and then loop back so I can type something else and it will do it again and again.

If this doesn't make sense, please tell me and I will try to re-word it XD I fail at explaining things sometimes

_________________


If you have a mic, add me and tell me that you're from CEF or I won't add you (probably)
Back to top
View user's profile Send private message MSN Messenger
VolatileAce
Cheater
Reputation: 0

Joined: 19 Mar 2009
Posts: 30
Location: 0001001100110111

PostPosted: Thu Mar 26, 2009 7:00 pm    Post subject: Reply with quote

[Edit] As you can see, it won't let me post URLs so you'll have to paste the address and see it yourself.[/Edit]

First, open up Visual C++ (I use 2008 Express Edition).

Click on File -> New -> Project
[img]img441.imageshack.us/img441/5560/98256938.png[/img]

Win32 -> Win32 Concole Application
Then name your project anything you'd like, in this case, MyProject.
[img]img53.imageshack.us/img53/845/84904422.png[/img]

For the purposes of this, you don't really need to customize anything so press Finish.
[img]img172.imageshack.us/img172/8859/47539219.png[/img]

Type in your source code, in this case I've done a simple example of a loop since I assume that's what you are looking for. (Same code below the picture as well)[img]img58.imageshack.us/img58/4670/35165453.png[/img]

For programs written with Visual C++, you have to #include "stdafx.h" or it wouldn't compile.
#include are basically header files and libraries to be compiled with your source to form an executable, you need them to access various functions.
using namespace std will save you from typing the annoying std:: every time you access one of the functions.
int main() is the entry of the application, C++ compilers look for method with the name main in your source to determine the entry point.
string s declare s as a variable of type string.
do{ ... }while(...); is a loop where it will occur at least once.
The "Stuff" inside the {} are the code to be executed within the loop.
The thing in () is the condition (true / false) in C++, 0 is false, any non-0 value is true.
cout << basically put whatever you entered into the output stream.
cin >> is the opposite, it reads in from the input stream.
cin >> s means it reads whatever and store it into s.
endl is like a constant telling the output stream to move on to the next line, you can get the same result if you type \n in a string.
Once you leave the loop, it'll print out Bye! and return 0 basically exits the program (Since there is nothing more to do).
Code:
#include "stdafx.h"
#include <string>
#include <iostream>

using namespace std;

int main(){
   string s;
   do{
      cout << "Please type in something: ";
      cin >> s;
      cout << "You typed '" << s << "'." << endl;
   }while(s != "exit");
   cout << "Bye!" << endl;
   return 0;
}


Once you are done, press Ctrl + F5 to compile and run.
[img]img257.imageshack.us/img257/8862/22251502.png[/img]

The bottom should be something similar to:
[img]img216.imageshack.us/img216/4213/76040646.png[/img]

Type anything you'd like, as long as you don't type 'exit', the program will keep asking for inputs, and telling you what you typed.
[img]img410.imageshack.us/img410/2246/82837105.png[/img]

Hope this helps.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Mar 26, 2009 9:19 pm    Post subject: Reply with quote

can't use img tags with PNG, use a jpg.
Back to top
View user's profile Send private message
Cyrusmages
Grandmaster Cheater Supreme
Reputation: 0

Joined: 22 Feb 2009
Posts: 1358

PostPosted: Fri Mar 27, 2009 6:22 am    Post subject: Reply with quote

Thank you so much, that's hellaclose to what I needed. Plus it's sort of cool to screw around with.

Is there a way to make it to where if I type something it will give me something specific to that something.

I type: Mouse
It returns: Fag

I type: Tacos
It returns: Why is Cyrus so fucking sexy?

I don't wanna do that exactly, lol, that would be weird, but you get the idea. Also, is there any way I can make it NON case sensitive? Mouse is the same as mouse and mOuse is the same mousE and you get the idea, but is there a way to do it without typing it with every combination of "mouse"? Because I'll be doing this for thousands of things, typing in like TONS of combinations just for 1 thing would take forever.


VolatileAce wrote:
The "Stuff" inside the {} are the code to be executed within the loop.
The thing in () is the condition (true / false) in C++, 0 is false, any non-0 value is true.


Also, does this mean that if I type like 900 it will still be true?

slovach wrote:
can't use img tags with PNG, use a jpg.



_________________


If you have a mic, add me and tell me that you're from CEF or I won't add you (probably)
Back to top
View user's profile Send private message MSN Messenger
VolatileAce
Cheater
Reputation: 0

Joined: 19 Mar 2009
Posts: 30
Location: 0001001100110111

PostPosted: Fri Mar 27, 2009 10:52 am    Post subject: Reply with quote

Add this segment of code AFTER 'using namespace std;' and BEFORE 'int main()':
Code:
char toUpper(char c){
   return (c >= 64 && c < 91) ? char(c+32) : c;
}

bool stringEquals(string s1, string s2){
   if(s1.length() != s2.length())
      return false;
   for(int i = 0; i < s1.length(); i++)
      if(toUpper(s1.at(i)) != toUpper(s2.at(i)))
         return false;
   return true;
}


Then in 'int main()':
Code:
int main(){
   string s;
   do{
      cout << "Please type in something: ";
      cin >> s;
      if(s == "Mouse")
         cout << "Fag" << endl;
      if(stringEquals(s, "Tacos"))
         cout << "Why is Cyrus so fucking sexy?" << endl;
   }while(s != "exit");
   cout << "Bye!" << endl;
   return 0;
}


'if(s == "Mouse")' would be non case sensitive.
'if(stringEquals(s, "Tacos"))' would be case sensitive.
Back to top
View user's profile Send private message
Cyrusmages
Grandmaster Cheater Supreme
Reputation: 0

Joined: 22 Feb 2009
Posts: 1358

PostPosted: Fri Mar 27, 2009 2:08 pm    Post subject: Reply with quote

VolatileAce wrote:
Add this segment of code AFTER 'using namespace std;' and BEFORE 'int main()':
Code:
char toUpper(char c){
   return (c >= 64 && c < 91) ? char(c+32) : c;
}

bool stringEquals(string s1, string s2){
   if(s1.length() != s2.length())
      return false;
   for(int i = 0; i < s1.length(); i++)
      if(toUpper(s1.at(i)) != toUpper(s2.at(i)))
         return false;
   return true;
}


Then in 'int main()':
Code:
int main(){
   string s;
   do{
      cout << "Please type in something: ";
      cin >> s;
      if(s == "Mouse")
         cout << "Fag" << endl;
      if(stringEquals(s, "Tacos"))
         cout << "Why is Cyrus so fucking sexy?" << endl;
   }while(s != "exit");
   cout << "Bye!" << endl;
   return 0;
}


'if(s == "Mouse")' would be non case sensitive.
'if(stringEquals(s, "Tacos"))' would be case sensitive.


I.. fucking.. love you, man. You are a beast! Btw, you got it the other way around, s == "Mouse" is the case sensitive one Smile Thank you so much, though. +rep, it's ashame I can't rep like 20 times in a row, because I would.

_________________


If you have a mic, add me and tell me that you're from CEF or I won't add you (probably)
Back to top
View user's profile Send private message MSN Messenger
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Fri Mar 27, 2009 3:16 pm    Post subject: Reply with quote

Yeah but u don't learn anything of this.
Try writing ur own stuff in c++ and u learn.
If u just read , u'll forget Razz
Back to top
View user's profile Send private message
Cyrusmages
Grandmaster Cheater Supreme
Reputation: 0

Joined: 22 Feb 2009
Posts: 1358

PostPosted: Fri Mar 27, 2009 3:44 pm    Post subject: Reply with quote

blackmorpheus wrote:
Yeah but u don't learn anything of this.
Try writing ur own stuff in c++ and u learn.
If u just read , u'll forget Razz


Well I don't plan on learning a language just to make one script that I knew wouldn't be EXTREMELY complicated. I'll learn programming languages when I'm out of school.

_________________


If you have a mic, add me and tell me that you're from CEF or I won't add you (probably)
Back to top
View user's profile Send private message MSN Messenger
VolatileAce
Cheater
Reputation: 0

Joined: 19 Mar 2009
Posts: 30
Location: 0001001100110111

PostPosted: Fri Mar 27, 2009 4:41 pm    Post subject: Reply with quote

To Cyrusmages,
I couldn't reply via PM so I'll reply here:

Change
cin >> s;
to
getline(cin, s);

Also if the "code" you send me via PM is what you were planning to do, I'd do it in Java.
Back to top
View user's profile Send private message
Cyrusmages
Grandmaster Cheater Supreme
Reputation: 0

Joined: 22 Feb 2009
Posts: 1358

PostPosted: Fri Mar 27, 2009 7:45 pm    Post subject: Reply with quote

VolatileAce wrote:
To Cyrusmages,
I couldn't reply via PM so I'll reply here:

Change
cin >> s;
to
getline(cin, s);

Also if the "code" you send me via PM is what you were planning to do, I'd do it in Java.


I fucking love you again, even more. You're the bestest evar!

And I would do it in Java, but I don't know how to code it Sad

I figure I'll just stick with this because I already have a format o.O

_________________


If you have a mic, add me and tell me that you're from CEF or I won't add you (probably)
Back to top
View user's profile Send private message MSN Messenger
niko3777
Cheater
Reputation: 0

Joined: 23 Feb 2009
Posts: 42
Location: The Asian Pirate Island, AKA (Hong Kong...)

PostPosted: Thu Apr 02, 2009 10:12 pm    Post subject: Reply with quote

Tis is all good to know but if anyone can teach me a little about programs that root in to games for game trainers instead of console screens that record what we say plz pm me!!!
_________________
PM me if you know how to make a game trainer for things like age of empire, maplestory, or command and coquer. in C++!!!
Back to top
View user's profile Send private message
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Thu Apr 02, 2009 10:19 pm    Post subject: Reply with quote

niko3777 wrote:
Tis is all good to know but if anyone can teach me a little about programs that root in to games for game trainers instead of console screens that record what we say plz pm me!!!

Um...

?

1] You can use console applications to do whatever you want.

2] Why hijack the thread? Stay at least semi-on topic or at least make a new thread

3] Note that if you type like that when asking for help, you will hardly receive any. If you think you have the intelligence to program, at least show some modesty when typing.

4] Root into games? It all depends on the game and what you are trying to accomplish.

_________________
Back to top
View user's profile Send private message
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