0% found this document useful (0 votes)
2 views

Problem

Uploaded by

Gaming star
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Problem

Uploaded by

Gaming star
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <iostream>

using namespace std;

struct ITEM
{
string itemName;
string brand;
string type;
double price;
};

int main ()
{
int a = 0;
ITEM item[100];
bool condition = true;

// taking first 10 items from user


for (int i = 0; i < 1; i++)
{
cout << "Enter name of the item :" << endl;
cin >> item[i].itemName;

cout << "Enter brand of the item :" << endl << endl;
cin >> item[i].brand;

cout << "Enter type of the item :" << endl;


cin >> item[i].type;

cout << "Enter price of the item :" << endl;


cin >> item[i].price;

int quantities = 0;
cout << "How many quantites :" << endl;
cin >> quantities;
item[i].price *= quantities;
a++;
}

while (condition)
{
char options;
cout << "Enter A for add item" << endl;
cout << "Enter D for remove item" << endl;
cout << "Enter F for finalize items" << endl;
cout << "Enter C for clear items" << endl;
cout << "Enter E for exit" << endl;
cin >> options;

while (toupper(options) != 'A' && toupper(options) != 'D' &&


toupper(options) != 'F' && toupper(options) != 'C' && toupper(options) != 'E')
{
cout << "Enter one of the following options";
cin >> options;
}

// logic goes here...


if (toupper(options) == 'A')
{
}
if (toupper(options) == 'A')
{

cout << "Enter name of the item :" << endl;


cin >> item[a].itemName;

cout << "Enter brand of the item :" << endl;


cin >> item[a].brand;

cout << "Enter type of the item :" << endl;


cin >> item[a].type;

cout << "Enter price of the item :" << endl;


cin >> item[a].price;

int quantities = 0;
cout << "How many quantites :" << endl;
cin >> quantities;
item[a++].price *= quantities;
}
if (toupper(options) == 'D')
{
a--;
}
if (toupper(options) == 'F')
{
for (int i = 0; i < a; i++)
{
cout << "name of the item :" << item[i].itemName << endl;
cout << "name of the brand :" << item[i].brand << endl;
cout << "type of the item :" << item[i].type << endl;
cout << "price of the item :" << item[i].price << endl;
}
}
if (toupper(options) == 'C')
{
a = 0;
}
if (toupper(options) == 'E')
{
return 0;
}

}
}

You might also like