[ create a new paste ] login | about

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

C++, pasted on Dec 18:
#include <iostream>
#include <vector>
#include <string>

class Team {
public:
 Team(const std::string& name) {
  m_name = name;
 }
 void askStadium() {
  std::cout << "Does team " << m_name << " plays in his stadium?" << std::endl;
  int answer;
  cin >> answer;
  if(answer == 0)
   m_data[0] = 0.2;
  else
   m_data[0] = 0;
 }
private:
 std::string m_name;
 float m_data[5];
};

int main()
{
 std::vector<Team> teams;
 teams.push_back(Team("Vasco"));
 teams.push_back(Team("Flamengo"));
 teams.push_back(Team("Corinthias"));
 
 for(unsigned int i = 0; i < teams.size(); ++i) {
  teams[i].askStadium();
 }
 return 0;
}


Output:
1
2
3
Does team Vasco plays in his stadium?
Does team Flamengo plays in his stadium?
Does team Corinthias plays in his stadium?


Create a new paste based on this one


Comments: