Thread: Line

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    6

    Question creating a fractal in C++ console mode

    How would I make lines etc in console mode (I'm using Microsoft VC++)
    Last edited by speedy; 10-25-2001 at 08:40 AM.

  2. #2
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    This should work for horizontal lines. Where \xCD is the hex value for = in the ascii table. You would need to watch for overflow though.

    #include <iostream.h>

    int main()
    {
    int line;

    for(line = 1; line <= 10; line++)
    cout << "\xCD";

    return 0;
    }
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    6

    Talking Thanksx

    hey thanks!

  4. #4
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    NP I've been working on that very thing myself. I've got a crude method of drawing lines as well, but it needs work in 32 bit compilers like VC 6. It causes the blue screen of death... likely cause is the regs or data type for the pointer, but I'm working on it. It *works* ok in 16 bit compilers though.

    #include <iostream.h>

    int main()
    {
    int line;

    char *xrow, *ycol;

    xrow = 0;
    ycol = 0;

    for(line = 1; line <=20; line++)
    {


    _asm
    {
    xor bh,bh
    mov dh,BYTE PTR xrow
    mov dl,BYTE PTR ycol
    mov ah,2
    int 10h

    mov dl,'.' // or \xXX hex code for ascii
    mov ah,02
    int 21h

    }


    xrow = xrow + 1; // adjust increment of row
    ycol = ycol + 1; // adjust increment of col
    }

    return 0;
    }
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to do encryption in C
    By sankarv in forum C Programming
    Replies: 33
    Last Post: 12-28-2010, 11:01 AM
  2. Reading a file line by line
    By Raskalnikov in forum C Programming
    Replies: 8
    Last Post: 03-18-2009, 11:44 PM
  3. Pointer and Polymorphism help.
    By Skyy in forum C++ Programming
    Replies: 29
    Last Post: 12-18-2008, 09:17 PM
  4. Printing Length of Input and the Limited Input
    By dnguyen1022 in forum C Programming
    Replies: 33
    Last Post: 11-29-2008, 04:13 PM
  5. Finding carriage returns (\c) in a line
    By JizJizJiz in forum C++ Programming
    Replies: 37
    Last Post: 07-19-2006, 05:44 PM