-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDL083a.CPP
68 lines (68 loc) · 1.24 KB
/
DL083a.CPP
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
// Filename: \\U1Chap03\DL083a.CPP
#include<iostream.h>
#include<string.h>
#include<stdio.h>
#include<conio.h>
class Garments
{
char GCode[15];
char GType[15];
int GSize;
char GFabric[20];
float GPrice;
public:
// Constructor to assign initial values
Garments()
{
strcpy(GCode, "NOT ALLOTTED");
strcpy(GType, "NOT ALLOTTED");
strcpy(GFabric, "NOT ALLOTTED");
GSize = 0;
GPrice = 0;
}
// Function to calculate value
void Assign()
{
if (strcmp(GFabric, "TROUSER") == 0)
{
GPrice = 1300;
}
else
if (strcmp(GFabric, "SHIRT") == 0)
{
GPrice = 1100 - (1100 * (10/100));
}
}
// Function to input the values
void Input()
{
cout << "Enter code : ";
gets(GCode);
cout << "Enter type : ";
gets(GType);
cout << "Enter size : ";
cin >> GSize;
cout << "Enter fabric : ";
gets(GFabric);
Assign();
}
// Function to display values
void Display()
{
cout << "Code : ";
puts(GCode);
cout << "Type : ";
puts(GType);
cout << "Size : " << GSize << endl;
cout << "Fabric : ";
puts(GFabric);
cout << "Price : " << GPrice;
}
};
void main()
{
clrscr();
Garments G;
G.Input();
G.Display();
}