1. Tuyển Mod quản lý diễn đàn. Các thành viên xem chi tiết tại đây

Giúp nhanh nào

Chủ đề trong 'Hỏi đáp Tin học' bởi wild_heart246, 20/11/2005.

  1. 0 người đang xem box này (Thành viên: 0, Khách: 0)
  1. wild_heart246

    wild_heart246 Thành viên mới

    Tham gia ngày:
    20/11/2005
    Bài viết:
    4
    Đã được thích:
    0
    Giúp nhanh nào

    Phía dưới là cái đề bài mà mình phải coding cái program cho nó.

    Part II. Arrays

    Let us help the UTEP soccer team count the number of points they won. The results of all the games are stored in a file in which each line represents a score. For example, 5:3 means that the UTEP team scored 5 goals, while the opposite team scored only 3 goals.

    In soccer, a win (like 5:3) brings 2 points, a tie (like 3:3) brings 1 point, and a loss (like 3:5) brings 0 points. The team with the largest number of points wins. If two or more teams get the same number of points, then the referees decide which of these teams is the champion by looking at the overall numbers of goals scored and goals missed by each of these teams.

    Write an application that:

    * asks the user for a name of the file where the scores are stored; you can assume thatKhôngmore than 100 games were played;
    * reads the scores from this file, line by line, into two arrays:
    o array scored, and
    o array missed;
    at the same time, the program should compute the overall number of games played;
    * computes and displays:
    o the overall number of points gained by the UTEP team,
    o the overall number of goals scored by UTEP team, and
    o the overall number of goals lost by UTEP team.

    Example

    If UTEP played 3 games, with scores 5:3, 1:2, and 7:0, then:

    * in the first game, we gained 2 points;
    * in the second game, we gained 0 points; and
    * in the third game, we gained 2 points again.

    The overall number of points gained is thus 2 + 0 + 2 = 4. Also:

    * the overall number of goals scored is 5 + 1 + 7 = 13, and
    * the overall number of goals missed is 3 + 2 + 0 = 5.


    Mình muốn hỏi cái phần in đậm ấy.

    Ý đề bài là thế này:
    Nếu như cái input file chứa mấy cái score như sau:
    4:5
    3:4
    2:1
    Thì value của cái array scored sẽ là : {4,3,2}
    và value của cái array missed sẽ là : {5,4,1}

    Vậy thì làm sao mà ra kết quả như vậy được?
    #BIGCHAR {background: & strDefaultFontColor &; color: DCDCDC; font-size: 16pt; font-family:Arial; }
  2. wild_heart246

    wild_heart246 Thành viên mới

    Tham gia ngày:
    20/11/2005
    Bài viết:
    4
    Đã được thích:
    0
    Không ai giúp tui sao???
  3. Gunblade

    Gunblade Thành viên mới

    Tham gia ngày:
    23/08/2005
    Bài viết:
    975
    Đã được thích:
    0
    Bạn nhờ thầy bạn giải hộ đi
  4. wild_heart246

    wild_heart246 Thành viên mới

    Tham gia ngày:
    20/11/2005
    Bài viết:
    4
    Đã được thích:
    0
    Thế này thì còn hỏi làm gì nữa chứ ?
    Chả nhẽ không ai giải được sao???

Chia sẻ trang này