Maruf_Hasan

add phone

Jun 24th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.22 KB | None | 0 0
  1. void Admin::Add_phone()
  2. {
  3. cout<<"Enter The Types of Phone You want to Add"<<endl;
  4. cout<<"1.Featured phone"<<endl;
  5. cout<<"2.Midranged phone"<<endl;
  6. cout<<"3.Flagship phone"<<endl;
  7. cout<<"4.Appple Phone"<<endl;
  8. cout<<"0.Exit"<<endl;
  9. int choice;
  10. while(true)
  11. {
  12. cout<<"Enter Your choice"<<endl;
  13. cin>>choice;
  14. if(choice==1)
  15. {
  16. fstream fin;
  17. fin.open("Featuredphone.csv",ios::in|ios::app);
  18. vector<string>row;
  19. string brand;
  20. int price;
  21. int battery;
  22. cout<<"Enter Model Name"<<endl;
  23. cin>>brand;
  24. cout<<"Enter Price"<<endl;
  25. cin>>price;
  26. cout<<"Enter battery Capacity"<<endl;
  27. cin>>battery;
  28. fin<<brand<<","<<price<<","<<battery<<endl;
  29. fin.close();
  30. }
  31. if(choice==2)
  32. {
  33. fstream fin;
  34. fin.open("Midrangedphone.csv",ios::in|ios::app);
  35. string brand,networktype,displaytype,displaysize;
  36. string battery;
  37. string simtype,platform;
  38. string ram,rom;
  39. string price;
  40. string camera;
  41. string android_version,extmemory;
  42. cout<<"Enter the Name of Brand"<<endl;
  43. cin>>brand;
  44. cout<<"Enter The Details Below"<<endl;
  45. cout<<"battery"<<endl;
  46. cin>>battery;
  47. cout<<"Networktype"<<endl;
  48. cin>>networktype;
  49. cout<<"Display type and Displaysize"<<endl;
  50. cin>>displaytype>>displaysize;
  51. cout<<"Sim type"<<endl;
  52. cin>>simtype;
  53. cout<<"Platform"<<endl;
  54. getline(cin,platform);
  55. cout<<"Ram and Rom"<<endl;
  56. cin>>ram>>rom;
  57. getchar();
  58. cout<<"Enter Camera Details"<<endl;
  59. getline(cin,camera);
  60. cout<<"Android Version"<<endl;
  61. cin>>android_version;
  62. cout<<"External Memory"<<endl;
  63. cin>>extmemory;
  64. cout<<"Enter the price"<<endl;
  65. cin>>price;
  66. fin<<brand<<","<<price<<","<<ram<<","<<rom<<","<<battery<<","<<camera<<","<<networktype<<","<<displaytype<<","<<displaysize<<","
  67. <<simtype<<","<<platform<<","<<android_version<<","<<extmemory<<endl;
  68. fin.close();
  69. }
  70. else if(choice==3)
  71. {
  72. fstream fin;
  73. fin.open("Flagship_phone.csv",ios::in|ios::app);
  74. string brand,battery,networktype,displaytype,displaysize;
  75. string simtype,platform;
  76. string ram,rom;
  77. string price;
  78. string camera;
  79. string android_version,extmemory;
  80. cout<<"Enter the Name of Brand"<<endl;
  81. cin>>brand;
  82. cout<<"Enter The Details Below"<<endl;
  83. cout<<"battery"<<endl;
  84. cin>>battery;
  85. cout<<"Networktype"<<endl;
  86. cin>>networktype;
  87. cout<<"Display type and Displaysize"<<endl;
  88. cin>>displaytype>>displaysize;
  89. cout<<"Sim type"<<endl;
  90. cin>>simtype;
  91. cout<<"Platform"<<endl;
  92. getline(cin,platform);
  93. cout<<"Ram and Rom"<<endl;
  94. cin>>ram>>rom;
  95. getchar();
  96. cout<<"Enter Camera Details"<<endl;
  97. getline(cin,camera);
  98. cout<<"Android Version"<<endl;
  99. cin>>android_version;
  100. cout<<"External Memory"<<endl;
  101. cin>>extmemory;
  102. cout<<"Enter the price"<<endl;
  103. cin>>price;
  104. fin<<brand<<","<<price<<","<<ram<<","<<rom<<","<<battery<<","<<camera<<","<<networktype<<","<<displaytype<<","<<displaysize<<","
  105. <<simtype<<","<<platform<<","<<android_version<<","<<extmemory<<endl;
  106. fin.close();
  107. }
  108. else if(choice==4)
  109. {
  110. fstream fin;
  111. fin.open("Applephone.csv",ios::in|ios::app);
  112. string battery,brand,networktype,displaytype,displaysize;
  113. string simtype,platform;
  114. string ram,rom;
  115. string price;
  116. string camera;
  117. cout<<"Enter The Details Below"<<endl;
  118. cout<<"battery"<<endl;
  119. cin>>battery;
  120. brand="Apple";
  121. cout<<"Networktype"<<endl;
  122. cin>>networktype;
  123. cout<<"Display type and Displaysize"<<endl;
  124. cin>>displaytype>>displaysize;
  125. cout<<"Sim type"<<endl;
  126. cin>>simtype;
  127. cout<<"Platform"<<endl;
  128. getline(cin,platform);
  129. cout<<"Ram and Rom"<<endl;
  130. cin>>ram>>rom;
  131. getchar();
  132. cout<<"Enter Camera Details"<<endl;
  133. getline(cin,camera);
  134. cout<<"Enter the price"<<endl;
  135. cin>>price;
  136. fin<<brand<<","<<price<<","<<ram<<","<<rom<<","<<battery<<","<<camera<<","<<networktype<<","<<displaytype<<","<<displaysize<<","
  137. <<simtype<<","<<platform<<endl;
  138. fin.close();
  139. }
  140. else if(choice==0)
  141. {
  142. break;
  143. }
  144. else
  145. {
  146. continue;
  147. }
  148. }
  149. }
Advertisement
Add Comment
Please, Sign In to add comment