test
This commit is contained in:
parent
37776af5db
commit
ab03d5f10c
4045 changed files with 286212 additions and 3 deletions
73
.config/Code/User/History/65ec6aae/4OoA.cpp
Normal file
73
.config/Code/User/History/65ec6aae/4OoA.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
|
||||
int current;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts), current(0){
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[current] = product;
|
||||
qtys[current] = qty;
|
||||
current++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
86
.config/Code/User/History/65ec6aae/5QV7.cpp
Normal file
86
.config/Code/User/History/65ec6aae/5QV7.cpp
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
Customer(string name, string address) : name(name), address(address){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
Product(string name, double price) : name(name), price(price){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
95
.config/Code/User/History/65ec6aae/6eLi.cpp
Normal file
95
.config/Code/User/History/65ec6aae/6eLi.cpp
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
Product *tmpP = new Product[noOfProducts+1];
|
||||
int *tmpQ = new int[noOfProducts+1];
|
||||
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
|
||||
|
||||
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
65
.config/Code/User/History/65ec6aae/7TeD.cpp
Normal file
65
.config/Code/User/History/65ec6aae/7TeD.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts){
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
94
.config/Code/User/History/65ec6aae/7pBt.cpp
Normal file
94
.config/Code/User/History/65ec6aae/7pBt.cpp
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
Customer(string name, string address) : name(name), address(address){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
Product(){}
|
||||
Product(string name, double price) : name(name), price(price){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer, Product product, int qty) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1]{product, qty};
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
Order order(Customer("ammar", "1233"), Product("milk", 50), 10);
|
||||
|
||||
order.addItem(Product("eggs", 40), 10);
|
||||
|
||||
order.displayOrder();
|
||||
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
76
.config/Code/User/History/65ec6aae/92Ow.cpp
Normal file
76
.config/Code/User/History/65ec6aae/92Ow.cpp
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts){
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
}
|
||||
~Order(){
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
85
.config/Code/User/History/65ec6aae/9c83.cpp
Normal file
85
.config/Code/User/History/65ec6aae/9c83.cpp
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
noOfProducts++;
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
|
||||
|
||||
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
84
.config/Code/User/History/65ec6aae/BUxj.cpp
Normal file
84
.config/Code/User/History/65ec6aae/BUxj.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
98
.config/Code/User/History/65ec6aae/CJ0X.cpp
Normal file
98
.config/Code/User/History/65ec6aae/CJ0X.cpp
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){
|
||||
products = new Product[1];
|
||||
qtys = new int[1];
|
||||
}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
Product *tmpP = new Product[noOfProducts+1];
|
||||
int *tmpQ = new int[noOfProducts+1];
|
||||
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
|
||||
|
||||
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
73
.config/Code/User/History/65ec6aae/CetG.cpp
Normal file
73
.config/Code/User/History/65ec6aae/CetG.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){}
|
||||
~Order(){
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
65
.config/Code/User/History/65ec6aae/EaKs.cpp
Normal file
65
.config/Code/User/History/65ec6aae/EaKs.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts){
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[i] = product;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
88
.config/Code/User/History/65ec6aae/EunK.cpp
Normal file
88
.config/Code/User/History/65ec6aae/EunK.cpp
Normal file
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
93
.config/Code/User/History/65ec6aae/Ij1v.cpp
Normal file
93
.config/Code/User/History/65ec6aae/Ij1v.cpp
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){}
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
Product *tmpP = new Product[noOfProducts+1];
|
||||
int *tmpQ = new int[noOfProducts+1];
|
||||
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
tmpP[i] = products[i];
|
||||
tmpQ[i] = qtys[i];
|
||||
}
|
||||
|
||||
tmpP[noOfProducts] = product;
|
||||
tmpQ[noOfProducts] = qty;
|
||||
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
|
||||
|
||||
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
82
.config/Code/User/History/65ec6aae/IjfU.cpp
Normal file
82
.config/Code/User/History/65ec6aae/IjfU.cpp
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
86
.config/Code/User/History/65ec6aae/JyOk.cpp
Normal file
86
.config/Code/User/History/65ec6aae/JyOk.cpp
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
Customer(string name, string address) : name(name), address(address){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
Product(string name, double price) : name(name), price(price){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer, Product product, int qty) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
83
.config/Code/User/History/65ec6aae/LwrL.cpp
Normal file
83
.config/Code/User/History/65ec6aae/LwrL.cpp
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
|
||||
|
||||
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
84
.config/Code/User/History/65ec6aae/NwoT.cpp
Normal file
84
.config/Code/User/History/65ec6aae/NwoT.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
Customer(string name, string address) : name(name), address(address){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
79
.config/Code/User/History/65ec6aae/OXdh.cpp
Normal file
79
.config/Code/User/History/65ec6aae/OXdh.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
|
||||
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
89
.config/Code/User/History/65ec6aae/PSIA.cpp
Normal file
89
.config/Code/User/History/65ec6aae/PSIA.cpp
Normal file
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<endl;
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
98
.config/Code/User/History/65ec6aae/RMOk.cpp
Normal file
98
.config/Code/User/History/65ec6aae/RMOk.cpp
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){
|
||||
products = new Product[1];
|
||||
qtys = new int[1];
|
||||
}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
Product *tmpP = new Product[noOfProducts+1];
|
||||
int *tmpQ = new int[noOfProducts+1];
|
||||
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
tmpP[i] = products[i];
|
||||
tmpQ[i] = qtys[i];
|
||||
}
|
||||
|
||||
tmpP[noOfProducts] = product;
|
||||
tmpQ[noOfProducts] = qty;
|
||||
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
|
||||
|
||||
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
80
.config/Code/User/History/65ec6aae/S4oV.cpp
Normal file
80
.config/Code/User/History/65ec6aae/S4oV.cpp
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
|
||||
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
100
.config/Code/User/History/65ec6aae/T5di.cpp
Normal file
100
.config/Code/User/History/65ec6aae/T5di.cpp
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){
|
||||
products = new Product[1];
|
||||
qtys = new int[1];
|
||||
}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
Product *tmpP = new Product[noOfProducts+1];
|
||||
int *tmpQ = new int[noOfProducts+1];
|
||||
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
tmpP[i] = products[i];
|
||||
tmpQ[i] = qtys[i];
|
||||
}
|
||||
|
||||
tmpP[noOfProducts] = product;
|
||||
tmpQ[noOfProducts] = qty;
|
||||
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
|
||||
|
||||
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
76
.config/Code/User/History/65ec6aae/TCkE.cpp
Normal file
76
.config/Code/User/History/65ec6aae/TCkE.cpp
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
delete[] qtys;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
84
.config/Code/User/History/65ec6aae/UfKX.cpp
Normal file
84
.config/Code/User/History/65ec6aae/UfKX.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
84
.config/Code/User/History/65ec6aae/X6Nm.cpp
Normal file
84
.config/Code/User/History/65ec6aae/X6Nm.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
noOfProducts++;
|
||||
products = new Product[noOfProducts];
|
||||
|
||||
|
||||
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
63
.config/Code/User/History/65ec6aae/YdSd.cpp
Normal file
63
.config/Code/User/History/65ec6aae/YdSd.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int noOfProducts;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts){
|
||||
products = new Product[noOfProducts];
|
||||
}
|
||||
|
||||
void addItem(Product product, int index){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
81
.config/Code/User/History/65ec6aae/aI9v.cpp
Normal file
81
.config/Code/User/History/65ec6aae/aI9v.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
|
||||
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
101
.config/Code/User/History/65ec6aae/bOXt.cpp
Normal file
101
.config/Code/User/History/65ec6aae/bOXt.cpp
Normal file
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){
|
||||
products = new Product[1];
|
||||
qtys = new int[1];
|
||||
}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
Product *tmpP = new Product[noOfProducts+1];
|
||||
int *tmpQ = new int[noOfProducts+1];
|
||||
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
tmpP[i] = products[i];
|
||||
tmpQ[i] = qtys[i];
|
||||
}
|
||||
|
||||
tmpP[noOfProducts] = product;
|
||||
tmpQ[noOfProducts] = qty;
|
||||
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
|
||||
|
||||
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
93
.config/Code/User/History/65ec6aae/cK0b.cpp
Normal file
93
.config/Code/User/History/65ec6aae/cK0b.cpp
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
Product *tmpP = new Product[noOfProducts+1];
|
||||
int *tmpQ = new int[noOfProducts+1];
|
||||
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
tmpP[i] = products[i];
|
||||
tmpQ[i] = qtys[i];
|
||||
}
|
||||
|
||||
tmpP[noOfProducts] = product;
|
||||
tmpQ[noOfProducts] = qty;
|
||||
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
|
||||
|
||||
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
83
.config/Code/User/History/65ec6aae/e96Y.cpp
Normal file
83
.config/Code/User/History/65ec6aae/e96Y.cpp
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
1
.config/Code/User/History/65ec6aae/entries.json
Normal file
1
.config/Code/User/History/65ec6aae/entries.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":1,"resource":"file:///home/rafayahmad/Stuff/OOP/lab13/q1.cpp","entries":[{"id":"yiIp.cpp","timestamp":1714363481585},{"id":"YdSd.cpp","timestamp":1714363494136},{"id":"lgF5.cpp","timestamp":1714363557532},{"id":"mDlY.cpp","timestamp":1714363768205},{"id":"vaGp.cpp","timestamp":1714363788619},{"id":"7TeD.cpp","timestamp":1714363858651},{"id":"EaKs.cpp","timestamp":1714363872255},{"id":"g2p6.cpp","timestamp":1714363930287},{"id":"s2J7.cpp","timestamp":1714363970514},{"id":"4OoA.cpp","timestamp":1714363985372},{"id":"esBL.cpp","timestamp":1714364023456},{"id":"92Ow.cpp","timestamp":1714364080189},{"id":"m3T5.cpp","timestamp":1714364155720},{"id":"CetG.cpp","timestamp":1714364168248},{"id":"lfqp.cpp","timestamp":1714364457499},{"id":"rzJv.cpp","timestamp":1714364564531},{"id":"TCkE.cpp","timestamp":1714364847268},{"id":"vuEV.cpp","timestamp":1714364879166},{"id":"LwrL.cpp","timestamp":1714364889523},{"id":"BUxj.cpp","timestamp":1714365008865},{"id":"X6Nm.cpp","timestamp":1714365033356},{"id":"9c83.cpp","timestamp":1714365047299},{"id":"6eLi.cpp","timestamp":1714365130230},{"id":"CJ0X.cpp","timestamp":1714365196655},{"id":"mINX.cpp","timestamp":1714365226621},{"id":"mRXn.cpp","timestamp":1714365259444},{"id":"RMOk.cpp","timestamp":1714365288137},{"id":"T5di.cpp","timestamp":1714365323874},{"id":"bOXt.cpp","timestamp":1714365339890},{"id":"Ij1v.cpp","timestamp":1714365369987},{"id":"cK0b.cpp","timestamp":1714365407483},{"id":"OXdh.cpp","timestamp":1714365422273},{"id":"S4oV.cpp","timestamp":1714365443327},{"id":"aI9v.cpp","timestamp":1714365480137},{"id":"xKrY.cpp","timestamp":1714365505860},{"id":"e96Y.cpp","timestamp":1714365534337},{"id":"UfKX.cpp","timestamp":1714365603291},{"id":"PSIA.cpp","timestamp":1714365686921},{"id":"EunK.cpp","timestamp":1714365699708},{"id":"IjfU.cpp","timestamp":1714365741906},{"id":"NwoT.cpp","timestamp":1714365797023},{"id":"5QV7.cpp","timestamp":1714365822360},{"id":"JyOk.cpp","timestamp":1714365888928},{"id":"i4Dd.cpp","timestamp":1714365924192},{"id":"wx2H.cpp","timestamp":1714365947992},{"id":"ujCO.cpp","timestamp":1714365976276},{"id":"wiKf.cpp","timestamp":1714366121802},{"id":"7pBt.cpp","timestamp":1714366194077},{"id":"tbi3.cpp","timestamp":1714366342481},{"id":"wAgl.cpp","timestamp":1714366361398}]}
|
79
.config/Code/User/History/65ec6aae/esBL.cpp
Normal file
79
.config/Code/User/History/65ec6aae/esBL.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
|
||||
int current;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts), current(0){
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
}
|
||||
~Order(){
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[current] = product;
|
||||
qtys[current] = qty;
|
||||
current++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
67
.config/Code/User/History/65ec6aae/g2p6.cpp
Normal file
67
.config/Code/User/History/65ec6aae/g2p6.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
|
||||
int current;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts), current(0){
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[i] = product;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
86
.config/Code/User/History/65ec6aae/i4Dd.cpp
Normal file
86
.config/Code/User/History/65ec6aae/i4Dd.cpp
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
Customer(string name, string address) : name(name), address(address){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
Product(string name, double price) : name(name), price(price){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer, Product product, int qty) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1]{product, qty};
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
73
.config/Code/User/History/65ec6aae/lfqp.cpp
Normal file
73
.config/Code/User/History/65ec6aae/lfqp.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){}
|
||||
~Order(){
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
63
.config/Code/User/History/65ec6aae/lgF5.cpp
Normal file
63
.config/Code/User/History/65ec6aae/lgF5.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int noOfProducts;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts){
|
||||
products = new Product[noOfProducts];
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
76
.config/Code/User/History/65ec6aae/m3T5.cpp
Normal file
76
.config/Code/User/History/65ec6aae/m3T5.cpp
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
}
|
||||
~Order(){
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
64
.config/Code/User/History/65ec6aae/mDlY.cpp
Normal file
64
.config/Code/User/History/65ec6aae/mDlY.cpp
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts){
|
||||
products = new Product[noOfProducts];
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
99
.config/Code/User/History/65ec6aae/mINX.cpp
Normal file
99
.config/Code/User/History/65ec6aae/mINX.cpp
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){
|
||||
products = new Product[1];
|
||||
qtys = new int[1];
|
||||
}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
Product *tmpP = new Product[noOfProducts+1];
|
||||
int *tmpQ = new int[noOfProducts+1];
|
||||
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
tmpP[i] = products[i];
|
||||
tmpQ[i] = qtys[i];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
|
||||
|
||||
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
102
.config/Code/User/History/65ec6aae/mRXn.cpp
Normal file
102
.config/Code/User/History/65ec6aae/mRXn.cpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){
|
||||
products = new Product[1];
|
||||
qtys = new int[1];
|
||||
}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
Product *tmpP = new Product[noOfProducts+1];
|
||||
int *tmpQ = new int[noOfProducts+1];
|
||||
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
tmpP[i] = products[i];
|
||||
tmpQ[i] = qtys[i];
|
||||
}
|
||||
|
||||
tmpP[noOfProducts] = product;
|
||||
tmpQ[noOfProducts] = qty;
|
||||
|
||||
|
||||
|
||||
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
|
||||
|
||||
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
73
.config/Code/User/History/65ec6aae/rzJv.cpp
Normal file
73
.config/Code/User/History/65ec6aae/rzJv.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){}
|
||||
~Order(){
|
||||
delete[] products;
|
||||
delete[] qtys;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
69
.config/Code/User/History/65ec6aae/s2J7.cpp
Normal file
69
.config/Code/User/History/65ec6aae/s2J7.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
|
||||
int current;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts), current(0){
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[current] = product;
|
||||
qtys[current] = qty;
|
||||
current++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
94
.config/Code/User/History/65ec6aae/tbi3.cpp
Normal file
94
.config/Code/User/History/65ec6aae/tbi3.cpp
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
Customer(string name, string address) : name(name), address(address){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
Product(){}
|
||||
Product(string name, double price) : name(name), price(price){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer, Product product, int qty) : customer(customer), noOfProducts(1){
|
||||
items = new OrderItem[1]{product, qty};
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
Order order(Customer("ammar", "1233"), Product("milk", 50), 10);
|
||||
|
||||
order.addItem(Product("eggs", 40), 10);
|
||||
|
||||
order.displayOrder();
|
||||
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
87
.config/Code/User/History/65ec6aae/ujCO.cpp
Normal file
87
.config/Code/User/History/65ec6aae/ujCO.cpp
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
Customer(string name, string address) : name(name), address(address){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
Product(){}
|
||||
Product(string name, double price) : name(name), price(price){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer, Product product, int qty) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1]{product, qty};
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
65
.config/Code/User/History/65ec6aae/vaGp.cpp
Normal file
65
.config/Code/User/History/65ec6aae/vaGp.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts){
|
||||
products = new Product[noOfProducts];
|
||||
qtys = new int[noOfProducts];
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
79
.config/Code/User/History/65ec6aae/vuEV.cpp
Normal file
79
.config/Code/User/History/65ec6aae/vuEV.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int *qtys;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0), products(nullptr), qtys(nullptr){}
|
||||
~Order(){
|
||||
if(products != nullptr){
|
||||
delete[] products;
|
||||
products = nullptr;
|
||||
}
|
||||
if(qtys != nullptr){
|
||||
delete[] qtys;
|
||||
qtys = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
products[noOfProducts] = product;
|
||||
qtys[noOfProducts] = qty;
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
89
.config/Code/User/History/65ec6aae/wAgl.cpp
Normal file
89
.config/Code/User/History/65ec6aae/wAgl.cpp
Normal file
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
Customer(string name, string address) : name(name), address(address){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
Product(){}
|
||||
Product(string name, double price) : name(name), price(price){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer, Product product, int qty) : customer(customer), noOfProducts(1){
|
||||
items = new OrderItem[1]{product, qty};
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
Order order(Customer("ammar", "1233"), Product("milk", 50), 10);
|
||||
order.addItem(Product("eggs", 40), 10);
|
||||
order.displayOrder();
|
||||
|
||||
return 0;
|
||||
}
|
91
.config/Code/User/History/65ec6aae/wiKf.cpp
Normal file
91
.config/Code/User/History/65ec6aae/wiKf.cpp
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
Customer(string name, string address) : name(name), address(address){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
Product(){}
|
||||
Product(string name, double price) : name(name), price(price){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer, Product product, int qty) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1]{product, qty};
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
Order order(Customer("ammar", "1233"), Product("milk", 50), 10);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
86
.config/Code/User/History/65ec6aae/wx2H.cpp
Normal file
86
.config/Code/User/History/65ec6aae/wx2H.cpp
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
Customer(string name, string address) : name(name), address(address){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
Product(string name, double price) : name(name), price(price){}
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
delete[] items;
|
||||
items = tmp;
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
cout<<"Name: "<<customer.getName()<<endl;
|
||||
cout<<"Address: "<<customer.getAddress()<<endl;
|
||||
for(int i=0;i<noOfProducts;i++){
|
||||
cout<<"product name: "<<items[i].product.getName()<<"\t";
|
||||
cout<<"product price: "<<items[i].product.getPrice()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
82
.config/Code/User/History/65ec6aae/xKrY.cpp
Normal file
82
.config/Code/User/History/65ec6aae/xKrY.cpp
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
struct OrderItem{
|
||||
Product product;
|
||||
int qty;
|
||||
};
|
||||
OrderItem *items;
|
||||
int noOfProducts;
|
||||
public:
|
||||
|
||||
Order(Customer customer) : customer(customer), noOfProducts(0){
|
||||
items = new OrderItem[1];
|
||||
}
|
||||
~Order(){
|
||||
delete[] items;
|
||||
}
|
||||
|
||||
void addItem(Product product, int qty){
|
||||
|
||||
OrderItem *tmp = new OrderItem[noOfProducts+1];
|
||||
for(int i=0;i<noOfProducts;i++) tmp[i] = items[i];
|
||||
tmp[noOfProducts] = {product, qty};
|
||||
|
||||
|
||||
|
||||
noOfProducts++;
|
||||
}
|
||||
|
||||
void displayOrder(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
63
.config/Code/User/History/65ec6aae/yiIp.cpp
Normal file
63
.config/Code/User/History/65ec6aae/yiIp.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
Rafay Ahmad
|
||||
23I-2526
|
||||
*/
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Customer{
|
||||
string name;
|
||||
string address;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
string getAddress(){
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
class Product{
|
||||
string name;
|
||||
double price;
|
||||
|
||||
public:
|
||||
|
||||
string getName(){
|
||||
return name;
|
||||
}
|
||||
double getPrice(){
|
||||
return price;
|
||||
}
|
||||
};
|
||||
|
||||
class Order{
|
||||
Customer customer;
|
||||
Product *products;
|
||||
int noOfProducts;
|
||||
|
||||
public:
|
||||
|
||||
Order(Customer customer, int noOfProducts) : customer(customer), noOfProducts(noOfProducts){
|
||||
products = new Product[noOfProducts];
|
||||
}
|
||||
|
||||
void addItem(Product product, int index){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue