- 分享
- 0
- 人气
- 0
- 主题
- 23
- 帖子
- 124
- UID
- 186218
- 积分
- 122
- 阅读权限
- 13
- 注册时间
- 2008-12-16
- 最后登录
- 2012-3-17
- 在线时间
- 358 小时
|
main.cpp
#include <iostream>
#include "cda.cpp"
#include <string>
using namespace std;
int main(){
int i=0,j=0;
char choice;
string name;
string cdname;
double money;
CD myCd[100];
cout <<"*********************\n";
cout <<"This is the program \nto let you store \nthe CD information";
cout <<"\n*********************\n\n";
cout <<"1.Store the CD information\n";
cout <<"2.Display the CD information\n";
cout <<"3.Quit the program\n";
cin >> choice;
while (choice !='3'){
switch(choice){
case '1':
cout << "Please input the information of the following" << endl;
cout <<"Artist name:";
cin >> name;
cout <<"CD name:";
cin >> cdname;
cout <<"Cost:";
cin >> money;
myCd[i++].set_values(name,cdname,money);
system("cls");
cout << "You already enter " << i << " CD's information.\n" << endl;
break;
case '2':
for(j = 0; j < i; j++)
{
cout << " Details of" << "CD #" << ++j << ":" << endl;
myCd[--j].display();
}
break;
}
cout <<"1.store the CD information\n";
cout <<"2.display the CD information\n";
cout <<"3.quit\n";
cin >> choice;
}
cout << "Thanks to use this program" << endl;
system("pause");
return 0;
} |
|