#include <stdio.h> 

#define SIZE 3
#define NAMESIZE 20

struct president 
{ 
    char name [NAMESIZE]; 
}; 

int main () 
{ 
    int i; /* loop index */ 

    /* These are my three favorite presidents */ 
    struct president myPresidents [SIZE] = { 
        {"Ronald Reagan"}, 
        {"George Washington"}, 
        {"Thomas Jefferson"} 
    }; 

    printf ("\nPrint whatever size the names are, Left Justified \n"); 
    for (i = 0; i < SIZE; ++i ) 
    { 
        printf ("%s\n", 
        myPresidents[i].name); 
    } 

    printf ("\n\nTake up a minimum of 20 spaces, Right Justified \n"); 
    for (i = 0; i < SIZE; ++i ) 
    { 
        printf ("%20s\n", 
        myPresidents[i].name); 
    } 

    printf ("\n\nTake up a minimum of 10 spaces, pad as needed, Left Justified \n"); 
    printf ("... if name is longer, it will still print all characters\n"); 
    for (i = 0; i < SIZE; ++i ) 
    { 
        printf ("%-10s\n", 
        myPresidents[i].name); 
    } 

    printf ("\n\nPrint a maximum of 15 characters, pad if needed, Left Justified,"); 
    printf ("\n... this is good if you need to limit a field size being displayed \n"); 
    for (i = 0; i < SIZE; ++i ) 
    { 
        printf ("%-15.15s\n", 
        myPresidents[i].name); 
    }
    
    printf ("\n\nPrint 20 characters, pad with spaces if needed, Left Justified,"); 
    printf ("\n... this is good if you need to display all characters, \n");
    printf ("\nand really useful in lining up items in a table format. \n");
    for (i =  0; i < SIZE; ++i ) 
    { 
        printf ("%-20.20s\n", 
        myPresidents[i].name); 
    } 

    return (0); 
}