Thread: Help with C strings

  1. #1
    Registered User
    Join Date
    Mar 2015
    Posts
    2

    Help with C strings

    Trigg Industries uses invoices to bill customers for goods purchased. Trigg currently has an order program which takes order information, but it does not produce the invoices required to bill customers.
    The billing program does produce an output file with the invoice information, however, it does not total each invoice, and the formatting is not very intuitive for humans to read. the output from the billing program is in the following format:
    invoiceno,customerid,itempartno,itemdescription,it emcost,itemquantity
    where
    invoiceno is the invoice number (an integer )
    customerid is the customer number (a string of at most 20 characters)
    itempartno is the part number for the item (an integer)
    itemdescription is a description of the item (a string of up to 20 characters)
    itemcost is the cost of the item (a dollar value)
    itemquantity is the number of items ordered.
    Your job is to write a program which produces the invoices, with totals, from the input file. The format of the output file is shown in the examples.
    Note: The file may contain more than one invoice. Your output file should contain a separation line between each invoice.
    An Example input file appears as follows:
    --begin sample input--
    1234,ABC123,234,Widgets,2.00,101234,ABC123,221,Springs,1.00,201235,CDF45,228,Gears,1.50,10--end sample input--
    The output produced from the above should be (the first two lines are shown for
    spacing purposes. These are not required in your output):
    --begin sample output--12345678901234567890123456789012345678901234567890 12345678901234567890123456789000000000011111111112222222222333333333344444444444 555555555566666666667777777778
    --------------------------------------------------------------------------------
    Trigg Industries
    Invoice: 1234 Customer: ABC123 Date: 10/26/2009
    --------------------------------------------------------------------------------
    Item No. Description Unit Cost Quantity Subtotal
    234 Widgets 2.00 10 20.00
    221 Springs 1.00 20 20.00
    --------------------------------------------------------------------------------
    Total Due: 40.00
    --------------------------------------------------------------------------------

    Trigg Industries Invoice: 1235 Customer: CDF45 Date: 10/26/2009
    --------------------------------------------------------------------------------
    Item No. Description Unit Cost Quantity Subtotal

    228 Gears 1.50 10 15.00
    --------------------------------------------------------------------------------
    Total Due: 15.00
    --end of sample output
    --Use redirection to direct the input from the input file and to direct the output to the output file.
    Last edited by Phuc Pham; 03-23-2015 at 04:39 PM.

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    What exactly do you need help with? I just see an assignment dump here. Homework Policy.

    Post your code, in code tags, and ask specific questions about what you're having trouble with.

  3. #3
    Registered User
    Join Date
    Mar 2015
    Posts
    2
    Im done nevermind. Mod can close this

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-16-2012, 06:08 AM
  2. Swapping strings in an array of strings
    By dannyzimbabwe in forum C Programming
    Replies: 3
    Last Post: 03-03-2009, 12:28 PM
  3. malloc() strings VS array strings
    By Kleid-0 in forum C Programming
    Replies: 5
    Last Post: 01-10-2005, 10:26 PM
  4. Table mapping Strings to Strings
    By johnmcg in forum C Programming
    Replies: 4
    Last Post: 09-05-2003, 11:04 AM
  5. converting c style strings to c++ strings
    By fbplayr78 in forum C++ Programming
    Replies: 6
    Last Post: 04-14-2003, 03:13 AM