Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <vector>
- class Jogador {
- public:
- Jogador(int number
- , std::string name
- , std::string position) : m_number{number}
- , m_name{name}
- , m_position{position} {}
- void Print() {
- std::cout << m_number << "," << m_name << "," << m_position << std::endl;
- }
- int getNumber() const;
- std::string getName() const;
- std::string getPostition() const;
- protected:
- int m_number = -1;
- int op{-1};
- std::string m_name;
- std::string m_position;
- };
- void Print() {
- std::cout << m_number << "," << m_name << "," << m_position << std::endl;
- }
- int Jogador::getNumber() const{
- return m_number;
- }
- std::string::getName() const{
- return m_name;
- }
- std::string::getPostition const{
- return m_position;
- }
- int main(int argc, char **argv) {
- int op = -1;
- Jogador j(int number
- , std::string name
- , std::string position);
- while(true){
- std::cout << " (1)prencher vector - (2)Motrar dados do vector" << std::endl;
- std::cin >> op;
- if(op !=2){
- std::ifstream in;
- std::ofstream out;
- std::string line;
- std::vector<Jogador> jogadores;
- out.open("output.txt", std::ios_base::app);
- in.open("FutTeamA.txt");
- while(!in.eof()) {
- int number = -1;
- std::string name;
- std::string position;
- in >> number >> name >> position;
- out << number << " " << name << " " << position << std::endl;
- jogadores.emplace_back(number, name, position);
- }
- break;
- }
- std::cout << "Mostrando dados do vector.............." << std::endl;
- // j.Print(number,name,position);
- j.Print();
- }
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement