C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 22nd, 2012, 02:57 AM
GN22 GN22 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 GN22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 5 sec
Reputation Power: 0
Confused on structs and arrays

I'm supposed to write a program that is able to save a list of items such as books, CDs, or DVDs. The items that are saved must have attributes associated with them. For example a book has a title, author, publisher, and ISBN.
I'm supposed to create a program that is able to save the database of items to a file on the hard drive and also retrieve it from the hard drive.

The user should be able to

1. Enter items
2. Display a list of the items
3. Save the list to disk
4. Read the list from disk
5. Sort the list
6. Exit the program

I know I should use arrays and structs but can anyone give me a head start?

Reply With Quote
  #2  
Old November 22nd, 2012, 03:20 AM
MrFujin's Avatar
MrFujin MrFujin is offline
Lord of the Dance
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Oct 2003
Posts: 3,129 MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 22 h 8 m 32 sec
Reputation Power: 1736
Start with number 1 first.

Can you be more specific what you need help with? e.g. do you know how to get input from user? how to create a structure/array?

Have you tried anything? then post the code you have.

Reply With Quote
  #3  
Old November 22nd, 2012, 04:23 AM
GN22 GN22 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 GN22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 5 sec
Reputation Power: 0
So far I only have

<iostream>
<fstream>
#include
using namespace std;

int main()
{


fstream file;
file.open("file.dat", ios::in);

}

So pretty much I have nothing. I don't know what my first step should be. How do I create a .dat file?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Confused on structs and arrays

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap