Qt Forum - programming with C++ and Qt
Register Calendar Members List Team Members Search Frequently Asked Questions Go to the Main Page

Qt Forum - programming with C++ and Qt » Job Forum » QtForum.org » Other Forums » commercial jobs » [cpp] help with c++ » Hello Guest [Login|Register]
Last Post | First Unread Post Print Page | Recommend to a Friend | Add Thread to Favorites
Post New Thread Post Reply
Go to the bottom of this page [cpp] help with c++
Author
Post « Previous Thread | Next Thread »
haelly
Assistant


Registration Date: 27.12.2007
Posts: 4
Location: LONDON

Level: 8 [?]
Experience: 565
Next Level: 674

109 points of experience needed for next level

[cpp] help with c++ Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

Read input from a data file rather than from the keyboard , add the account number and the customer name and phone to the set of data for each water bill.
Create a structure type invoice with the field for customer name(a character array of length 15), phone (a character array of length 13 to accommodate a three-digit area code , a dash, a three-digit exchange , another dash, and a four-digit number),account number (long) ,volume in gallons(double),and bill amount (double),and bill amount (double). Instead of parallel arrays for separate elements of the bill, use an array of Invoice structures bills[].
Create an input file using a ext editor .use an object of the library type fstream to open the file in the ios::in mode. Define the file name as a constant character array FIN[] , supply either a full fie name , e.g., “c\data\invoices.dat” , or default directory file name , e.g. , “invoices.dat”; to be able to use the default directory that your compiler uses as the default directory. After defining a file object , test whether the operation failed ; print a message and terminate the program if the file cannot be opened.
In the data file, place the data for each water bill on a separate line .Allocate enugh space for the customer name and phone number , e.g. 16 character and 14 characters , at the beginning of the line .Format account number and volume in columns. Here is an example of a short input file:

Smith 617-353-2566 101808 200
Brown 508-790-9313 102313 300
Black 212-517-6770 10541 400

In the infinite input loop, use get() to read up to 15 characters into a local character array name[]; break the loop I the operation raises the end of file indicator. Use operator >> to read data into local variables ‘phone’ , ‘account’ , and ‘gallons’. Use get() again to through away the new line character at the end of the line (|to avoid confusing get() when it is called again).Break the input loop when there is no more space in the array of invoice objects invoices[].
If the input is valid and the array space is available compute the amount of the bill , copy the character arrays, (use strcpy()) and numeric data into the appropriate element of the array invoices[].
Modify program output to accommodate additional data e.g.,

Name Phone Account Volume Amount
Smith 617-353-2566 101808 200.00 22.00
Brown 508-790-9313 102313 300.00 27.00
Black 212-517-6770 105411 400.00 32.00
Total

haelly has attached these images (downsized versions):
c5.jpg c51.jpg c52.jpg
c4.jpg

28.12.2007 17:38 haelly is offline Send an Email to haelly Search for Posts by haelly Add haelly to your Buddy List
krsmichael krsmichael is a male
Software Engineer


Registration Date: 27.04.2005
Posts: 30
Location: California

Level: 21 [?]
Experience: 33,445
Next Level: 38,246

4,801 points of experience needed for next level

RE: [cpp] help with c++ Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

How much does this job pay?
12.02.2008 05:37 krsmichael is offline Send an Email to krsmichael Search for Posts by krsmichael Add krsmichael to your Buddy List YIM Account Name of krsmichael: sd_bmwrider
macabre13 macabre13 is a male
Chief Software Engineer


images/avatars/avatar-423.jpg

Registration Date: 14.01.2008
Posts: 127
Location: Poland/ Wroclaw
Jabber: adamski.jaroslaw@jab ber.wroc.pl

Level: 18 [?]
Experience: 15,645
Next Level: 17,484

1,839 points of experience needed for next level

Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

And next, people wonder why London does not have a good software developers.

__________________
- ebm - noise - industrial -
I always could be wrong.
Lets share knowledge!
12.02.2008 10:02 macabre13 is offline Send an Email to macabre13 Homepage of macabre13 Search for Posts by macabre13 Add macabre13 to your Buddy List
stinos
CTO


Registration Date: 15.01.2006
Posts: 199

Level: 28 [?]
Experience: 169,538
Next Level: 195,661

26,123 points of experience needed for next level

Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

quote:
Originally posted by macabre13
And next, people wonder why London does not have a good software developers.


because the're unable to do their simple homework assignements

LOL

__________________
madinsjamania
13.02.2008 11:16 stinos is offline Send an Email to stinos Search for Posts by stinos Add stinos to your Buddy List
Tree Structure | Board Structure
Jump to:
Post New Thread Post Reply
Qt Forum - programming with C++ and Qt » Job Forum » QtForum.org » Other Forums » commercial jobs » [cpp] help with c++

views today: 9.327 | views yesterday: 17.520 | total views: 10.242.696


Klebekork Shop - Linux Shop - Kontaktanzeigen - Linux Forum -  SMS Gewinnspiel -  Hotels -  Stadtpläne -  Branchenbuch & Stadtplan

Branchenbuch Österreich - Branchenbuch Niederlande - Portugal Branchenverzeichnis - Spanien Branchenverzeichnis 
Telefonbuch - Branchenbuch Frankreich