answersLogoWhite

0


Best Answer

#include<iostream>

#include<map>

#include<string>

#include<sstream>

#include<conio.h>

struct Cellphone

{

std::string product_id;

std::string product_no;

std::string country;

std::string brand;

double cost;

};

std::ostream& operator<< (std::ostream& os, const Cellphone& phone)

{

os << "Product ID: " << phone.product_id << std::endl;

os << "Product No: " << phone.product_no << std::endl;

os << "Country: " << phone.country << std::endl;

os << "Brand: " << phone.brand << std::endl;

os << "Cost: " << phone.cost << std::endl;

return os;

}

// Global...

std::map<std::string, Cellphone> cellphones;

// forward declarations

size_t choice (std::string);

std::string get_string (std::string prompt);

double get_double (std::string prompt);

void add();

void remove();

void search();

void view();

int main()

{

while (1)

{

std::cout << "MAIN MENU\n=========\n\n";

std::cout << "[A] Add\n";

std::cout << "[V] View\n";

std::cout << "[S] Search\n";

std::cout << "[R] Remove\n";

std::cout << "[Q] Quit\n";

switch (choice ("AVSRQ"))

{

case 0: add(); break;

case 1: view(); break;

case 2: search(); break;

case 3: remove(); break;

default: return 0;

}

}

}

void add ()

{

std::cout << "\nAdd Cellphone\n\n";

Cellphone phone;

phone.product_id = get_string ("Product ID");

phone.product_no = get_string ("Product #");

phone.country = get_string ("Country");

phone.brand = get_string ("Brand");

phone.cost = get_double ("Cost");

cellphones[phone.product_id] = phone;

std::cout << std::endl;

}

void remove ()

{

std::cout << "\nRemove Cellphone\n\n";

std::string id = get_string ("Product ID");

cellphones.erase (id);

}

void search ()

{

std::cout << "\nSearch for Cellphone\n\n";

std::string id = get_string ("Product ID");

std::map<std::string, Cellphone>::const_iterator it = cellphones.find (id);

if (it choices.npos)

continue;

return pos;

}

}

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C plus plus code for selling cellular phones it should be able to add view search and delete Product ID No Product No country brand and cost?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Do you lose music from i tunes if you put it on a non-apple product?

No, not unless you delete it from your computer


How do i delete my amazon shopping basket list?

Open the basket, and look for the item you wish to remove. Click on Delete, which is shown underneath the product description.


What experiments did Apollo 11 do on the moon?

Delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete delete


How do yew delete staircases in Sims 2 Double deluxe cause i want to delete this one staircase and put in an elevator but it wont let me delete them i have tried control delete and move objects on?

try moving all objects out of the vicinity of the stair case. make sure that there are no objects "glitched" into being to close to the staircase. if this doesnt work try deleting some walls and selling it then.


How do you delete competitor post negative reviews?

If there are negative posts of product reviews from the competitor the owner of the site can delete them. Go into the main part of the website and click on edit. This is where the negative comments can be deleted. Sometimes each comment will have an edit section and the owner can delete the negative comments from there.


What do you use to clear an active cell in Excel?

The Delete key.The Delete key.The Delete key.The Delete key.The Delete key.The Delete key.The Delete key.The Delete key.The Delete key.The Delete key.The Delete key.


What query will delete all the records satisfying the criteria enter in the query?

A delete query.A delete query.A delete query.A delete query.A delete query.A delete query.A delete query.A delete query.A delete query.A delete query.A delete query.


Can you delete a profile on iPod touch?

Yes you can, and before you sell an ipod it is a good idea to delete everything on before you sell it. I would recomend selling an ipod to a friend if a friend wants an ipod that way you know who your ipod is going to and you know they are not a scammer. Sorry If i went off topic


Where can someone find information on how to properly delete files from a computer?

There is a product available which will properly delete files from a computer. This product is called a Compact Disk Eraser and it permanently wipes computer disks.


How do you delete iPad games?

Go to Settings &gt; General &gt; Usage There you will see a list of all the apps that are using space on you iPad. Just click the game you want to delete, and it will display a large, red DELETE button.


Why can't you go back to the old Pixie Hollow when you could delete fairy's and make three fairy's?

Unfortunately Disney has taken these options from the site, but you can still make three fairies and delete them on the other country versions.


What is the command to delete?

Delete command is a DML. Syntax of delete command is delete from table_name where &lt;&gt;; It is to delete content of table.