Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <sstream>
- #include <stdio.h>
- #include <string.h>
- using namespace std;
- struct customer
- {
- float cost;
- string name;
- int id=0;
- void transaction(float x)
- {
- cost += x;
- }
- };
- struct employee
- {
- string name;
- int id=0;
- };
- customer customersearch(customer arr[], int n, int x)
- {
- for (int i = 0; i < n; i++)
- {
- if (arr[i].id == x)
- {
- return arr[i];
- }
- return arr[79];
- }
- }
- employee employeesearch(employee arr[], int n, int x)
- {
- for (int i = 0; i < n; i++)
- {
- if (arr[i].id == x)
- {
- return arr[i];
- }
- return arr[19];
- }
- }
- int main()
- {
- employee ed[50];//struct objects
- customer cd[50];//customer and employee description
- char t;
- int cc=0;//count cust
- int ce=0;//count emp
- for(int i = 0; i <= 6; i++)
- {
- cout<<"1234567890";
- }
- cout<<"\n";
- char type;
- while(cin >> type){
- if(type=='c'){
- cin >> cd[cc].id >> cd[cc].name >> cd[cc].cost;//customer struct stuff
- cc++;
- }
- else if(type == 'e')
- {//employee stuff
- cin >> ed[ce].id >> ed[ce].name;//employee struct stuff
- ce++;
- }
- else if(type == 't')
- {//t stuff
- int tmp;
- cin >> cd[cc].id >> ed[cc].id>>t;
- customersearch(cd,tmp,cc);//read the line to a temp variable then I can use it.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement