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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "Champion_Info.h"
using namespace std;
Champ_Info::Champ_Info()
{
}
void Champ_Info::getName()
{
cout << "Enter champion name: " << endl;
getline(cin, champName);
}
void Champ_Info::getItems()
{
string item_name;
cout << "Enter name for:" << endl;
cout << "first item: " << endl;
//getline(cin, item1);
getline(cin, item_name);
items.push_back(item_name);
cout << "second item: " << endl;
//getline(cin, item2);
getline(cin, item_name);
items.push_back(item_name);
cout << "third item: " << endl;
//getline(cin, item3);
getline(cin, item_name);
items.push_back(item_name);
cout << "fourth item: " << endl;
//getline(cin, item4);
getline(cin, item_name);
items.push_back(item_name);
cout << "fifth item: " << endl;
//getline(cin, item5);
getline(cin, item_name);
items.push_back(item_name);
cout << "sixth item: " << endl;
//getline(cin, item6);
getline(cin, item_name);
items.push_back(item_name);
}
void Champ_Info::print()
{
cout << champName << ": ";//<< item1 << ", " << item2 << ", " << item3 << ", " << item4 << ", " << item5 << ", " << item6 << "." << endl;
for(int i = 0; i < 6; i++)
{
if(i == 5)
{
cout << items[5] << "." << endl;
}
else
{
cout << items[i] << ", ";
}
}
}
void Champ_Info::file()
{
fstream fout;
fout.open("Lol.txt", fstream::out | fstream::app);
if(fout.fail())
{
cout << "Error, could not open" << endl;
}
fout << champName << ": ";//<< item1 << ", " << item2 << ", " << item3 << ", " << item4 << ", " << item5 << ", " << item6 << "." << endl;
for(int i = 0; i < 6; i++)
{
if(i == 5)
{
fout << items[5] << "." << endl;
}
else
{
fout << items[i] << ", ";
}
}
}
//Don't know how to input info from file to
//the vector champions made in main
/*
void input()
{
string temp;
ifstream fin;
fin.open("Lol.txt");
if(fin.fail())
{
cout << "Error, file could not open or does not exist" << endl;
}
while(fin.good())
{
getline(fin, temp, ':');
champName = temp;
getline(fin, temp, ',');
items.push_back(temp);
getline(fin, temp, ',');
items.push_back(temp);
getline(fin, temp, ',');
items.push_back(temp);
getline(fin, temp, ',');
items.push_back(temp);
getline(fin, temp, ',');
items.push_back(temp);
getline(fin, temp, '.');
items.push_back(temp);
}
}
*/
//to be implimented later
void Sort()
{
}
//to be implimented later
void Edit()
{
}
Champ_Info::~Champ_Info()
{
}
|