Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm making a simple Battleship game in C for my programing class. The first part of the assignment is quite simple. I just need to

I'm making a simple Battleship game in C for my programing class. The first part of the assignment is quite simple. I just need to make the welcome screen function displaying the rules of the game. The instructions are as follows.

  1. Create a new C source code file names battleship.c
  1. Write the preprocessor command to include the stdio.h header file from the C library
  2. Write the function declaration or prototype for function welcomeScreen (hint: it is the same method signature of the function with a semi-colon at the end)
  3. Write the main function so it does the following
    1. Return type int
    2. Empty parameter list
    3. Calls function welcomeScreen
    4. Returns 0 to indicate successful operation of the program
  4. Write the function welcomeScreen so it does the following
    1. Return type void
    2. Empty parameter list
    3. Outputs to the screen the name of the game and the instructions.

I've already created the printf statements needed for the welcome screen. They are as follows. The first few may look a bit weird because of the way this question bar works, but they just spell BATTLESHIP in smaller letters.

printf ("BBBBB AAAA TTTTTT TTTTTT LL EEEEEE SSSSS HH HH II PPPP "); printf ("BB BB AA AA TT TT LL EE SS HH HH II PP PP "); printf ("BBBBB AA AA TT TT LL EEEE SSSS HHHHHH II PPPP "); printf ("BB BB AAAAAA TT TT LL EE SS HH HH II PP "); printf ("BBBBB AA AA TT TT LLLLLL EEEEEE SSSSS HH HH II PP "); printf (" "); printf ("RULES OF THE GAME: "); printf ("1. This is a two player game. "); printf ("2. Player 1 is you and Player 2 is the computer. "); printf ("3. Player 1 will be prompted if user wants to manually input coordinates "); printf (" for the game board or have the computer randomly generate a game board "); printf ("4. There are five types of ships to be placed by longest length to the "); printf (" shortest; [c] Carrier has 5 cells, [b] Battleship has 4 cells, [r] Cruiser "); printf (" has 3 cells, [s] Submarine has 3 cells, [d] Destroyer has 2 cells "); printf ("5. The computer randomly selects which player goes first "); printf ("6. The game begins as each player tries to guess the location of the ships "); printf (" of the opposing player's game board; [*] hit and [m] miss "); printf ("7. First player to guess the location of all ships wins ");

All I need is someone to show me what the finished product should look like. Please read the above instructions carefully. The program must also include a detailed comment explaining the function prototype and the function's purpose (to create a welcome screen for the game). Please include the full program in C.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

Students also viewed these Databases questions

Question

What is the timeline for each tactic?

Answered: 1 week ago