PART 1 of my Project:Using turbo c++ 4.5, and I'm very new to Programming, i'm not good
1. I made a program which stores 100 records please check if it's right.
2. I want to read each line into an array. I want to use a struct or what they call a struct array but i'm not yet familiar with it so I'm confused...I can't seem to figure out how would I read this .txt file and then store the data on the struct array.
I would like to read the txt file at the very first line of void main()
0001 Apples Fruits 35.00
0002 Banana Fruits 20.00
0003 Grapes Fruits 55.00
0004 Kiwi Fruits 60.00
0005 Lemon Fruits 50.00
0006 Batteries Misc 30.00
0007 Charcoal Misc 15.50
0008 Flashlight Misc 50.00
0009 Catsup Condiments 30.00
0010 SoySauce Condiments 20.00
0011 Vinegar Condiments 20.00
0012 GravyMix Condiments 35.00
0013 Curry Condiments 20.25
0014 Candy Snacks 20.00
0015 Cookies Snacks 40.00
0016 Gelatin Snacks 20.00
0017 Graham Snacks 35.00
0018 PotatoChips Snacks 20.00
0019 Chicken Meat 150.00
0020 Hotdog Meat 90.00
0021 GroundBeef Meat 170.00
0022 Pork Meat 180.00
0023 Cereal Breakfast 70.00
0024 Oatmeal Breakfast 50.00
0025 PancakeMix Breakfast 50.00
0026 Beer Drinks 30.25
0027 Champagne Drinks 85.50
0028 Coffee Drinks 20.00
0029 DietSoda Drinks 20.00
0030 BathSoap Hygiene 27.50
0031 HandSoap Hygiene 34.00
0032 HairSpray Hygiene 50.00
0033 Lotion Hygiene 55.00
0034 BrownRice Pasta&Rice 60.00
0035 Lasagna Pasta&Rice 75.00
0036 Spaghetti Pasta&Rice 75.00
0037 Cabbage Vegetable 40.00
0038 Eggplant Vegetable 30.00
0039 Tomato Vegetable 20.00
0040 Squash Vegetable 45.00
0041 Lettuce Vegetable 45.00
0042 Yoghurt Dairy 40.00
0043 Butter Dairy 25.00
0044 IceCream Dairy 199.00
0045 Milk Dairy 37.00
0046 Cheese Dairy 30.00
0047 Bleach Cleaning 20.00
0048 Sponges Cleaning 50.00
0049 Dishwashing Cleaning 30.00
0050 FabCon Cleaning 20.00
-the text file is long so I was thinking of reading it by using for loop/s...I tried and tried but failed miserably...
RonKevin 0 Newbie Poster
RonKevin 0 Newbie Poster
np complete 8 Newbie Poster
RonKevin 0 Newbie Poster
np complete 8 Newbie Poster
RonKevin 0 Newbie Poster
np complete 8 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.