3 Replies - 3979 Views - Last Post: 04 May 2010 - 11:29 AM Rate Topic: -----

#1 jerimiah  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-May 10

Reading fields from a text file into a vector into a STL list Containe

Posted 04 May 2010 - 11:05 AM

I need some sample C++ code to understand how to read from a text file into a vector to use in a stl list container...can anybody help


Read the scholarship information from the database (flat file).
Add new records to the database.
Delete existing records from the data base
List all the records in the data base.
Print report of scholarship amounts (with totals).
Date First Name Last Name Scholarship Amount

10/15/95 Melissa Randall Music $ 1,000.00
10/16/95 Robert Brown Science $ 500.00
10/17/95 Mary Crow Business $ 100.00
10/18/95 Terrisa Mann Athletics $ 200.00
11/1/95 William Gentry Fine Arts $ 700.00
11/3/95 Betty Bolton Business $ 3,000.00
11/7/95 Jesse Ramos Athletics $ 750.00
11/10/95 Wanda Granhame Music $ 100.00
11/22/95 Lynn Wong Science $ 2,000.00
11/28/95 Susan Lopez Science $ 5,000.00
------------------------------------------------------------
Total Donations: $11,350.00

(optional)Print sorted records (sort by any field in data base).
End program and update data base files.

Build a linked list from the data in the file:

A list of all the fields in the database.
o Date of donation
o Donor first name
o Donor last name
o Scholarship name
o Amount of donation

Is This A Good Question/Topic? 0
  • +

Replies To: Reading fields from a text file into a vector into a STL list Containe

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Reading fields from a text file into a vector into a STL list Containe

Posted 04 May 2010 - 11:17 AM

Sorry but we can not give you the entire code to solve your problem. We are here to assist in solving problems with code you have written, with any error messages you are getting or what isn't working the way that you expect it to, we would be more than happy to help you with those problems. If there is a topic that you don't understand we would be more than happy to help you with that as well. Make sure to post any code with in code tags like below.

:code:

Be sure to visit our tutorial and snippet areas or read the FAQS at the top of the forums. Also, take a moment to read the rules about posting topics.

Thank you for helping us to help you solve your problem.
Was This Post Helpful? 0
  • +
  • -

#3 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1432
  • View blog
  • Posts: 4,968
  • Joined: 19-February 09

Re: Reading fields from a text file into a vector into a STL list Containe

Posted 04 May 2010 - 11:23 AM

You probably want to use struct which is often used for database records.

Structures inside STL List

list::push_back
Was This Post Helpful? 0
  • +
  • -

#4 Anarion  Icon User is offline

  • The Persian Coder
  • member icon

Reputation: 309
  • View blog
  • Posts: 1,511
  • Joined: 16-May 09

Re: Reading fields from a text file into a vector into a STL list Containe

Posted 04 May 2010 - 11:29 AM

There is an awesome tutorial by Bench at [Here] ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1