-
(solved) C++, dos?
Hey
I just started programming c++ and I have a very stupid question (I think)
All my programs are dos, is this suppose to be in dos?
I have this code and it opens a dos window,
Code:
#include <iostream.h>
void odd (int a);
void even (int a);
int main ()
{
int i;
do {
cout << "Type a number: (0 to exit)";
cin >> i;
odd (i);
} while (i!=0);
return 0;
}
void odd (int a)
{
if ((a%2)!=0) cout << "Number is odd.\n";
else even (a);
}
void even (int a)
{
if ((a%2)==0) cout << "Number is even.\n";
else odd (a);
}
Any Idea? Thanks
-
It's suppose to be dos unless you create specific win32 api programs or mfc programs. When you choose to create a program in msvc++ for example you chose win32 console program right? And when you write the program it's a dos-prog because you haven't written any code that specifies it to create a window or something else.
If you want windows programs you have to write code that creates windows for you or use mfc appwizards that does this for you. Have a look at www.winprog.org
good luck!
-
ok thanks. I'll go to that link of you:)
-
It's a good website, so check it out! Look at the resources too!
-
Note this:
Win32 Console Applications are just that - Win32 consoles.
They are not DOS. They're fully 32-bit, and can access all the Windows features (for example, MessageBox).
This is useful for debugging because you can still create windows from them, but you can output loads of stuff to the console as well:
Code:
HWND hWnd = CreateWindow(...);
if(!hWnd) {
cout << "Window creation failed" << endl;
return -1;
} else {
cout << "Window handle: " << (LONG_PTR)hWnd << endl;
}
-
Thanks Kings, for giving me this URL!