mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 04:12:13 +00:00
Fixed issue263, fixed the usage of c functions in cpp
This commit is contained in:
parent
421fbddb60
commit
d7d17eaa61
@ -1,41 +1,41 @@
|
|||||||
#include <cstdio>
|
#include <iostream>
|
||||||
#include "GildedRose.h"
|
#include "GildedRose.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
print_item(Item *item)
|
print_item(Item& item)
|
||||||
{
|
{
|
||||||
return printf("%s, %d, %d\n", item->name.c_str(), item->sellIn, item->quality);
|
return std::cout << item.name << ", " << item.sellIn << ", " item.quality << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
vector<Item> items;
|
vector<Item> items;
|
||||||
|
|
||||||
items.emplace_back("+5 Dexterity Vest", 10, 20);
|
items.push_back({"+5 Dexterity Vest", 10, 20});
|
||||||
items.emplace_back("Aged Brie", 2, 0);
|
items.push_back({"Aged Brie", 2, 0});
|
||||||
items.emplace_back("Elixir of the Mongoose", 5, 7);
|
items.push_back({"Elixir of the Mongoose", 5, 7});
|
||||||
items.emplace_back("Sulfuras, Hand of Ragnaros", 0, 80);
|
items.push_back({"Sulfuras, Hand of Ragnaros", 0, 80});
|
||||||
items.emplace_back("Sulfuras, Hand of Ragnaros", -1, 80);
|
items.push_back({"Sulfuras, Hand of Ragnaros", -1, 80});
|
||||||
items.emplace_back("Backstage passes to a TAFKAL80ETC concert", 15, 20);
|
items.push_back({"Backstage passes to a TAFKAL80ETC concert", 15, 20});
|
||||||
items.emplace_back("Backstage passes to a TAFKAL80ETC concert", 10, 49);
|
items.push_back({"Backstage passes to a TAFKAL80ETC concert", 10, 49});
|
||||||
items.emplace_back("Backstage passes to a TAFKAL80ETC concert", 5, 49);
|
items.push_back({"Backstage passes to a TAFKAL80ETC concert", 5, 49});
|
||||||
|
|
||||||
// this Conjured item doesn't yet work properly
|
// this Conjured item doesn't yet work properly
|
||||||
items.emplace_back("Conjured Mana Cake", 3, 6);
|
items.push_back({"Conjured Mana Cake", 3, 6});
|
||||||
|
|
||||||
puts("OMGHAI!");
|
std::cout << "OMGHAI!" << std::endl;
|
||||||
|
|
||||||
GildedRose app(items);
|
GildedRose app(items);
|
||||||
|
|
||||||
for (int day = 0; day <= 30; day++)
|
for (int day = 0; day <= 30; day++)
|
||||||
{
|
{
|
||||||
printf("-------- day %d --------\n", day);
|
std::cout << "-------- day " << day << " --------" << std::endl;
|
||||||
printf("name, sellIn, quality\n");
|
std::cout << "name, sellIn, quality" << std::endl;
|
||||||
for (auto & item : items)
|
for (auto& item : items)
|
||||||
{
|
{
|
||||||
print_item(&item);
|
print_item(&item);
|
||||||
}
|
}
|
||||||
printf("\n");
|
std::cout << std::endl;
|
||||||
app.updateQuality();
|
app.updateQuality();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user