what#include files do i use?

This is a discussion on what#include files do i use? within the C++ Programming forums, part of the General Programming Boards category; im looking at one of the tutorials, under tutorials circle and line algorithms, vga trainer program, on this site. my ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    98

    what#include files do i use?

    im looking at one of the tutorials, under tutorials circle and line algorithms, vga trainer program, on this site. my question is, what include files do i use to make the c++ program work in his example?i included <iostream>, that fixed one error, but there are 2 more, `round`: undeclared identifier and 'Putpixel' : undeclared identifier. i believe there is a # include file for graphics or something to make it work.thanks

  2. #2
    Registered User foniks munkee's Avatar
    Join Date
    Nov 2001
    Posts
    343
    C++ itself does not include a graphics library - this is generally implementation specific.

    What OS / Compiler are you using?
    "Queen and huntress, chaste and fair,
    Now the sun is laid to sleep,
    Seated in thy silver chair,
    State in wonted manner keep."

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    98
    windows 2000 and ms visual studio 6

  4. #4
    Registered User foniks munkee's Avatar
    Join Date
    Nov 2001
    Posts
    343
    This topic is probably more relevant in the windows forum, however try

    #include <windows.h>

    I presume you are using the windows GDI - even so I would have expected more errors than this if you are writing a windows app and have not included windows.h already.

    If you are still having problems could you post some code and just a description of what it is your trying to do.
    "Queen and huntress, chaste and fair,
    Now the sun is laid to sleep,
    Seated in thy silver chair,
    State in wonted manner keep."

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    98
    <code>

    # include<iostream>


    int sgn (long a) {

    if (a > 0) return +1;

    else if (a < 0) return -1;

    else return 0;



    }



    void Line(int a, int b, int c, int d, int col) {



    long u,s,v,d1x,d1y,d2x,d2y,m,n;

    int i;



    u = c-a;

    v = d-b;

    d1x = sgn(u);

    d1y = sgn(v);

    d2x = sgn(u);

    d2y = 0;

    m = abs(u);

    n = abs(v);



    if (m<=n) {

    d2x = 0;

    d2y = sgn(v);

    m = abs(v);

    n = abs(u);

    }



    s = (int)(m / 2);



    for (i=0;i<round(m);i++) {

    Putpixel(a,b,col);

    s += n;

    if (s >= m) {

    s -= m;

    a += d1x;

    b += d1y;

    }

    else {

    a += d2x;

    b += d2y;

    }

    }



    }
    </code>

  6. #6
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    I didn't read the whole code, but abs() is defines in cmath or math.h if you want...

    and to use the tags you shoud use the squared brackets []...
    none...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. add source files to embedded VC 4.0
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 03:28 AM
  2. *.cpp and *.h files understanding
    By ElastoManiac in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2006, 04:45 AM
  3. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 10:46 AM
  4. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 01:41 PM
  5. header and source files
    By gtriarhos in forum C Programming
    Replies: 3
    Last Post: 10-02-2005, 03:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21