Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Admin::Add_phone()
- {
- cout<<"Enter The Types of Phone You want to Add"<<endl;
- cout<<"1.Featured phone"<<endl;
- cout<<"2.Midranged phone"<<endl;
- cout<<"3.Flagship phone"<<endl;
- cout<<"4.Appple Phone"<<endl;
- cout<<"0.Exit"<<endl;
- int choice;
- while(true)
- {
- cout<<"Enter Your choice"<<endl;
- cin>>choice;
- if(choice==1)
- {
- fstream fin;
- fin.open("Featuredphone.csv",ios::in|ios::app);
- vector<string>row;
- string brand;
- int price;
- int battery;
- cout<<"Enter Model Name"<<endl;
- cin>>brand;
- cout<<"Enter Price"<<endl;
- cin>>price;
- cout<<"Enter battery Capacity"<<endl;
- cin>>battery;
- fin<<brand<<","<<price<<","<<battery<<endl;
- fin.close();
- }
- if(choice==2)
- {
- fstream fin;
- fin.open("Midrangedphone.csv",ios::in|ios::app);
- string brand,networktype,displaytype,displaysize;
- string battery;
- string simtype,platform;
- string ram,rom;
- string price;
- string camera;
- string android_version,extmemory;
- cout<<"Enter the Name of Brand"<<endl;
- cin>>brand;
- cout<<"Enter The Details Below"<<endl;
- cout<<"battery"<<endl;
- cin>>battery;
- cout<<"Networktype"<<endl;
- cin>>networktype;
- cout<<"Display type and Displaysize"<<endl;
- cin>>displaytype>>displaysize;
- cout<<"Sim type"<<endl;
- cin>>simtype;
- cout<<"Platform"<<endl;
- getline(cin,platform);
- cout<<"Ram and Rom"<<endl;
- cin>>ram>>rom;
- getchar();
- cout<<"Enter Camera Details"<<endl;
- getline(cin,camera);
- cout<<"Android Version"<<endl;
- cin>>android_version;
- cout<<"External Memory"<<endl;
- cin>>extmemory;
- cout<<"Enter the price"<<endl;
- cin>>price;
- fin<<brand<<","<<price<<","<<ram<<","<<rom<<","<<battery<<","<<camera<<","<<networktype<<","<<displaytype<<","<<displaysize<<","
- <<simtype<<","<<platform<<","<<android_version<<","<<extmemory<<endl;
- fin.close();
- }
- else if(choice==3)
- {
- fstream fin;
- fin.open("Flagship_phone.csv",ios::in|ios::app);
- string brand,battery,networktype,displaytype,displaysize;
- string simtype,platform;
- string ram,rom;
- string price;
- string camera;
- string android_version,extmemory;
- cout<<"Enter the Name of Brand"<<endl;
- cin>>brand;
- cout<<"Enter The Details Below"<<endl;
- cout<<"battery"<<endl;
- cin>>battery;
- cout<<"Networktype"<<endl;
- cin>>networktype;
- cout<<"Display type and Displaysize"<<endl;
- cin>>displaytype>>displaysize;
- cout<<"Sim type"<<endl;
- cin>>simtype;
- cout<<"Platform"<<endl;
- getline(cin,platform);
- cout<<"Ram and Rom"<<endl;
- cin>>ram>>rom;
- getchar();
- cout<<"Enter Camera Details"<<endl;
- getline(cin,camera);
- cout<<"Android Version"<<endl;
- cin>>android_version;
- cout<<"External Memory"<<endl;
- cin>>extmemory;
- cout<<"Enter the price"<<endl;
- cin>>price;
- fin<<brand<<","<<price<<","<<ram<<","<<rom<<","<<battery<<","<<camera<<","<<networktype<<","<<displaytype<<","<<displaysize<<","
- <<simtype<<","<<platform<<","<<android_version<<","<<extmemory<<endl;
- fin.close();
- }
- else if(choice==4)
- {
- fstream fin;
- fin.open("Applephone.csv",ios::in|ios::app);
- string battery,brand,networktype,displaytype,displaysize;
- string simtype,platform;
- string ram,rom;
- string price;
- string camera;
- cout<<"Enter The Details Below"<<endl;
- cout<<"battery"<<endl;
- cin>>battery;
- brand="Apple";
- cout<<"Networktype"<<endl;
- cin>>networktype;
- cout<<"Display type and Displaysize"<<endl;
- cin>>displaytype>>displaysize;
- cout<<"Sim type"<<endl;
- cin>>simtype;
- cout<<"Platform"<<endl;
- getline(cin,platform);
- cout<<"Ram and Rom"<<endl;
- cin>>ram>>rom;
- getchar();
- cout<<"Enter Camera Details"<<endl;
- getline(cin,camera);
- cout<<"Enter the price"<<endl;
- cin>>price;
- fin<<brand<<","<<price<<","<<ram<<","<<rom<<","<<battery<<","<<camera<<","<<networktype<<","<<displaytype<<","<<displaysize<<","
- <<simtype<<","<<platform<<endl;
- fin.close();
- }
- else if(choice==0)
- {
- break;
- }
- else
- {
- continue;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment