Results 1 to 10 of 10

Thread: C++ AND Dos

  1. #1

    Thread Starter
    Member davethebrat's Avatar
    Join Date
    Jul 2001
    Location
    Buffalo, NY
    Posts
    51

    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.

  2. #2
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    just to let you know, VC++ can't make DOS apps.

    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
    USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA

  3. #3
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    First program in C++

    PHP Code:
    #include <windows.h>
    #include <iostream.h>

    int main()
    {
    int x;
    90 10;

    cout << "Hello World!!!\n 90/10  = " << x;

    VS.NET 2003

    Need to email me?

  4. #4
    Hyperactive Member
    Join Date
    Aug 2001
    Posts
    484
    Learning from examples is only efficient once you've read a book.

  5. #5
    Addicted Member
    Join Date
    Aug 2001
    Location
    I'm mobile
    Posts
    166
    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.....
    [p r a e t o r i a n]

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Originally posted by made_of_asp
    First program in C++

    PHP Code:
    #include <windows.h>
    #include <iostream.h>

    int main()
    {
    int 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.
    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

  7. #7
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    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.
    VS.NET 2003

    Need to email me?

  8. #8
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You're missing my point.

    Using iostream.h is officially the Wrong Way To Do It.
    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

  9. #9
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394

    Unhappy

    Sorry but i dont know the difference between

    #include <iostream>
    using namespace std;

    and

    #include <iostream.h>

    to me they work the same
    VS.NET 2003

    Need to email me?

  10. #10
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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.
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width