Thread: How to draw points?

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    21

    How to draw points?

    The thing is that i've got to make a program for school to calculate distances between points and the shortest way and all that. But i would like to add a function to draw the points like a graphic and so. how can i do it? i don't have a clue because all we've done so far is dos-based programs

  2. #2
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    If you don't want to include libraries take a look at this faq . It shows you how to format output. Especially look here
    Code:
    #include <stdio.h> 
    
    int main ( void )
    {
      printf ( "%5d\n", 123 );      /* Prints "  123" */
      printf ( "%*d\n", 5, 123 );   /* Prints "  123" */
      printf ( "%+05d\n", 123 );    /* Prints "+0123" */
      printf ( "%x\n", 123U );      /* Prints "7b" */
      printf ( "%#x\n", 123U );     /* Prints "0x7b" */
      printf ( "%#X\n", 123U );     /* Prints "0X7B" */
      printf ( "%-10.2f\n", 12.3 ); /* Prints "12.30" */
      printf ( "%10.2f\n", 12.3 );  /* Prints "     12.30" */
      printf ( "%lu\n", 123UL );    /* Prints "123" */
      printf ( "%s\n", "Testing" ); /* Prints "Testing" */
      printf ( "%c\n", 'A' );       /* Prints "A" */
    
      return 0;
    }
    Then you could use --- and ||| for the streets/paths.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Or did you mean something like The Bresenham Line Drawing Algorithm? Search engines are quite handy.

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User
    Join Date
    Jan 2004
    Posts
    21
    Yes, something like that, althoug it seem rather dificult. I haven't got many programming knowledge.

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I haven't got many programming knowledge.
    Then you shouldn't try to write graphics programs yet. Learn to flap your wings before you jump off the branch.
    My best code is written with the delete key.

  6. #6
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >Learn to flap your wings before you jump off the branch.
    That would explain the large bump on my head.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help it won't compile!!!!!
    By esbo in forum C Programming
    Replies: 58
    Last Post: 01-04-2009, 03:22 PM
  2. Replies: 8
    Last Post: 11-03-2008, 09:48 PM
  3. Yahtzee C++ programme help
    By kenneth_888 in forum C++ Programming
    Replies: 13
    Last Post: 09-05-2007, 02:14 PM
  4. CProg Fantasy Football version pi
    By Govtcheez in forum A Brief History of Cprogramming.com
    Replies: 155
    Last Post: 12-26-2006, 04:30 PM
  5. Draw Line Between Two Points
    By Shadow12345 in forum C++ Programming
    Replies: 4
    Last Post: 05-18-2002, 08:23 AM