[ create a new paste ] login | about

Link: http://codepad.org/lZa2IvaV    [ raw code | fork ]

C, pasted on May 15:
#include <iostream>
#include <string>
#include <map>

static std::map<std::string, int> create_items()
{
    std::map<std::string, int> list;

    list["肉感みちのくディルド"] = 1092;
    list["オルガスター (ピンク)"] = 1262;
    list["一気昇天 玉入り"] = 2370;

    return list;
}

static const std::map<std::string, int> items = create_items();

int main(int ac, char **av)
{
    std::string name;
    std::cout << "商品名を入力: ";
    std::cin >> name;
    std::cout << std::endl;

    std::map<std::string, int>::const_iterator it;
    if ((it = items.find(name)) != items.end()) {
        std::cout << "商品名: " << it->first << " 価格: " << it->second << std::endl;
    } else {
        std::cout << "そのような商品はありません。" << std::endl;
    }

    return 0;
}


Create a new paste based on this one


Comments: