| View previous topic :: View next topic |
| Author |
Message |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sun Mar 23, 2008 6:24 pm Post subject: |
|
|
| HornyAZNBoy wrote: | | I have a quad core, and 2GB or RAM, that does not slow down my computer one bit. |
Use VB6 instead then.
|
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Sun Mar 23, 2008 6:30 pm Post subject: |
|
|
In my opinion C++ is eaiser for the stuff I do. It is very hard to make good games in VB6. It is also very hard to ReadProcessMemory, OpenProcess, GetAsyncKetState, PostMessage, and stuff like that in VB6.
_________________
What dosen't kill you, usually does the second time. |
|
| Back to top |
|
 |
Poent Cheater
Reputation: 0
Joined: 24 Apr 2007 Posts: 32
|
Posted: Mon Mar 24, 2008 11:03 am Post subject: |
|
|
or you could just use the cin.get(); function. its clean and doesn't display that nasty windows pause message. it just waits.
int main(){
std::cout<<"hello world!";
std::cin.get();
}
_________________
There Are No Stupid Questions, But There Are A Lot Of Inquisitive Idiots. |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Mar 25, 2008 12:45 am Post subject: |
|
|
| spectrum wrote: | | Code: | #include <iostream.h>
int main ()
{
cout << "Hello World! \n";
return 0;
}
|
just add a "getch ();" or a "delay(2000);" before the "return 0;" the first will get you to type a character adn then it will close, the second will wait 2 seonds before closing. |
You need the include for getch then which is conio.h.
| HornyAZNBoy wrote: | And if you want it to pause do this right before return 0;
| Code: | system("pause");
retur 0; |
|
system("pause") is a waste of resources. A ton of resources at that too. Look it up on Google. I have posted about this many times already. It is a poor method of pausing the console when you already have more then enough to do it with iostream already included.
| HornyAZNBoy wrote: | Well, you can do it how every you want. I perfer this code
| Code: | #include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
while (true) {}
return 0;
} |
|
That is probably one of the worst things you could do to pause the console. Whether or not your PC is 'leet' that doesn't mean it will run the same way for everyone else. There is no reason to practice poor methods like that as well just because your computer can handle it.
| dark122222000 wrote: | | First off, I love Dev C++, because it's an IDE for MingW, a port of G++. |
I think you are the first person to ever have a positive remark about MingW on these forums lol...
| HornyAZNBoy wrote: | | In my opinion C++ is eaiser for the stuff I do. It is very hard to make good games in VB6. It is also very hard to ReadProcessMemory, OpenProcess, GetAsyncKetState, PostMessage, and stuff like that in VB6. |
That would be because VB was not made to create games. And it is not hard to use the API, it is no different then using it in any other language. The syntax is a little different but the API itself does not change from one language to another.
| Poent wrote: | or you could just use the cin.get(); function. its clean and doesn't display that nasty windows pause message. it just waits.
int main(){
std::cout<<"hello world!";
std::cin.get();
} |
As dictated by Jani here, , you should clear the input buffer before returning, which can be done using:
| Code: | std::cin.ignore();
std::cin.sync(); |
All in all a simple program I would suggest doing following basically everything in this thread:
| Code: | #include <iostream>
int main()
{
std::cout << "Hello world." << std::endl;
std::cin.ignore();
std::cin.sync();
return 0;
} |
_________________
- Retired. |
|
| Back to top |
|
 |
Negima I post too much
Reputation: 6
Joined: 22 May 2007 Posts: 2222
|
Posted: Tue Mar 25, 2008 9:09 am Post subject: |
|
|
Ok I got VS8 but for some reason when I try to compile this script it doesn't work
| Code: | #include <iostream.h>
int main()
{
cout << "hello world\n";
return 0;
}
|
It worked in dev c++.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Mar 25, 2008 12:21 pm Post subject: |
|
|
| Negima wrote: | Ok I got VS8 but for some reason when I try to compile this script it doesn't work
| Code: | #include <iostream.h>
int main()
{
cout << "hello world\n";
return 0;
}
|
It worked in dev c++. |
Because you are not including the namespace, or attempting to use it. cout is not just magically there without using the namespace. Either add this under your includes:
| Code: | | using namespace std; |
Or, use std:: infront of your iostream functions like:
| Code: | | std::cout << "hello world\n"; |
_________________
- Retired. |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Mar 25, 2008 2:42 pm Post subject: |
|
|
| <iostream> not <iostream.h>
|
|
| Back to top |
|
 |
