right align

This is a discussion on right align within the Linux Programming forums, part of the Platform Specific Boards category; I have finished my code but want to right align my text. I have looked everywhere but can't find out ...

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

    Question right align

    I have finished my code but want to right align my text. I have looked everywhere but can't find out how. here it is...
    Code:
    #include<stdio.h>
    
    #define MAX_N 10
    #define MAX_P 5
    /*
    *       Main function
    */
    
    int main()
    {
            {
            printf("::::    \tTable of Powers\t    ::::\n");
       printf("Integer Square 3rd power4th power5th power\n");
       printf("-----\t-----\t-----\t-----\t-----\n");
            }
    
    int tab[MAX_N + 1][MAX_P + 1];
    int N, P;
    
    for (N = 1; N <= MAX_N; N++)
       {
            tab [N][0] = 1;
            for (P = 1; P <= MAX_P; P++)
            tab[N][P] = N * tab[N][P - 1];
        }
            for (N = 1; N <= MAX_N; N++)
        {
            for (P = 1; P <= MAX_P; P++)
            printf ("%6d ", tab[N][P]);
            printf ("\n");
         }
            return 0;
    }

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    You should type man 3 printf at your terminal and read what it says back.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. right align
    By major_small in forum C++ Programming
    Replies: 6
    Last Post: 05-10-2009, 08:20 PM
  2. align syntax
    By mynickmynick in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2008, 05:54 AM
  3. Using TextOut() to align positive & negative numbers
    By csonx_p in forum Windows Programming
    Replies: 4
    Last Post: 05-27-2008, 08:12 AM
  4. Left Align
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 04-29-2002, 08:47 PM
  5. how to align text?
    By kuyajay in forum C++ Programming
    Replies: 3
    Last Post: 02-22-2002, 02:51 AM

Tags for this Thread


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