My head is about to blow off- Please help!
in vc++ .net, choose win32 project, type the name, click ok...then on the next menu, go to application settings and choose console project.
alright thanks jdawg2. I got the whole console application thing down but now whenever I build my files, it will come up with 0 errors and then the dos prompt will flash on the screen and thats it. How do I get it to stay on the screen so I can enter my variable and such?
Programming is confussing!
Programming is confussing!
-----------------------------AIM: Trebor DoDHompage: Thinking Digitally: My Web Blog
The simplest answer is to use a getchar(); or two at the end of your code, like so:
If you do any user input (eg. keyboard) you need to use getchar() twice since you need to empty the input buffer.
#include <stdio.h>
int main(void)
{
printf("Press an key to exit");
getchar();
}
If you do any user input (eg. keyboard) you need to use getchar() twice since you need to empty the input buffer.
Unfortunately, Coward, books often don''t cover the specific issue he just asked about. Lose the attitude or get a name.
Another way to get the console to stay on the screen after program termination is to include cstdlib (or stdlib.h if you use an archaic compiler) and add the line
system("pause");
right before you return from main().
Peace,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
Another way to get the console to stay on the screen after program termination is to include cstdlib (or stdlib.h if you use an archaic compiler) and add the line
system("pause");
right before you return from main().
Peace,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[twitter]warrenm[/twitter]
quote: Original post by ZealousElixir
Another way to get the console to stay on the screen after program termination is to include cstdlib (or stdlib.h if you use an archaic compiler)
There''s something wrong with including stdlib.h? I mean, I know VC6 auto-includes it, but I like to make it explicit include...ive been programming for so long and I never heard this. Damnit I never know anything >
In any case, can you explain what the difference is?
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
1) Choose 'Managed C++ Empty Project'. That will allow you to do a console application without having to change settings.
2) Right click on Source Files in the Solution Explorer and then Add->Add New Item.
3) Choose 'C++ File(.cpp)' and type main in the Name box.
4) Type this in the source file:
***The using namespace std needs to be on a new line.
5) Hit Ctrl-F5 to run the program.
6) Click Yes on the message box that pops up to build the code.
7) You should have a console window up and running and if you hit Ctrl-F5, it will have the 'Press any key to continue' part.
This is just my way of doing things, and it works.
Btw, Anonymous Poster:
[edited by - Badone on December 21, 2002 9:13:55 PM]
2) Right click on Source Files in the Solution Explorer and then Add->Add New Item.
3) Choose 'C++ File(.cpp)' and type main in the Name box.
4) Type this in the source file:
#include <iostream>using namespace std;int main(){ cout<<"Hello world!"<<endl; return 0;}
***The using namespace std needs to be on a new line.
5) Hit Ctrl-F5 to run the program.
6) Click Yes on the message box that pops up to build the code.
7) You should have a console window up and running and if you hit Ctrl-F5, it will have the 'Press any key to continue' part.
This is just my way of doing things, and it works.
Btw, Anonymous Poster:
quote: Digigamer15, buy a damn book or ask Santa Clause for one.
quote: I was told I was supposed to use a win32 app by my books and tutorials so thats why I choose it.
[edited by - Badone on December 21, 2002 9:13:55 PM]
Just use VC++ 6, i like it better tha .net and i have never had any weird problems with it(mostly).
quote: Original post by Promit
There''s something wrong with including stdlib.h? I mean, I know VC6 auto-includes it, but I like to make it explicit include...ive been programming for so long and I never heard this. Damnit I never know anything >
In any case, can you explain what the difference is?
cstdlib is a part of the C++ Standard Library. AFAIK, there''s nothing evil about stdlib.h, but it does put its "stuff" in the global namespace, which is generally uncool in modern times.
VC6 auto-includes? It might be implied in including windows.h. What are you referring to?
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
[twitter]warrenm[/twitter]
quote: Original post by curtmax_0
Just use VC++ 6, i like it better tha .net and i have never had any weird problems with it(mostly).
All he has is .NET though. The .NET IDE is a lot better anyways. Code completion ALWAYS works now! The only thing I don''t like is the project properties are kind of hard to move through at times.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement