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 c++ something is wrong
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Thu Sep 20, 2007 11:19 am    Post subject: help c++ something is wrong Reply with quote

well i started to learn c++ right now ... and i got 1 problem like always ..

well i compiling the program and no errors but when i run it it only dissapare in 1 sec
but if i press run in the program it work

whats the problem with my comp .... it happening with allthing i compiling in c++

but if i press run in the program it work but if i compile it dissapare in 1 sec -.-

tested dev c++ ,Quincy 99 to compile them =/

Code:

#include <iostream>

int main()
{
    // write to the screen
    std::cout << "My first C++ program";

    return 0;
}

_________________
dont complain about my english...
1*1 = 2?


Last edited by ups2000ups on Thu Sep 20, 2007 11:20 am; edited 1 time in total
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Thu Sep 20, 2007 11:20 am    Post subject: Reply with quote

Run them through CMD or _getch
_________________
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Thu Sep 20, 2007 11:23 am    Post subject: Reply with quote

UnLmtD wrote:
Run them through CMD or _getch



you mean compile them by cmd
or
"start C:\Quincy99\Programs\Chap02\pr02001"
oO well "start C:\Quincy99\Programs\Chap02\pr02001" then it happening the same


or tell me how to do it =p well im a noob at this ...

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Thu Sep 20, 2007 11:26 am    Post subject: Reply with quote

Windows+R
cmd
Click OK
cd "your folder goes here" (Note the quotation marks.)
(then just type the name of your exe eg.) myprogram.exe

In your case:
Windows+R
cmd
Click OK
cd "C:\Quincy99\Programs\Chap02\"
pr02001.exe

OR just:

Windows+R
cmd
Click OK
"C:\Quincy99\Programs\Chap02\pr02001.exe"

The .exe isn't necessary, but I added it there to avoid confusion.


Last edited by Jani on Thu Sep 20, 2007 11:29 am; edited 1 time in total
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Thu Sep 20, 2007 11:29 am    Post subject: Reply with quote

Thanks =D


but why cant i open it like an exe ? oO

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Thu Sep 20, 2007 11:31 am    Post subject: Reply with quote

ups2000ups wrote:
but why cant i open it like an exe ? oO
Because autoclose is a feature of Windows XP command shell. Put #include <conio.h> in your code and "::_getch();" in the very last line before return. (No quotation marks.)

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

int main()
{
    // write to the screen
    std::cout << "My first C++ program";

    ::_getch();
    return 0;
}
Note that ::_getch() isn't portable! I guess the best portable way would be doing std::cin.ignore(); and std::cin.sync();. I'm not sure tho.

Btw.. Thanks for the rep ;)
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Thu Sep 20, 2007 11:45 am    Post subject: Reply with quote

Jani wrote:
ups2000ups wrote:
but why cant i open it like an exe ? oO
Because autoclose is a feature of Windows XP command shell. Put #include <conio.h> in your code and "::_getch();" in the very last line before return. (No quotation marks.)

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

int main()
{
    // write to the screen
    std::cout << "My first C++ program";

    ::_getch();
    return 0;
}
Note that ::_getch() isn't portable! I guess the best portable way would be doing std::cin.ignore(); and std::cin.sync();. I'm not sure tho.

Btw.. Thanks for the rep Wink



Thanks! if i could i would rep you again =p ...

_________________
dont complain about my english...
1*1 = 2?
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: Thu Sep 20, 2007 11:55 am    Post subject: Reply with quote

Code:


loop:
goto loop;

return 0;


Roflmao.
Back to top
View user's profile Send private message MSN Messenger
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Thu Sep 20, 2007 12:19 pm    Post subject: Reply with quote

noz3001 wrote:
Code:


loop:
goto loop;

return 0;


Roflmao.


okaj ur way is better -.- or atleast easier to remember =p

_________________
dont complain about my english...
1*1 = 2?
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: Thu Sep 20, 2007 12:21 pm    Post subject: Reply with quote

ups2000ups wrote:
noz3001 wrote:
Code:


loop:
goto loop;

return 0;


Roflmao.


okaj ur way is better -.- or atleast easier to remember =p


Trust me, it's not.
Back to top
View user's profile Send private message MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Sep 20, 2007 1:14 pm    Post subject: Reply with quote

that would never end would it?
_________________
Back to top
View user's profile Send private message
killersamurai
Expert Cheater
Reputation: 0

Joined: 10 Sep 2007
Posts: 197
Location: Colorado

PostPosted: Thu Sep 20, 2007 4:24 pm    Post subject: Reply with quote

system("pause"); would be the better way. Since you are already using iostream, you don't need to include anything else. You also don't have to use goto. It also gives you a message "Press any key to continue".

Code:

#include <iostream>
int main()
{
system("pause");
}
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: Thu Sep 20, 2007 4:37 pm    Post subject: Reply with quote

killersamurai wrote:
system("pause"); would be the better way. Since you are already using iostream, you don't need to include anything else. You also don't have to use goto. It also gives you a message "Press any key to continue".

Code:

#include <iostream>
int main()
{
system("pause");
}


Ignore this guy, Jani gave the correct method.
Back to top
View user's profile Send private message MSN Messenger
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Thu Sep 20, 2007 4:53 pm    Post subject: Reply with quote

Do cin.get(). Trust me, using labels is horrible, it shouldn't rly ever be used but there are certain times I guess you can use them. But just do this.

Code:

#include <iostream>

using namespace std;

int main()
{
   cout<<"My first C++ program.\n";
   cin.get();
}


Now it won't automaticly close and it will only close now if you click enter.

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Sep 20, 2007 5:01 pm    Post subject: Reply with quote

Code:
#include <iostream>

using namespace std;

int main()
{
   cout<<"My first C++ program.\n";
   cin.ignore();
   cin.get();
}


use cin.ignore() in situations where you prompt for info

_________________
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 1, 2  Next
Page 1 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