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 


New to C++
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
assaf84
Expert Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 238

PostPosted: Sun Oct 07, 2007 11:27 am    Post subject: Reply with quote

I would just open the exe from the cmd..
Back to top
View user's profile Send private message
happydud3
Advanced Cheater
Reputation: 0

Joined: 07 Dec 2006
Posts: 86

PostPosted: Sun Oct 07, 2007 3:07 pm    Post subject: Reply with quote

guys i need help aswell ROFL. i just started c++ and this is wat i got.


Code:
#include <iostream.h>
#include <string.h>
void main ()


{
   char name[8];
      short cost;
      float amount;
         float totalsale;
cout << "Name of the customer: ";
cin.getline(name, 8);
cout << "What does it cost: ";
cin >> cost;
cout << "What is the amount: ";
cin >> amount;

totalsale = (float)amount * (float)cost;

cout << endl;
cout << "Customer name: " << name << endl;
cout << "The amount wanted: " << amount << endl;
cout << "The cost of the item is: " << cost << endl;
cout << "The total sale is: $" << totalsale << endl;
}


i dont get wat void main () is suppose to do
and and
Code:
char name[8] = " ";
      short cost = 0;
      float amount = 0.0;
         float totalsale = 0.0;

   char name[8];
      short cost;
      float amount;
         float totalsale;

whats the difference between these two codes?


Last edited by happydud3 on Sun Oct 07, 2007 11:33 pm; edited 1 time in total
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: Sun Oct 07, 2007 3:09 pm    Post subject: Reply with quote

void main() is the entry point of your program. (Console app.) It is the first thing to be called when its loaded. Without an entry point, your program will not do anything, and in most cases wont compile.

It is also suggested not to use void for the entry point but instead to use a returning type such as int or boolean.

Code:
int main()
{
 // your code here
}
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: Mon Oct 08, 2007 6:00 am    Post subject: Reply with quote

happydud3 wrote:
and and
Code:
char name[8] = " ";
      short cost = 0;
      float amount = 0.0;
         float totalsale = 0.0;

   char name[8];
      short cost;
      float amount;
         float totalsale;

whats the difference between these two codes?
Well.. Wiccan answered the first part, I'll answer the second one; The first one initializes the variables with "reasonable" values, whereas the later one doesn't. If you try printing those last ones, you'll probably get some random values, like 1234... Print them and you will see.
Back to top
View user's profile Send private message
Acim
Grandmaster Cheater Supreme
Reputation: 0

Joined: 04 Jun 2007
Posts: 1948
Location: If anyone has a GMS DK and they don't need it I'll have it!!

PostPosted: Mon Oct 08, 2007 8:52 am    Post subject: Reply with quote

Still cant get C++ to work, so I dled Delphi now its asking me for a freakin serial number.
_________________
I'm alive and well, but I quit CEF for a while. Legitly playing since Novemberish 07. Starting hacking October 06.
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: Mon Oct 08, 2007 9:07 am    Post subject: Reply with quote

Acim wrote:
Still cant get C++ to work, so I dled Delphi now its asking me for a freakin serial number.


Post your errors or any other issues you are having.
Back to top
View user's profile Send private message Visit poster's website
Acim
Grandmaster Cheater Supreme
Reputation: 0

Joined: 04 Jun 2007
Posts: 1948
Location: If anyone has a GMS DK and they don't need it I'll have it!!

PostPosted: Mon Oct 08, 2007 9:25 am    Post subject: Reply with quote

Moose wrote:
Code:
system("pause");


Code:
while (! _kbhit()) Sleep(0);


Code:
getch();

Lemme try.

Hmm... maybe I just suck at C++. Thanks for eveyrone trying but im moving to serial-key-Delphi.

_________________
I'm alive and well, but I quit CEF for a while. Legitly playing since Novemberish 07. Starting hacking October 06.
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Mon Oct 08, 2007 10:27 am    Post subject: Reply with quote

Moose wrote:
Code:
getch();
Code:
_getch();
Back to top
View user's profile Send private message
Qvazzler
Advanced Cheater
Reputation: 0

Joined: 02 Jan 2007
Posts: 68

PostPosted: Tue Oct 09, 2007 5:33 am    Post subject: Reply with quote

Flyte wrote:
Flyte wrote:
x0r wrote:
I didn't know iostream provided it's own Sleep function Laughing


My bad, too many C programming habits. Laughing
You know what I was getting at though.

I don't remember windows having it's own sleep function inside iostream.. Isn't that only on linux?
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Tue Oct 09, 2007 1:15 pm    Post subject: Reply with quote

Qvazzler wrote:
I don't remember windows having it's own sleep function inside iostream.. Isn't that only on linux?


sleep is linux (lowercase s, seconds, unistd.h)
Sleep is windows(uppercase s, milliseconds, winbase.h Rolling Eyes)


Last edited by appalsap on Tue Oct 09, 2007 6:10 pm; edited 1 time in total
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: Tue Oct 09, 2007 5:49 pm    Post subject: Reply with quote

appalsap wrote:
Sleep is windows(uppercase s, milliseconds, windows.h)


Sleep for Windows is located in winbase.h just fyi. Auto included if you include windows.h if you need everything.
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