spectrum Expert Cheater
Reputation: 0
Joined: 27 Mar 2007 Posts: 143
|
Posted: Tue Mar 25, 2008 5:14 pm Post subject: |
|
|
where can i learn api from? not winapi, i mean, to use apis like "readprocessmemory" and that.
_________________
C++ {||||||||||}
ASM {||||||||||} |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Mar 25, 2008 6:17 pm Post subject: |
|
|
| spectrum wrote: | | where can i learn api from? not winapi, i mean, to use apis like "readprocessmemory" and that. |
What do you think ReadProcessMemory is?
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Mar 25, 2008 9:45 pm Post subject: |
|
|
You can find a full listing of all the API on the MSDN website.
http://msdn2.microsoft.com/en-us/default.aspx
And like Slovac said, the API you mention is part of the Windows API, which is shorten to WinAPI, Win32API, and other variations.
_________________
- Retired. |
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Thu Mar 27, 2008 4:29 pm Post subject: |
|
|
| Wiccaan wrote: |
All in all a simple program I would suggest doing following basically everything in this thread:
| Code: | #include <iostream>
int main()
{
std::cout << "Hello world." << std::endl;
std::cin.ignore();
std::cin.sync();
return 0;
} |
|
Sorry for this question man..
but, what's the difference between cin.get() and cin.ignore()?
_________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Mar 27, 2008 10:00 pm Post subject: |
|
|
std::cin.get() extracts 1 character from the input stream. All it does is pops 1 character from the stack into a buffer. Leaving the rest of the buffer in the stack.
std::cin.ignore() extracts a given number of characters with an optional delimiter, then discards the rest of the buffer and clears the stack. Passing no variables defaults the function to simply clear the buffer and do nothing else as both params are optional and have default values.
std::cin.ignore( size = 1, delimiter = EOF );
_________________
- Retired. |
|
| Back to top |
|
 |
Negima I post too much
Reputation: 6
Joined: 22 May 2007 Posts: 2222
|
Posted: Sat Mar 29, 2008 11:42 am Post subject: |
|
|
Ok this is VERY earitating, all of the scripts I try in VS8 Don't work
I do this:
-go to new project
-select Win32 console app
and this script wont work
| Code: | #include <iostream>
int main()
{
std::cout << "Hello world";
std::cin.ignore();
std::cin.sync();
return 0;
}
|
It gives me this error
| Code: |
------ Build started: Project: Helloworld, Configuration: Debug Win32 ------
Compiling...
Helloworld.cpp
c:\users\joseph\documents\visual studio 2008\projects\helloworld\helloworld\helloworld.cpp(1) : warning C4627: '#include <iostream>': skipped when looking for precompiled header use
Add directive to 'stdafx.h' or rebuild precompiled header
c:\users\joseph\documents\visual studio 2008\projects\helloworld\helloworld\helloworld.cpp(10) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
Build log was saved at "file://c:\Users\Joseph\Documents\Visual Studio 2008\Projects\Helloworld\Helloworld\Debug\BuildLog.htm"
Helloworld - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Sat Mar 29, 2008 11:49 am Post subject: |
|
|
Go into the project settings and turn off precompiled headers.
They are utterly useless anyways.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sat Mar 29, 2008 9:06 pm Post subject: |
|
|
| Negima wrote: | Ok this is VERY earitating, all of the scripts I try in VS8 Don't work
I do this:
-go to new project
-select Win32 console app
and this script wont work
| Code: | #include <iostream>
int main()
{
std::cout << "Hello world";
std::cin.ignore();
std::cin.sync();
return 0;
}
|
It gives me this error
| Code: |
------ Build started: Project: Helloworld, Configuration: Debug Win32 ------
Compiling...
Helloworld.cpp
c:\users\joseph\documents\visual studio 2008\projects\helloworld\helloworld\helloworld.cpp(1) : warning C4627: '#include <iostream>': skipped when looking for precompiled header use
Add directive to 'stdafx.h' or rebuild precompiled header
c:\users\joseph\documents\visual studio 2008\projects\helloworld\helloworld\helloworld.cpp(10) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
Build log was saved at "file://c:\Users\Joseph\Documents\Visual Studio 2008\Projects\Helloworld\Helloworld\Debug\BuildLog.htm"
Helloworld - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
|
Other then just turning off precompiled headers as Flyte suggested (I do too, they are useless and mostly lead to more issues later on.) you can correct this error by readding the following to your includes:
#include "stdafx.h"
Add it above your iostream include. So it should look like this:
| Code: | #include "stdafx.h"
#include <iostream>
int main()
{
std::cout << "Hello world";
std::cin.ignore();
std::cin.sync();
return 0;
} |
_________________
- Retired. |
|
| Back to top |
|
 |
|