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++] Suggestions for small programs
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
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Jul 05, 2008 4:30 pm    Post subject: Reply with quote

manc wrote:
Thanks everyone for the suggestions, I'm loving them. Here is exactly what Ive learned so far from the course at www.cplusplus.com:



So yeah, you can base any suggestions off that.


o_O

Why is type casting advanced?

Anyways, maybe you should start looking into some APIs (after you learn type casting... >_> )

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Heartless
I post too much
Reputation: 0

Joined: 03 Dec 2006
Posts: 2436

PostPosted: Sat Jul 05, 2008 7:23 pm    Post subject: Reply with quote

Make a basic calculator that can add, mulitply, divide, and subtract. That is always lesson 2.
_________________
What dosen't kill you, usually does the second time.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Sat Jul 05, 2008 10:04 pm    Post subject: Reply with quote

Keep going on what they have on that site. It is a good idea to have a general understanding of the things you haven't learned yet.

Templates are used a lot and can be quiet handy in some projects.

Namespaces are common as well.

Exception programming is for error handling and such which you should get to know how to use as well since you will have times where it will be nice to handle errors that will commonly happen under certain circumstances in a given project.

Typecasting is another useful subject for hooking and hacking. As well as creating your own libs and such. You can create your own variable types using typecasting which allows you to do a lot of things with ease.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
nwongfeiying
Grandmaster Cheater
Reputation: 2

Joined: 25 Jun 2007
Posts: 695

PostPosted: Sat Jul 05, 2008 10:46 pm    Post subject: Reply with quote

Symbol wrote:
Convert numbers (0~999) to actual words, if the input is 534 the output would be Five hundred thirty four.

Try doing it in the shortest way you can. Razz


LOL! That would be a good idea.
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Sun Jul 06, 2008 7:13 am    Post subject: Reply with quote

Symbol wrote:
Convert numbers (0~999) to actual words, if the input is 534 the output would be Five hundred thirty four.
0 ~ sizeof(int) ;) Also make it convert them to ordinal numbers too.
Back to top
View user's profile Send private message
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Sun Jul 06, 2008 8:56 am    Post subject: Reply with quote

Try creating classes for complex data structures such as binary node trees, and store values, say your schedule, within those data structures, and then practice retrieving htem and outputting them to a table.
Back to top
View user's profile Send private message AIM Address
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sun Jul 06, 2008 12:14 pm    Post subject: Reply with quote

Jani wrote:
Symbol wrote:
Convert numbers (0~999) to actual words, if the input is 534 the output would be Five hundred thirty four.
0 ~ sizeof(int) Wink Also make it convert them to ordinal numbers too.

sizeof(int) = 4. Surprised
Ofcourse I assume you mean 0xFFFFFFFF. (4 bilion+ Surprised)
First he should try 0~999, he should also concider the input might contain ten~ninteen, so he should fix it so it won't say "Five hundred Ten Three" for 513.

Well since he isn't even trying, I tried doing it myself in the shortest and best way I could.
Here's what I did:
Code:
#include <iostream>

using namespace std;

char* Array1[] = { "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" };
char* Array2[] = { "", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" };
char* Array3[] = { "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" };

void main(int argc, char* argv[])
{
   int num;
   char Text[255] = "";
   do
   {
      do { cin >> num; } while (num > 999 || num < 0);
      if (num > 0)
      {
         if (num / 10 % 10 != 1)
            sprintf_s(Text, 255, "%s%s%s %s", Array1[num / 100], (num / 100 != 0 ? " hundred " : ""), Array2[num / 10 % 10], Array1[num % 10]);
         else sprintf_s(Text, 255, "%s%s%s", Array1[num / 100], (num / 100 != 0 ? " hundred " : ""), Array3[(num % 10)]);
            cout << Text << endl;
      }
   } while (num > 0);
   cout << "Zero" << endl;
   cin.get();
   cin.ignore();
}
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Sun Jul 06, 2008 12:56 pm    Post subject: Reply with quote

Symbol wrote:
sizeof(int) = 4.
Not always.

Btw.. Your code is more of C than C++, since std::cout and std::cin are the only C++ stuff(objects) you're using. Why to code in C++, if you don't use it's features?
Back to top
View user's profile Send private message
Hieroglyphics
I post too much
Reputation: 0

Joined: 06 Dec 2007
Posts: 2007
Location: Your bedroom

PostPosted: Sun Jul 06, 2008 1:20 pm    Post subject: Reply with quote

Make this please. Open source please =]
_________________

Back to top
View user's profile Send private message AIM Address MSN Messenger
Travis13
Expert Cheater
Reputation: 0

Joined: 17 Feb 2007
Posts: 199

PostPosted: Wed Jul 09, 2008 3:26 am    Post subject: Reply with quote

Symbol wrote:
Convert numbers (0~999) to actual words, if the input is 534 the output would be Five hundred thirty four.

Try doing it in the shortest way you can. Razz


holy fuck how the hell would u actually make that? Surprised i wouldnt even know where to start lol, but also, theres no point to it

_________________
Learning C++, trying, failing, never gonna give up tho Razz
Back to top
View user's profile Send private message MSN Messenger
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Wed Jul 09, 2008 3:52 am    Post subject: Reply with quote

AFAIK sizeof(int) is 4.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Wed Jul 09, 2008 6:17 am    Post subject: Reply with quote

http://www.rgagnon.com/javadetails/java-0426.html

Java example of converting numbers to words. Not that hard to do.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Wed Jul 09, 2008 7:09 am    Post subject: Reply with quote

Zand wrote:
AFAIK sizeof(int) is 4.
C doesn't specify that. It only says something like short int <= int <= long int. And that int must be at least 16-bits long -> sizeof(int) would be 2 there. And what about 16-bit machines?

Getting a bit off topic.. :)
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Wed Jul 09, 2008 7:38 am    Post subject: Reply with quote

integer = 4 bytes

i mean literally doing like printf("%i", sizeof(int));
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Wed Jul 09, 2008 7:51 am    Post subject: Reply with quote

Zand wrote:
printf("%i", sizeof(int));
2 on my MS-DOS machine. Might be 8 on 64-bit OS, depends on compiler, etc.
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
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