Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Solutions/maaaaaaaax12/Game Shop/Part 1/Main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "Shop.h"

int main()
{
Item* Exalibur = new Item("Excalibur", "The legendary sword of King Arthur", 12, 1024);
Exalibur->Describe();

Item STeel_Armor("Steel Armor", "Protective covering made by steel", 15, 805);
STeel_Armor.Describe();
}
19 changes: 19 additions & 0 deletions Solutions/maaaaaaaax12/Game Shop/Part 1/Shop.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "Shop.h"

#include <iostream>
#include <iomanip>

Item::Item(string name, string description, int weight, int value)
:name(name), description(description), weight(weight), value(value)
{

}

void Item::Describe()
{
cout.setf(ios::left);
cout << setw(13) << "Name" << "= " << name << endl;
cout << setw(13) << "Description" << "= " << description << endl;
cout << setw(13) << "Weight" << "= " << weight << endl;
cout << setw(13) << "Value" << "= " << value << endl;
}
17 changes: 17 additions & 0 deletions Solutions/maaaaaaaax12/Game Shop/Part 1/Shop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include <string>
using namespace std;

class Item
{
private:
string name;
string description;
int weight;
int value;

public:
Item(string name, string description, int weight, int value);
void Describe();
};