|
-
Dec 1st, 2001, 04:02 PM
#1
Thread Starter
Fanatic Member
(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
Last edited by Kings; Dec 1st, 2001 at 04:29 PM.
K i n g s
-
Dec 1st, 2001, 04:19 PM
#2
Addicted Member
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!
-
Dec 1st, 2001, 04:27 PM
#3
Thread Starter
Fanatic Member
ok thanks. I'll go to that link of you
-
Dec 1st, 2001, 05:15 PM
#4
Addicted Member
It's a good website, so check it out! Look at the resources too!
-
Dec 2nd, 2001, 09:13 AM
#5
Monday Morning Lunatic
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;
}
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jul 30th, 2002, 05:01 PM
#6
New Member
Thanks Kings, for giving me this URL!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|