Emergency in C++

Discussion in 'Computer Science & Culture' started by nhoc12002, Apr 16, 2007.

Thread Status:
Not open for further replies.
  1. nhoc12002 Registered Member

    Messages:
    1
    Everyone knows how to solve this Problem?:bawl:

    Write a program to play a game in which you try to sink a fleet of five navy vessels by guessing their locations on a grid. The program uses random numbers to position its ships on a 15 x 15 grid. The ships are of different lengths as follows:
    Frigate: 2 locations
    Tender: 2 locations
    Destroyer: 3 locations
    Cruiser: 3 locations
    Carrier: 4 locations
    The program must pick one square as the starting location, then pick the direction of the ship on the board, and mark off the number of squares in that direction to represent the size of the ship. It must not allow a ship to overlap with another ship, or to run off the board.
    The user enters coordinates in the range of 1 through 15 for rows and A through O for columns. The program checks this location, and reports whether it is a hit or a miss. If it is a hit, the program also checks whether the ship has been hit in every location that it occupies. If so, the ship is reported as sunk, and the program identifies which ship it is. The user gets 60 shots to attempt to sink the fleet. If the user sinks all of the ships before using all 60 shots, then he or she wins the game. At the end of the game, the program should output the grid, so that the user can see where the ships are located.
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Stryder Keeper of "good" ideas. Valued Senior Member

    Messages:
    13,105
    Don't expect people to write out your "Homework" since Plagiarism is one of the worst forms of theft.

    I'm sure you've already been taught about the software lifecycle and know how to pseudocode, which is really where you should start. Then it's just a process of converting your pseudocode that should follow the logic of how to program the example program into C++.

    Somebody writing the output program that you require won't necessarily give you the pseudocode to go with it, meaning even if you cheat and got away with it, you'd end up with low marks.

    So I suggest you swat up a bit and do the work yourself.

    (If you get stuck during your coding, or your pseudocoding I'm sure people will give you aid just don't expect them to do your work)
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. RubiksMaster Real eyes realize real lies Registered Senior Member

    Messages:
    1,646
    Yes, I had to do that for my first Computer Science class too. If you can't do it, it's not because you are dumber than everyone else, it's just because you haven't made an effort yet.

    Do your best to get started. Come up with a basic design or a class hierarchy. Then try to flesh it out and write actual code. If you get stuck, I or someone else can help you with the specifics, but nobody is going to start with your project requirements and then deliver your final product.

    Plus, I'm sure your school has an academic honesty policy that this is almost surely violating.
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
Thread Status:
Not open for further replies.

Share This Page