-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomItem.cpp
More file actions
44 lines (40 loc) · 1.02 KB
/
Copy pathCustomItem.cpp
File metadata and controls
44 lines (40 loc) · 1.02 KB
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
#include "IceCreamItem.h"
#include "IceCreamOrder.h"
#include "CustomItem.h"
#include <string>
#include <iostream>
#include <string>
#include <iostream>
#include <iomanip>
#include <sstream>
using namespace std;
std::string CustomItem::composeItem()
{
ostringstream str;
str << "Custom Size: " << size << "\nToppings:\n";
map<string, int>::iterator it;
it = cream.begin();
while(it != cream.end())
{
str << it->first << ": " << it->second << " oz\n";
it++;
}
str << "Price: $" << showpoint << setprecision(3) << price << "\n";
string ord;
ord = str.str();
return ord;
/*std::string str;
str += "Custom Size: ";
str += size;
str += "\nToppings: ";
for(auto i = cream.begin(); i != cream.end(); i++)
{
str += i->first;
str += ":";
str+= std::to_string(i->second);
str += " oz\n";
}
str += "Price: $";
str += std::to_string(price);
*/
}