Thread: c programming problem

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    3

    Smile c programming problem

    i am in need of some big time help..Need to write a program in C that allows me to display an octagon and its area on the output screen. This is a regular octagon ..each side is "a". Any help would be really appreciated!!!!! Pleaseeeeeeeeeeeeeeeeeee...help me.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    #include<stdio.h>
    int main ( void )
    {
        return printf("an octagon\nits area\n");
    }
    No one here is going to do your work for you. Post your code attempt. Post your problems you are encountereing, including any errors and warnings you get. Post what it is supposed to do, what it does, and what it doesn't do. Read the FAQ. Use code tags. Read the sticky threads.

    God I'm getting tired of saying that.

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

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    3
    hi..well I did make an attempt to print the octagon but I dont quite know how to do the spacing...and use the area function..which I did derive myself. I used two for loops..in order to print x's to make into an octagon...I need to put the thing together. Any help would be helpful!
    thanks!!!

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    > I used two for loops..in order to print x's to make into an octagon...
    Why do things the hard way?
    Code:
    #include <stdio.h>
    
    static char *octagon[] = {
      "   *****  ",
      "  ******* ",
      " *********",
      " *********",
      " *********",
      "  ******* ",
      "   *****  ",
      NULL,
    };
    
    int main ( void )
    {
      char **p = octagon;
    
      while ( *p != NULL )
        puts ( *p++ );
    
      return 0;
    }
    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM