[prog] Re: C++
wolf
wolf at wolfrising.net
Fri Mar 12 22:24:08 EST 2004
Could anyone help me along with getting this to work? Here's the
original question I'm trying
to figure out:
> write a simple program to track an individual's cd library, the
> program should permit the user to enter 10 cds. Each cd
> should contain the following items: artist, album title, year and
> genre. the program should display all the cds in order
> by artist. design a class and represent each album as an object of
> that class. provide the capability to store the data
> in a text file and retrieve it again the next time the program is run.
#include <iostream>
using namespace std;
class cdlib
{
char artist[30];
char title[50];
int yr;
char genre[10];
public:
void getdata();
void showdata();
void putdata();
};
int main()
{
int cd;
/* get the data from the user and write it down to a text file. use
cin */
while (cd < 10)
{
cout << "Enter the Artist's Name: "<< endl;
cin >> artist;
cout << "Enter the Compact Disk Title: " << endl;
cin >> title;
cout << "Enter the Year the CD was recorded: "<< endl;
cin >> yr;
cout << "Enter the genre for this CD: " << endl;
cin >> genre;
}
return 0;
}
/* to put data into the file fopen, fwrite */
putdata()
}
getdata()
{
/* Read the data from the file fopen. fread */
return data;
}
More information about the Programming
mailing list