-
C++ AND Dos
I am currently programming with Visual Basic but I am interested in learning C++. This is because I would like to try to start writing MSDOS programs. I was woundering if anyone had/ know where I can find an c++ program where it has the source files of basic functions (like Windows, Buttons, etc.) in dos. Not alot of extra stuff, because I want to learn from example. Any help will be awsome.
-
just to let you know, VC++ can't make DOS apps.
-
First program in C++ :)
PHP Code:
#include <windows.h>
#include <iostream.h>
int main()
{
int x;
x = 90 / 10;
cout << "Hello World!!!\n 90/10 = " << x;
}
-
Learning from examples is only efficient once you've read a book.
-
try planetsourcecode, they have both source and tutorials......
here's the address:
http://www.planetsourcecode.com/xq/A...vb/default.htm
made_of_asp,
why do you have to include the windows.h-file? it's not necessary in that example.....
-
Quote:
Originally posted by made_of_asp
First program in C++ :)
PHP Code:
#include <windows.h>
#include <iostream.h>
int main()
{
int x;
x = 90 / 10;
cout << "Hello World!!!\n 90/10 = " << x;
}
A few things:
1. No need for windows.h (as stated)
2. Use iostream, not iostream.h. This means you'll need to bring in the std namespace. Complicated, but that's the way the standard goes.
3. You need to return a value from main.
4. You didn't put a newline at the end of your output statement so anything after it (including the DOS / command prompt) will end up on the same line.
-
Thanks parskie for corrections but i always use windows.h and iostream.h and the testing project is small anyway so new line isnt required.
-
You're missing my point.
Using iostream.h is officially the Wrong Way To Do It.
-
Sorry but i dont know the difference between
#include <iostream>
using namespace std;
and
#include <iostream.h>
to me they work the same
-
They're supposed to work the same. They're just implemented differently.
The newer library is based around templates, which simplifies a lot of things. However, the way you use it is more or less identical. For now, use the new one...you'll eventually work out the differences but it's pretty tricky unless you've been doing it for ages.