1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
// PA4.cpp : Defines the entry point for the console application.
//
#include "StdAfx.h"
#include "PA4.h"
VideoStore::VideoStore(){}
void VideoStore::addVideoStoreInfo(int& checkint,int &b, int &a,string ID[],string title[], string movie[],string ID2[],string Names[])
{
ifstream input;
total=0;
input.open("C:\\Users\\houst_000\\Desktop\\Programming Assignment 4 Data.txt",ios::in);
if (input.fail()){
cout<<"sorry, could not read file";
system("pause");
exit(1);
}
string Position;
string Name;
int index=0;
input>> checkint;
string stri;
while(!input.eof()){
getline(input,stri , '\n');
for (int n=0; n<checkint; n++){
getline(input, Name, '\n');
title[n]=Name;
//while(getline(input, Name,'\n')&&(getline(input, Name,'\n'))){
getline(input, Name, '\n');
// if (Name=="\n")
moviestar1[n]=Name;
getline(input, Name, '\n');
//if (Name=="\n")
moviestar2[n]=Name;
getline(input, Name, '\n');
//if (Name=="\n")
producer[n]=Name;
getline(input, Name, '\n');
//if (Name=="\n")
director[n]=Name;
//input>>producer[n]>>director[n];
getline(input, Name, '\n');
company[n]=Name;
input>>num_copies[n];
total++;
cout<<title[n]<<","<<moviestar1[n]<<" ,"<<moviestar2[n]<<" "
<<producer[n]<<", "<<director[n]<<", "<<company[n]<<", "<<num_copies[n]<<endl;
getline(input, Name, '\n'); }
int number=0;
string newcustomer;
string hey="ggg";
while(a<40 ){
//getline(input, customer,'\n');
//number =input.peek();
getline(input, newcustomer,',');
string string;
string= newcustomer.substr(1,1);
cout<<newcustomer.substr(1,1);
cout<<string<<endl;
for (int d=0; d<a;d++){
if (string== ID[d])
{ID2[0]=string;
goto lastsection;}
}
//if (input>>number){
// ID2[a]=number;
// system("pause");
// break;}
//else
firstname[a]=newcustomer;
getline(input, newcustomer,',');
secname[a]=newcustomer;
input>>ID[a];
//if (number>=0||number<10000000){
// ID2[a]=number;
// break;}
//hey.at (hey.length () - 1);
// ID[a]=hey;
// cin.ignore(firstname[a].size()-1,'\n');
// getline(input,newcustomer);
// ID[a]=newcustomer;
//getline(input, customer,',');
//secname[a]=customer;
//input>>ID[a];
cout<< firstname[a]<<","<<secname[a]<<endl;
Names[a]=firstname[a]+","+secname[a];
cout<<ID[a]<<endl;
a++;
}
lastsection:{
int c=0;
//input>>ID2[c];
getline(input, customer, '\n');
movie[c]=customer;
cout<<ID2[c]<<" ,,"<<movie[c]<<endl;
c++;
b=1;
while (!input.eof()){
getline(input, customer, ',');
ID2[b]=customer;
//getline(input, customer, ',');
getline(input, customer, '\n');
movie[b]=customer;
cout<<ID2[b]<<",,"<<movie[b]<<endl;
b++;
}
system("pause");
}
}
}
int VideoStore:: counter(int &count,int &b, int &n){
return n;
}
int VideoStore:: countID(int &b){
return b;
}
void VideoStore::display(int &checkint, int& b, int &n,string Names[]){
cout<<title[1]<<endl;
for(int e=0; e<checkint;e++){
// cout<<"Video Name: "<<Names[e]<<endl;
cout<<"Video Title: "<<title[e]<<endl;
cout<<"Video producer: "<<producer[e]<<endl;
cout<<"Video director: "<<director[e]<<endl;
cout<<"Number of Copies: "<<num_copies[e]<<endl;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
VideoStore emp;
//Customer customer;
//Rent rent;
int tot=0;
int tot2=0;
int tot3=0;
int var;
int tot5=0;
string title2[20];
string movie2[20];
string ID2[20];
string ID3[20];
string name2[20];
emp.addVideoStoreInfo(tot,tot2,tot3,ID2,title2,movie2,ID3,name2);
View view;
emp.display(tot,tot2,tot3,name2);
view.showSelection(tot,tot2,tot3,ID2,title2,movie2,ID3,name2);
int tot4= emp.counter(var,tot2,tot3);
int tot6=tot;
int tot7=0;
//customer.enterCustInfo(tot6,tot2,tot4,tot7,ID2,title2,movie2,ID3,name2);
cout<<"---------------------------------VIDEO STORE-----------------------"<<endl;
cout<<"1-Rent Video"<<endl;
cout<<"2-Display Customer Info"<<endl;
cout<<"3-Display List of available videos in store"<<endl;
//customer.display(tot6,tot2,tot4,tot7,ID2,title2,movie2,ID3, name2);
system("pause");
return 0;
}
|