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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
| #include <iostream>
#include <cstring>
#include "Class.h"
Store::Store()
{
}
Store::~Store()
{
}
void Store::setAll(char *name,char *owner,char *adress,float open,float close)
{
this->name=new char[strlen(name)+1];
strcpy(this->name, name);
this->owner=new char[strlen(owner)+1];
strcpy(this->owner, owner);
this->adress=new char[strlen(adress)+1];
strcpy(this->adress, adress);
this->open=open;
this->close=close;
}
char *Store::getName() const
{
return name;
}
char *Store::getOwner() const
{
return owner;
}
char *Store::getAdress() const
{
return adress;
}
float Store::getOpen() const
{
return open;
}
float Store::getClose() const
{
return close;
}
void Store::printAll()
{
std::cout<<"The name of store is: ";
std::cout<<getName()<<'\n';
std::cout<<"The owner of store is: ";
std::cout<<getOwner()<<'\n';
std::cout<<"The adress of store is: ";
std::cout<<getAdress()<<'\n';
std::cout<<"The Opening Hour of store is: "<< getOpen() <<'\n';
std::cout<<"The Closing Hour of store is: "<< getClose() <<'\n';
}
int main()
{
int temp;
Store a;
do
{
std::cout<<"WELCOME to STORE MANAGMENT!!\n\nPlease choose your ACTION:\n1.Create New Store\n2.Print Store\n3.Exit\n";
std::cin>>temp;
switch(temp)
{
case 1:
{
char name[30], owner[30], adress[50];
float open, close;
std::cout<<"Enter name of the store: ";
std::cin.get();
std::cin.getline(name, 30);
std::cout<<"Enter owner of the store: ";
std::cin.getline(owner, 30);
std::cout<<"Enter adress of the store: ";
std::cin.getline(adress, 50);
std::cout<<"Enter opening hour for the store: ";
std::cin>>open;
std::cout<<"Enter closing hour for the store: ";
std::cin>>close;
a.setAll(name, owner, adress, open, close);
}
break;
case 2:
{
a.printAll();
}
break;
case 3:
return 0;
break;
default:
std::cout<<"There is no such option\n";
}
}
while(temp!=3);
return 0;
} |