Thread: format printf

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    6

    format printf

    How can I format the output of printf to display results below.

    Product # Type Description Quantity cost price profit

    1211 3 c is fun 2 1.14 2.99 1500


    printf(“ “);
    number,.type, description ,quanity,
    cost, price, profit");


    thanks

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Code:
    char* MyString;
    int MyInteger;
    char MyCharacter;
    float MyFloat;
    
    printf("String: %s, Integer: %d, Character %c, Float: %f", MyString, MyInteger, MyCharacter, MyFloat);
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    man printf

    or google for man pages.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. multiply sections of printf format specifier?
    By space_ferret in forum C Programming
    Replies: 14
    Last Post: 03-27-2009, 10:54 AM
  2. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  3. Have a few minor problems trying to finish this program
    By kisiellll in forum C Programming
    Replies: 4
    Last Post: 02-22-2009, 07:00 PM
  4. Drawing tables in C
    By stanoman in forum C Programming
    Replies: 5
    Last Post: 10-09-2003, 10:14 AM
  5. Azbia - a simple RPG game code
    By Unregistered in forum Game Programming
    Replies: 11
    Last Post: 05-03-2002, 06:59 PM