Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Program From Pseudocode (TCO 1) This exercise will be to use pseudocode

ID: 3809718 • Letter: C

Question

Create a Program From Pseudocode (TCO 1)

This exercise will be to use pseudocode (in the form of comments) to write a program that creates and initializes the variables for a computer role-playing game character generator. This will only set up the variables. It is slightly different from our iLab assignment. You can make up your own variable names.

Here is the pseudocode.

// Week 1 Assignment-3

// Description: Setup Variables for CRPG Character Generator

//----------------------------------

//**begin #include files************

#include <iostream> // provides access to cin and cout

//--end of #include files-----------

//----------------------------------

//**begin global constants**********

//--end of global constants---------

//----------------------------------

using namespace std;

//----------------------------------

//**begin main program**************

int main()

{

       //**Enter code staring here

       // Create Variables

       // character ID [integer] initialized to 0

       // strength [integer] initialized to 80

       // armor [integer] initialized to 70

       // health [float] initialized to 1.0f

       // flag to indicate if the character is dead or alive [Boolean] initialized to true

       // Print out each of the variables.

       //**End of your code

       // Wait for user input to close program when debugging.

       cin.get();

       return 0;

}

//--end of main program-------------

//----------------------------------

Explanation / Answer

Here is the code for you:

// Week 1 Assignment-3
// Description: Setup Variables for CRPG Character Generator
//----------------------------------

//**begin #include files************
#include <iostream> // provides access to cin and cout
//--end of #include files-----------
//----------------------------------

//**begin global constants**********

//--end of global constants---------
//----------------------------------

using namespace std;
//----------------------------------

//**begin main program**************
int main()
{
//**Enter code staring here
// Create Variables
// character ID [integer] initialized to 0
int ID = 0;
// strength [integer] initialized to 80
int strength = 80;
// armor [integer] initialized to 70
int armor = 70;
// health [float] initialized to 1.0f
float health = 1.0f;
// flag to indicate if the character is dead or alive [Boolean] initialized to true
bool alive = true;
// Print out each of the variables.
cout <<"ID: "<<ID<<endl;
cout<<"Armor: "<<armor<<endl;
cout<<"Health: "<<health<<endl;
cout<<"Alive?: "<<alive<<endl;
//**End of your code
// Wait for user input to close program when debugging.
cin.get();
return 0;
}
//--end of main program-------------
//----------------------------------