You are on page 1of 4

Q.

#include<iostream.h>

#include<conio.h>

#include<string.h>

#include<stdio.h>

class Garments

{ char GCode[21],GType[21];

int GSize;

char GFabric[21];

float GPrice;

void Assign()

if (strcmp(strupr(GFabric),"COTTON")==0)

{if(strcmp(strupr(GType),"TROUSER")==0)

GPrice = 1300;

if(strcmp(strupr(GType),"SHIRT")==0)

GPrice = 1100;

else

{if(strcmp(strupr(GType),"TROUSER")==0)

GPrice = 1300*0.90;

if(strcmp(strupr(GType),"SHIRT")==0)

GPrice = 1100*0.90;

}
public:

Garments()

strcpy(GCode,"NOT ALLOTED");

strcpy(GType,"NOT ALLOTED");

GSize = 0;

strcpy(GFabric,"NOT ALLOTED");

GPrice=0;

void Input()

{ cout<<"\n Enter the Garment Code:";

gets(GCode);

cout<<"\n Enter the Garment Type:";

gets(GType);

cout<<"\n Enter the Garment Size:";

cin>>GSize;

cout<<"\n Enter the Garment Fabric:";

gets(GFabric);

Assign();

void Display()

{cout<< "\n The Garment Code:"<<GCode;

cout<<"\n The Garment Type:"<<GType;

cout<<"\n The Garment Size:"<<GSize;

cout<<"\n The Garment Fabric:"<<GFabric;


cout<< "\n The Garment Price:"<<GPrice;

};

void main()

{ Garments G;

G.Input();

G.Display();

}
Q.4

class PIC

{int pno;

char Category[20];

char Location[20];

void FixLocation();

public:

void Enter();

void seeAll();

};

void PIC::FixLocation()

{if(strcmp(Category,"Classic")==0)

strcpy(Location,"Amina");

else if(strcmp(Category,"Modern")==0)

strcpy(Location,"Jim Plaq");

else if(strcmp(Category,"Antique")==0)

strcpy(Location,"Ustad Khan");

void PIC::Enter()

{cin >>pno;

gets(Category);

FixLocation();

}void PIC::seeAll()

{cout<<pno<<Category<<Location;

You might also like