老师布置的课程设计做到这里不知道怎么写了大家先看看题目Video Rental Store Management Information System(影像资料管理信息系统)
Suppose your parents are thinking of opening a video rental store, they ask you to write a program to handle their inventory.
First, decide the major objects in a rental store (items to be rented and the people who rent them). You begin with the abstraction of the items to be rented – videotapes.
Secondly, write a program to do the following tasks:
Create a list of video objects.
Search the list for a particular title.
Determine if there are any copies of a particular video currently in the store.
Print the list of video titles.
Thirdly, determine the characteristics of the customer and define a customer object. Write the operations and test them. Using this representation of a customer, write a program to do the following tasks:
Create a list of customers.
Search the list by customer name.
Search the list by customer identification number.
Print the list of customer names.
Fourthly, Combine the list of video objects and the list of customer objects into a program with the following capabilities:
Check out a video.
Check in a video.
Determine how many videos a customer has (by customer identification number).
Determine which customers have a certain video checked out (by title).(Hint: Create a hasVideo object that has a video title and a customer number.)
我是这样想的先设计一个光盘类文件,把光盘信息输入到文本文件中把借阅人的信息输入到文本文件中最后做一个联结输出文件可我做到第二步就不知道怎么办好了我的程序如下:#include <tchar.h>
#include <string>
#include <iostream>
#include <time.h>
#include <fstream>using namespace std;ofstream fout;enum mainIdVideos{PopMusic=1,CustomMusic};
enum indexIdVideos{Pop=1,Custom};void reverse( const char *const sPtr )
{
if ( sPtr[ 0 ] == '\0' )
return;
else {
reverse( &sPtr[ 1 ] );
putchar( sPtr[ 0 ] );
}
}struct person{
string Name;
int Id;
};class CBoyGirl
{
public:
CBoyGirl(void);
~CBoyGirl(void);
public:
void BoyGirlInfo();
private:
person People;
};class COneVideo
{
public:
COneVideo(void);
~COneVideo(void);
bool videoInitialize(char[10],int,char[6],char);
bool videoInput(char[10],int,char[6],char);
bool videoOuput(char[10],int,char[6],char);
private:
struct video{
char Name[10];//设置光盘名称
char ID[5];//设置光盘ID,由两部分组成,主类(2位数字)从位(3位数字) 如0110代表流行音乐中得Love光盘
char videoInfo[500];//设置光盘信息,不超过500字
int number;
struct DATE{
int year;
int month;
int day;
} date;
//设置光盘采集日期
};
};CBoyGirl::CBoyGirl(void)
{
}CBoyGirl::~CBoyGirl(void)
{
}void CBoyGirl::BoyGirlInfo()
{
cout<<"Please input Boy's or Girl's Name"<<endl;
cin>>People.Name;
People.Id++;
}
COneVideo::COneVideo(void)
{
}COneVideo::~COneVideo(void)
{
}
bool COneVideo::videoInitialize(char[10],int,char[6],char)
{
return true;
}
bool COneVideo::videoInput(char[10],int,char[6],char)
{
/*在次需要确定一个判断语句,以此确定是否还有新书加入其中*/
cout<<"Please input the name of the video"<<endl;
video video;
gets( video.Name );
// modify
string tmp(video.Name);
//reverse(tmp.begin(),tmp.end());
reverse( video.Name );
// modify over
strcpy(video.Name,tmp.c_str());
cout<<"Please input the number of the video"<<endl;
cin>>video.number;
cout<<"Please input the main id of the video"<<endl;
enum mainIdVideos mainIdVideo;
const char *mainIdVideoId[]={"","PopMusic","CustomMusic"};
int mainId,indexId;
for(mainIdVideo=PopMusic;mainIdVideo<=CustomMusic;mainIdVideo=mainIdVideos(mainIdVideo+1))
cout<<mainIdVideo<<" stand for"<<mainIdVideoId[mainIdVideo]<<endl;
cin>>mainId;
cout<<"Please input the index id of the video"<<endl;
enum indexIdVideos indexIdVideo;
const char *indexIdVideoId[]={"","A","B"}; for(indexIdVideo=Pop;indexIdVideo<=Custom;indexIdVideo=indexIdVideos(indexIdVideo+1))
cout<<indexIdVideo<<" stand for "<<indexIdVideoId[indexIdVideo]<<endl;
cin>>indexId;
// modify
char sz[5];
itoa(mainIdVideo,sz,10);
strcpy(video.ID,sz);
itoa(indexIdVideo,sz,10);
strcat(video.ID,sz);// 此处需要进行缓冲区溢出检查,我没做
//video.ID="mainIdVideo"+"indexIdVideo";
cout<<"Please input the videoinfo of the video"<<endl;
gets( video.videoInfo );
reverse(video.videoInfo);
cout<<"Please input the buy data(year mouth day) of the video,Enter number 1 means now ,enter 2 means what you input"<<endl;
int number;
tm time;
time_t t;
t=_getsystime(&time);
cin>>number;
switch (number){
case 1:
cin>>video.date.year;
cin>>video.date.month;
cin>>video.date.day;
break;
default:
video.date.year=time.tm_year-100;
video.date.month=time.tm_mon+1;
video.date.day=time.tm_mday;
break;
}
FILE *cfPtr = fopen( "Video.txt", "a+" );
if ( cfPtr == NULL ){//a+代表追加文件记录
cout<<"File could not be opened"<<endl;
}
else {
cout<<video.Name<<video.number<<video.ID<<video.date.year<<video.date.month<<video.date.day<<endl;
fclose(cfPtr);
}
return true;
}bool COneVideo::videoOuput(char[10],int,char[6],char)
{
return true;
}int _tmain(int argc, _TCHAR* argv[])
{
COneVideo Video;
char tmp10[10];
tmp10[0] = 0;
int i = 0;
char tmp6[6];
tmp6[0] = 0;
char t = 0;
Video.videoInput(tmp10,i,tmp6,t);
CBoyGirl BG;
BG.BoyGirlInfo();
return 0;
}
还有不少的问题
大家帮忙看看好吗
Suppose your parents are thinking of opening a video rental store, they ask you to write a program to handle their inventory.
First, decide the major objects in a rental store (items to be rented and the people who rent them). You begin with the abstraction of the items to be rented – videotapes.
Secondly, write a program to do the following tasks:
Create a list of video objects.
Search the list for a particular title.
Determine if there are any copies of a particular video currently in the store.
Print the list of video titles.
Thirdly, determine the characteristics of the customer and define a customer object. Write the operations and test them. Using this representation of a customer, write a program to do the following tasks:
Create a list of customers.
Search the list by customer name.
Search the list by customer identification number.
Print the list of customer names.
Fourthly, Combine the list of video objects and the list of customer objects into a program with the following capabilities:
Check out a video.
Check in a video.
Determine how many videos a customer has (by customer identification number).
Determine which customers have a certain video checked out (by title).(Hint: Create a hasVideo object that has a video title and a customer number.)
我是这样想的先设计一个光盘类文件,把光盘信息输入到文本文件中把借阅人的信息输入到文本文件中最后做一个联结输出文件可我做到第二步就不知道怎么办好了我的程序如下:#include <tchar.h>
#include <string>
#include <iostream>
#include <time.h>
#include <fstream>using namespace std;ofstream fout;enum mainIdVideos{PopMusic=1,CustomMusic};
enum indexIdVideos{Pop=1,Custom};void reverse( const char *const sPtr )
{
if ( sPtr[ 0 ] == '\0' )
return;
else {
reverse( &sPtr[ 1 ] );
putchar( sPtr[ 0 ] );
}
}struct person{
string Name;
int Id;
};class CBoyGirl
{
public:
CBoyGirl(void);
~CBoyGirl(void);
public:
void BoyGirlInfo();
private:
person People;
};class COneVideo
{
public:
COneVideo(void);
~COneVideo(void);
bool videoInitialize(char[10],int,char[6],char);
bool videoInput(char[10],int,char[6],char);
bool videoOuput(char[10],int,char[6],char);
private:
struct video{
char Name[10];//设置光盘名称
char ID[5];//设置光盘ID,由两部分组成,主类(2位数字)从位(3位数字) 如0110代表流行音乐中得Love光盘
char videoInfo[500];//设置光盘信息,不超过500字
int number;
struct DATE{
int year;
int month;
int day;
} date;
//设置光盘采集日期
};
};CBoyGirl::CBoyGirl(void)
{
}CBoyGirl::~CBoyGirl(void)
{
}void CBoyGirl::BoyGirlInfo()
{
cout<<"Please input Boy's or Girl's Name"<<endl;
cin>>People.Name;
People.Id++;
}
COneVideo::COneVideo(void)
{
}COneVideo::~COneVideo(void)
{
}
bool COneVideo::videoInitialize(char[10],int,char[6],char)
{
return true;
}
bool COneVideo::videoInput(char[10],int,char[6],char)
{
/*在次需要确定一个判断语句,以此确定是否还有新书加入其中*/
cout<<"Please input the name of the video"<<endl;
video video;
gets( video.Name );
// modify
string tmp(video.Name);
//reverse(tmp.begin(),tmp.end());
reverse( video.Name );
// modify over
strcpy(video.Name,tmp.c_str());
cout<<"Please input the number of the video"<<endl;
cin>>video.number;
cout<<"Please input the main id of the video"<<endl;
enum mainIdVideos mainIdVideo;
const char *mainIdVideoId[]={"","PopMusic","CustomMusic"};
int mainId,indexId;
for(mainIdVideo=PopMusic;mainIdVideo<=CustomMusic;mainIdVideo=mainIdVideos(mainIdVideo+1))
cout<<mainIdVideo<<" stand for"<<mainIdVideoId[mainIdVideo]<<endl;
cin>>mainId;
cout<<"Please input the index id of the video"<<endl;
enum indexIdVideos indexIdVideo;
const char *indexIdVideoId[]={"","A","B"}; for(indexIdVideo=Pop;indexIdVideo<=Custom;indexIdVideo=indexIdVideos(indexIdVideo+1))
cout<<indexIdVideo<<" stand for "<<indexIdVideoId[indexIdVideo]<<endl;
cin>>indexId;
// modify
char sz[5];
itoa(mainIdVideo,sz,10);
strcpy(video.ID,sz);
itoa(indexIdVideo,sz,10);
strcat(video.ID,sz);// 此处需要进行缓冲区溢出检查,我没做
//video.ID="mainIdVideo"+"indexIdVideo";
cout<<"Please input the videoinfo of the video"<<endl;
gets( video.videoInfo );
reverse(video.videoInfo);
cout<<"Please input the buy data(year mouth day) of the video,Enter number 1 means now ,enter 2 means what you input"<<endl;
int number;
tm time;
time_t t;
t=_getsystime(&time);
cin>>number;
switch (number){
case 1:
cin>>video.date.year;
cin>>video.date.month;
cin>>video.date.day;
break;
default:
video.date.year=time.tm_year-100;
video.date.month=time.tm_mon+1;
video.date.day=time.tm_mday;
break;
}
FILE *cfPtr = fopen( "Video.txt", "a+" );
if ( cfPtr == NULL ){//a+代表追加文件记录
cout<<"File could not be opened"<<endl;
}
else {
cout<<video.Name<<video.number<<video.ID<<video.date.year<<video.date.month<<video.date.day<<endl;
fclose(cfPtr);
}
return true;
}bool COneVideo::videoOuput(char[10],int,char[6],char)
{
return true;
}int _tmain(int argc, _TCHAR* argv[])
{
COneVideo Video;
char tmp10[10];
tmp10[0] = 0;
int i = 0;
char tmp6[6];
tmp6[0] = 0;
char t = 0;
Video.videoInput(tmp10,i,tmp6,t);
CBoyGirl BG;
BG.BoyGirlInfo();
return 0;
}
还有不少的问题
大家帮忙看看好吗
解决方案 »
- VC 获取Word的具体版本
- socket 数据接收的问题 Help~~~~
- 怎么用ListCtrl控件来显示数据库RecordSet的数据,希望有相关的例子!
- 求助:mfc编程问题
- 请问,窗口从失去焦点到再次获得焦点时会响应什么消息?
- 现有若干种日期时间格式。想转换成统一的 年-月-日 时:分:秒
- 我创建了一个位图,这个位图总是黑白两个颜色,我如何把他设置支持多颜色的呢?如何创建一个透明的位图?
- 关于学习的问题!
- WriteFile返回0,用GetLastError打印为5,拒绝访问该怎么解决
- 位图打印预览正常,打印机输出确是黑块,why?
- 求助,有关变量赋直的问题
- 救命啊(我安装了vc6.0 在controls 面板里面找不到 grid 的类似空间 , 是怎么回事)
可以采用 access 這種比較簡單的數據庫。。