Thread: simple programming issue!

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    18

    Question simple programming issue!

    I am trying to make a program where the powers show up in table format and cant seem to get it right! this is what I have so far:

    int main(void)
    {
    int n;

    printf(" \tA Table of Powers\t \n");
    printf("Integer\t\tSquare\t\3rd power\t4th power\t5th power\n");
    printf("--------\t--------\t--------\t--------\t/n");

    for (n=1; n<=4; ++n);


    any help?!

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I suppose you should count (1) the number of columns you have (2) the number of \t characters you use (3) the number of -------- things you have. Once you have the headers set, then you need to print your data keeping your \t's in mind.

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    18
    im not sure about what to put in after the last ";" Its the printing the data that has me all mixed up for some reason.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You have five numbers you want to print, so print them.

  5. #5
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    nb. this
    Code:
    for (n=1; n<=4; ++n);
    does not do anything.

    ps. read this
    << !! Posting Code? Read this First !! >>
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  6. #6
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by MK27 View Post
    nb. this
    Code:
    for (n=1; n<=4; ++n);
    does not do anything.

    ps. read this
    << !! Posting Code? Read this First !! >>
    Sure it does, but:
    Code:
    n = 5;
    is what I'd use

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with probably a very simple char sting issue
    By Prometheus in forum C++ Programming
    Replies: 14
    Last Post: 01-10-2007, 08:02 PM
  2. Simple issue but I am STUCK
    By jedispy in forum C++ Programming
    Replies: 2
    Last Post: 12-01-2006, 02:02 AM
  3. ...deceptively simple...
    By Sebastiani in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 07-29-2002, 12:51 PM
  4. Need help with simple DAQ program
    By canada-paul in forum C++ Programming
    Replies: 12
    Last Post: 03-15-2002, 08:52 AM
  5. How can I issue AT commands in VC++ ?
    By Cube in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 10-10-2001, 07:45 AM

Tags for this Thread