C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[56739] Re:C++ 백터를 이용해서 야구선수 데이터로 검색해서 찾아내는 프로그램을 만드는중인데..
김상면 [windyboy] 1310 읽음    2009-04-25 00:43
class Player
{
  public:

    Player();

    struct info
    {
      char team[3];
      char name[20];
      int bats;
      int hits;
      int doubles;
      int triples;
      int homeruns;
      double batAve;
      double slugPct;
    } mem; <================

    vector<info> data;
  };


다른건 모르겠고 선언만 있지..변수 선언이 없어서 그런게 아닌가요?
그럼


질문 님이 쓰신 글 :
: 클래스를 쓰고 백터를 활용해서..
:
: 야구선수 데이터로 팀이름으로 검색하면 팀이름선수정보 다나오게하기
:
: 이름으로 찾으면 그선수에 대한 정보 나오게 하기
:
: 이렇게 검색할수 있게해야되는데
:
: 현재 시작부터 잘 안되네요;
:
: 데이터 파일을 불러올 함수를 만드는중인데
:
: istream& operator>>( istream& in, Player& player)
: 이 함수 부분에서 컴파일 하면 자꾸 temp 랑 data 가 선언이 안되어있다고 하고..
:
: info data 도 안먹히네요;
:
: 데이터는 대략 이런식 입니다
:
: --------------------------------------------------------
:
: 팀 선수 배트 히트 더블 트리플 홈런 (이순서예요;)
:
: --------------------------------------------------------
:
: BAL Jay Payton 338 82 10 2 7
: FLA Chris Volstad 26 3 2 0 0
: BOS Jason Varitek 423 93 20 0 13
: BOS J.D. Drew 368 103 23 4 19
: STL Chris Carpenter 5 0 0 0 0
: CHW Paul Konerko 438 105 19 1 22
: COL Jason Hirsh 4 0 0 0 0
: MIL Mike Rivera 62 19 5 0 1
: --------------------------------------------------------
:
: 이건 제가 지금 쓴 코드구요;
:
: 위에서말한 선언안되있다는 부분이랑
:
: 그 데이터파일로 어떻게 팀이름 치면 팀 선수 다나오게하고 그런것도 좀
:
: 설명과 해결방법좀 도와주셨으면 합니다 ㅠㅠ
:
:
:
:
:
: #ifndef PLAYER_
: #define PLAYER_
:
: using namespace std;
:
: #include <iostream>
: #include <fstream>
: #include <string>
: #include <vector>
:
:
: class Player
: {
:   public:
:
:     Player();
:
:     struct info
:     {
:       char team[3];
:       char name[20];
:       int bats;
:       int hits;
:       int doubles;
:       int triples;
:       int homeruns;
:       double batAve;
:       double slugPct;
:     };
:
:     vector<info> data;
:   };
:   
: ostream& operator<<( ostream& out, const Player& player);
:
: istream& operator>>( istream& in, Player& player);
:
: /*--------------------------------------------------------------------------
:      Name: operator>>
:      Purpose: 
:      Receive: 
:      Return:  
: -------------------------------------------------------------------------*/
: istream& operator>>( istream& in, Player& player)
: {
:   ifstream InStream;
:   string InFile;
:   cin>>InFile;
:   InStream.open( InFile.c_str(), ios::in );
:
:   info temp;
:   if (InStream.fail())
:   {
:     cerr<<"\n*** Unable to read from '"<<InFile<<"' ***\n\n";
:     exit( 1 );
:   }
:   else
:   {
:     while (!InStream.eof())
:     {
:       InStream>>temp.team;
:       InStream>>temp.name;
:       InStream>>temp.bats;
:       InStream>>temp.hits;
:       InStream>>temp.doubles;
:       InStream>>temp.triples;
:       InStream>>temp.homeruns;
:       InStream>>temp.batAve;
:       data.push_back(temp);
:     }
:   
:   }
:   return in;
: }
:
: #endif
:
:
: 제가 하고있는 과제 출처는 여깁니다..
: http://www.cse.msu.edu/~cse232/Projects/project10

+ -

관련 글 리스트
56736 C++ 백터를 이용해서 야구선수 데이터로 검색해서 찾아내는 프로그램을 만드는중인데.. 질문 1218 2009/04/24
56739     Re:C++ 백터를 이용해서 야구선수 데이터로 검색해서 찾아내는 프로그램을 만드는중인데.. 김상면 1310 2009/04/25
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.