Advertisement
wafflecone67

new code

Jan 30th, 2020
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <sstream>
  4. #include <stdio.h>
  5. #include <string.h>
  6. using namespace std;
  7.  
  8. struct customer
  9. {
  10. float cost;
  11. string name;
  12. int id=0;
  13. void transaction(float x)
  14. {
  15. cost += x;
  16. }
  17. };
  18.  
  19.  
  20. struct employee
  21. {
  22. string name;
  23. int id=0;
  24. };
  25.  
  26. customer customersearch(customer arr[], int n, int x)
  27. {
  28.  
  29. for (int i = 0; i < n; i++)
  30. {
  31. if (arr[i].id == x)
  32. {
  33. return arr[i];
  34. }
  35. return arr[79];
  36. }
  37. }
  38. employee employeesearch(employee arr[], int n, int x)
  39. {
  40.  
  41. for (int i = 0; i < n; i++)
  42. {
  43. if (arr[i].id == x)
  44. {
  45. return arr[i];
  46. }
  47. return arr[19];
  48. }
  49. }
  50. int main()
  51. {
  52. employee ed[50];//struct objects
  53. customer cd[50];//customer and employee description
  54.  
  55. char t;
  56. int cc=0;//count cust
  57. int ce=0;//count emp
  58.  
  59. for(int i = 0; i <= 6; i++)
  60. {
  61. cout<<"1234567890";
  62. }
  63. cout<<"\n";
  64.  
  65. char type;
  66. while(cin >> type){
  67. if(type=='c'){
  68. cin >> cd[cc].id >> cd[cc].name >> cd[cc].cost;//customer struct stuff
  69. cc++;
  70. }
  71. else if(type == 'e')
  72. {//employee stuff
  73. cin >> ed[ce].id >> ed[ce].name;//employee struct stuff
  74. ce++;
  75. }
  76. else if(type == 't')
  77. {//t stuff
  78. int tmp;
  79.  
  80. cin >> cd[cc].id >> ed[cc].id>>t;
  81. customersearch(cd,tmp,cc);//read the line to a temp variable then I can use it.
  82.  
  83. }
  84.  
  85.  
  86. }
  87.  
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement