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
|
#include <iostream>
#include <vector>
using namespace std;
const int NUMSELLER = 1;
const int NUMBUYER = 1;
const int NUMBIDS = 10;
const int MINQUANTITY = 1;
const int MAXQUANTITY = 30;
const int MINPRICE =50;
const int MAXPRICE = 100;
class Bid {
int oper;
int bidId;
int TrdId;
char Type;
int qty;
int price;
public:
Bid() {0,0,0,'',0;}
//Bid(int x,int y,int z,char m,int n) { d = x; }
Bid &operator =(int x)
{
oper = x; return *this;
}
int buyerBids(int,int,int,char,int );
int sellerBids(int,int,int,char,int );
};
int Bid::buyerBids(int a, int b,int c, char d, int e)
{
bidId = a;
TrdId = b;
Type = c;
qty = d;
price = e;
a=(rand() % 9) + 1;
b=(rand() % 9) + 1;
c= (rand() % 30) + 1; ;
d='B';
e=(rand() % 50) + 50;
return (a,b,c,d,e);
}
int Bid::sellerBids(int a, int b,int c, char d, int e)
{
bidId = a;
TrdId = b;
Type = c;
qty = d;
price = e;
a=(rand() % 9) + 1;
b=(rand() % 9) + 1;
c= (rand() % 30) + 1; ;
d='A';
e=(rand() % 50) + 50;
return (a,b,c,d,e);
}
//-----------------------------------------------------------------
int main()
{
vector<Bid> v;
int i;
char A,B;
cout << endl;
cout << endl;
cout << "Bid data successfully generated!\n\n";
cout << "\n--------------Displaying your bid data---------------\n";
cout << endl;
// displaying the stored data
cout << "\tBidID | TradID | Type | Qty | Price \n\n";
for (i = 0; i <v.size(); i++)
{
v.push_back(v.[i].buyerBids(1,2,B,3));
v.push_back(v[ i ].sellerBids(0,0,0,A,0));
}
cout << endl;
system("pause");
return 0;
}
| |