Question
$1.00 C++..creating a game..Battleship
- From Computer-Science: Object-Oriented-Programming , Engineering: Computer-Engineering
- Closed, but you can still post tutorials
- Due on Jul. 13, 2009
- Asked on Jul 12, 2009 at 10:10:48PM
Q:
C++, creating a game: Battleship
Our class project is to create a program to play a simple game called Battleship (a popular board game).
The output screen is to show a 10x10 grid. Each element of the grid will display white 's in all 100 spaces. The user can a ship (for example, a submarine would use 4 , either horizontal or vertical).
When the opponent a occupied by the user's ship, a red would replace the . If the opponent misses, a yellow would replace the original white . I would like a very simple program to display this grid and perform those tasks.
Please include plenty of comments and use the simplest form of programming possible.
Thanks!
Our class project is to create a program to play a simple game called Battleship (a popular board game).
The output screen is to show a 10x10 grid. Each element of the grid will display white 's in all 100 spaces. The user can a ship (for example, a submarine would use 4 , either horizontal or vertical).
When the opponent a occupied by the user's ship, a red would replace the . If the opponent misses, a yellow would replace the original white . I would like a very simple program to display this grid and perform those tasks.
Please include plenty of comments and use the simplest form of programming possible.
Thanks!
I made it up very fast...but it is cool....Take Care...:)
- This tutorial was purchased 4 times and rated A+ by students like you.
- Posted on Jul 13, 2009 at 6:08:16PM
A:
Preview: ... have done so much work on ...
Attachments:
BattleShip.cpp (4K)
The full tutorial is about 20 words long plus attachments.

Attachments:
BattleShip.cpp (4K)
A++ solution with Screenshot - Visual C++ 2010 - Detailed comment
- This tutorial hasn't been purchased yet.
- Posted on Nov 22, 2012 at 5:53:27PM
A:
Preview: ... C++ 2010 - D ...
Attachments:
BattleShip_Screenshot.jpg (58K) (Preview)
BattleShipProject.zip (715K)
[
BattleShipProject/BattleShipProject.sln
BattleShipProject/BattleShipProject.suo
BattleShipProject/BattleShipProject/BattleShipProject.cpp
BattleShipProject/BattleShipProject/BattleShipProject.vcxproj
BattleShipProject/BattleShipProject/BattleShipProject.vcxproj.filters
BattleShipProject/BattleShipProject/BattleShipProject.vcxproj.user
BattleShipProject/BattleShipProject/Debug/BattleShipProject.exe.embed.manifest
BattleShipProject/BattleShipProject/Debug/BattleShipProject.exe.embed.manifest.res
BattleShipProject/BattleShipProject/Debug/BattleShipProject.exe.intermediate.manifest
BattleShipProject/BattleShipProject/Debug/BattleShipProject.lastbuildstate
BattleShipProject/BattleShipProject/Debug/BattleShipProject.log
BattleShipProject/BattleShipProject/Debug/BattleShipProject.obj
BattleShipProject/BattleShipProject/Debug/BattleShipProject.pch
BattleShipProject/BattleShipProject/Debug/BattleShipProject_manifest.rc
BattleShipProject/BattleShipProject/Debug/cl.command.1.tlog
BattleShipProject/BattleShipProject/Debug/CL.read.1.tlog
BattleShipProject/BattleShipProject/Debug/CL.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link-cvtres.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link-cvtres.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6684-cvtres.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6684-cvtres.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6684.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6684.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6936-cvtres.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6936-cvtres.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6936.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6936.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link.command.1.tlog
BattleShipProject/BattleShipProject/Debug/link.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link.write.1.tlog
BattleShipProject/BattleShipProject/Debug/mt.command.1.tlog
BattleShipProject/BattleShipProject/Debug/mt.read.1.tlog
BattleShipProject/BattleShipProject/Debug/mt.write.1.tlog
BattleShipProject/BattleShipProject/Debug/rc.command.1.tlog
BattleShipProject/BattleShipProject/Debug/rc.read.1.tlog
BattleShipProject/BattleShipProject/Debug/rc.write.1.tlog
BattleShipProject/BattleShipProject/Debug/stdafx.obj
BattleShipProject/BattleShipProject/Debug/vc100.idb
BattleShipProject/BattleShipProject/Debug/vc100.pdb
BattleShipProject/BattleShipProject/ReadMe.txt
BattleShipProject/BattleShipProject/stdafx.cpp
BattleShipProject/BattleShipProject/stdafx.h
BattleShipProject/BattleShipProject/targetver.h
BattleShipProject/Debug/BattleShipProject.exe
BattleShipProject/Debug/BattleShipProject.ilk
BattleShipProject/Debug/BattleShipProject.pdb
]
The full tutorial is about 11 words long plus attachments.

Attachments:
[
BattleShipProject/BattleShipProject.sln
BattleShipProject/BattleShipProject.suo
BattleShipProject/BattleShipProject/BattleShipProject.cpp
BattleShipProject/BattleShipProject/BattleShipProject.vcxproj
BattleShipProject/BattleShipProject/BattleShipProject.vcxproj.filters
BattleShipProject/BattleShipProject/BattleShipProject.vcxproj.user
BattleShipProject/BattleShipProject/Debug/BattleShipProject.exe.embed.manifest
BattleShipProject/BattleShipProject/Debug/BattleShipProject.exe.embed.manifest.res
BattleShipProject/BattleShipProject/Debug/BattleShipProject.exe.intermediate.manifest
BattleShipProject/BattleShipProject/Debug/BattleShipProject.lastbuildstate
BattleShipProject/BattleShipProject/Debug/BattleShipProject.log
BattleShipProject/BattleShipProject/Debug/BattleShipProject.obj
BattleShipProject/BattleShipProject/Debug/BattleShipProject.pch
BattleShipProject/BattleShipProject/Debug/BattleShipProject_manifest.rc
BattleShipProject/BattleShipProject/Debug/cl.command.1.tlog
BattleShipProject/BattleShipProject/Debug/CL.read.1.tlog
BattleShipProject/BattleShipProject/Debug/CL.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link-cvtres.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link-cvtres.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6684-cvtres.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6684-cvtres.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6684.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6684.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6936-cvtres.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6936-cvtres.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6936.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link.6936.write.1.tlog
BattleShipProject/BattleShipProject/Debug/link.command.1.tlog
BattleShipProject/BattleShipProject/Debug/link.read.1.tlog
BattleShipProject/BattleShipProject/Debug/link.write.1.tlog
BattleShipProject/BattleShipProject/Debug/mt.command.1.tlog
BattleShipProject/BattleShipProject/Debug/mt.read.1.tlog
BattleShipProject/BattleShipProject/Debug/mt.write.1.tlog
BattleShipProject/BattleShipProject/Debug/rc.command.1.tlog
BattleShipProject/BattleShipProject/Debug/rc.read.1.tlog
BattleShipProject/BattleShipProject/Debug/rc.write.1.tlog
BattleShipProject/BattleShipProject/Debug/stdafx.obj
BattleShipProject/BattleShipProject/Debug/vc100.idb
BattleShipProject/BattleShipProject/Debug/vc100.pdb
BattleShipProject/BattleShipProject/ReadMe.txt
BattleShipProject/BattleShipProject/stdafx.cpp
BattleShipProject/BattleShipProject/stdafx.h
BattleShipProject/BattleShipProject/targetver.h
BattleShipProject/Debug/BattleShipProject.exe
BattleShipProject/Debug/BattleShipProject.ilk
BattleShipProject/Debug/BattleShipProject.pdb
]