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 


[HELP] VC++ #include iostream.h ...
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Tue May 06, 2008 2:46 pm    Post subject: Reply with quote

tdenisenko: Read up more on the basics, you don't seem to be understanding the syntax of things yet. www.cplusplus.com has a nice tutorial for the basics which I suggest you read. Smile
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
tdenisenko
Grandmaster Cheater
Reputation: 0

Joined: 23 Oct 2007
Posts: 799
Location: Turkey

PostPosted: Tue May 06, 2008 3:00 pm    Post subject: Reply with quote

Wiccaan wrote:
tdenisenko: Read up more on the basics, you don't seem to be understanding the syntax of things yet. www.cplusplus.com has a nice tutorial for the basics which I suggest you read. Smile


ok i built it without error but when i try to run it, it closes so fast:

The thread 'Win32 Thread' (0x11c4) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x178c) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1480) has exited with code 0 (0x0).
The program '[4528] hello.exe: Native' has exited with code 0 (0x0).
The program '[4528] hello.exe: Managed' has exited with code 0 (0x0).

EDIT: ok it shows me the text for less then 1 sec but it shows Very Happy

_________________
I am learning C++ and ASM and making trainers!
My Last Chaos Trainer!
LC Trainer by tdenisenko


Last edited by tdenisenko on Tue May 06, 2008 3:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue May 06, 2008 3:05 pm    Post subject: Reply with quote

Code:
#include <iostream>
using namespace std;

int main( void )
{
        cout << "Hello Everybody!\n";
        cin.ignore();
        cin.get();
        return 0;
 }


This problem is all over this forum and in my cTut i touched up on this, please look around. You have to use either cin.ignore(); cin.get(); or getch();

The program '[4528] hello.exe: Native' has exited with code 0 (0x0).
The program '[4528] hello.exe: Managed' has exited with code 0 (0x0).

This is good. It means that the program ran and returned 0 which is what you told it to do. It's just it ran and didn't pause for you, which is what those codes do. They wait for user input.

Edit: get the fucking shit out of your siggy. That's a trainer that you just edited the strings too. I don't like when people leech like that and claim shit as their own when they can't even get C apps working. Don't disrespect the community by doing that.

_________________
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: Tue May 06, 2008 3:37 pm    Post subject: Reply with quote

blankrider wrote:
Code:
#include <iostream>
using namespace std;

int main( void )
{
        cout << "Hello Everybody!\n";
        cin.ignore();
        cin.get();
        return 0;
 }


This problem is all over this forum and in my cTut i touched up on this, please look around. You have to use either cin.ignore(); cin.get(); or getch();

The program '[4528] hello.exe: Native' has exited with code 0 (0x0).
The program '[4528] hello.exe: Managed' has exited with code 0 (0x0).

This is good. It means that the program ran and returned 0 which is what you told it to do. It's just it ran and didn't pause for you, which is what those codes do. They wait for user input.

Edit: get the fucking shit out of your siggy. That's a trainer that you just edited the strings too. I don't like when people leech like that and claim shit as their own when they can't even get C apps working. Don't disrespect the community by doing that.


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


Would be the preferred method to pause with a clean and clear buffer.

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

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Tue May 06, 2008 3:43 pm    Post subject: Reply with quote

Well i use ignore and get xP
_________________
Back to top
View user's profile Send private message
Typhoon808
Expert Cheater
Reputation: 0

Joined: 27 Mar 2008
Posts: 175
Location: Wales

PostPosted: Tue May 06, 2008 4:53 pm    Post subject: Reply with quote

Code:

#include <iostream>
using namespace std;

int input;
int answer;

int main()
{
     system("cls");
     cout<<"Enter a number:"<<endl;
     cin>>input;

     answer = input * 2;
     cout<<input<<" * 2 = "<<answer<<endl;

     return 0;
}


Something like that should work just fine.
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue May 06, 2008 4:59 pm    Post subject: Reply with quote

Erm, why have you placed that pointless system call at the top?
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue May 06, 2008 5:04 pm    Post subject: Reply with quote

noz3001 wrote:
Erm, why have you placed that pointless system call at the top?


what if the screen is not clear enough? think of the consequences.
Back to top
View user's profile Send private message
Typhoon808
Expert Cheater
Reputation: 0

Joined: 27 Mar 2008
Posts: 175
Location: Wales

PostPosted: Tue May 06, 2008 5:04 pm    Post subject: Reply with quote

I use it to clear the CMD window of previous commands before running the program through CMD.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue May 06, 2008 5:05 pm    Post subject: Reply with quote

Typhoon808 wrote:
I use it to clear the CMD window of previous commands before running the program through CMD.


There wouldn't be anything.
Back to top
View user's profile Send private message
Typhoon808
Expert Cheater
Reputation: 0

Joined: 27 Mar 2008
Posts: 175
Location: Wales

PostPosted: Tue May 06, 2008 5:09 pm    Post subject: Reply with quote

It still shows up for me. I've always had a problem with running things through CMD. They never clear the window before continuing. Sorry, it's a habit of mine.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue May 06, 2008 5:14 pm    Post subject: Reply with quote

There's a shitload of overhead and it's generally very slow to do. Kick the habit
Back to top
View user's profile Send private message
Cx
Master Cheater
Reputation: 0

Joined: 27 Jul 2007
Posts: 367

PostPosted: Tue May 06, 2008 8:37 pm    Post subject: Reply with quote

slovach wrote:
noz3001 wrote:
Erm, why have you placed that pointless system call at the top?


what if the screen is not clear enough? think of the consequences.

I lol'd.

_________________

armed with this small butterfly net
i will face the world alone
& never be lonely.
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 May 07, 2008 12:12 am    Post subject: Reply with quote

slovach wrote:
Typhoon808 wrote:
I use it to clear the CMD window of previous commands before running the program through CMD.


There wouldn't be anything.


If its a console app, it could be loaded through dos and have the previous dos text still in the window. I would, however, suggest not using system() for anything.

Clearing without system:

Code:
#include <windows.h>
#include <iostream>

int main( int argc, char* argcv[] )
{
   UNREFERENCED_PARAMETER( argc );
   UNREFERENCED_PARAMETER( argcv );

   //
   // Clear Console Buffer
   //
   CONSOLE_SCREEN_BUFFER_INFO pConsoleBufferInfo;
   COORD cCoords = {0};
   GetConsoleScreenBufferInfo( GetStdHandle(STD_OUTPUT_HANDLE), &pConsoleBufferInfo );
   FillConsoleOutputCharacter( GetStdHandle(STD_OUTPUT_HANDLE), 32, pConsoleBufferInfo.dwSize.X*pConsoleBufferInfo.dwSize.Y, cCoords, NULL );
   SetConsoleCursorPosition( GetStdHandle(STD_OUTPUT_HANDLE), cCoords );

   //
   // Some output for the hell of it...
   //
   std::cout << "Some output..." << std::endl;

   //
   // Pause Then Return
   //
   std::cin.sync();
   std::cin.ignore();
   return 0;
}

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Typhoon808
Expert Cheater
Reputation: 0

Joined: 27 Mar 2008
Posts: 175
Location: Wales

PostPosted: Wed May 07, 2008 3:26 am    Post subject: Reply with quote

Thanks alot, Wiccaan. I'll be sure to use this.
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, 3  Next
Page 2 of 3

 
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