GSP115 Week 2 Assignment: Part A,B,C with Visual Studio 2012 source code,word document that include answers and screenshots – Instant Delivery – Perfect Solution

Lab Price = $12
Please feel free to send us your queries at: support@iqrajavaid.com
Payment methods

Add to Cart

Buy Now

View Cart


Problem Statement

Week 2: Complex Data Types
Instructions
Complete the following assignments. Copy and paste your finished code into a Word document, clearly identifying which assignment it is. Also, capture the output of the program and paste that into the Word document. If there are questions to be answered, put the answers after the output. When you complete all three of this week’s assignments, save the document as yourLastName_GSP115_W2_Assignments.docx. Submit it to the Week 2 assignment Dropbox.
1. Compile Time Bugs (TCOs 2, 4, 5, and 6)
Find and fix the compile time bugs in the code at the end of this section. Compile time bugs show as errors when you compile, but the Visual Studio IDE also gives you visual clues in the form of red squiggly underlines, as shown here . Be aware that not every line that is marked as an error is actually an error. For example, if something causes one of your variables to not be created, such as forgetting to add the data type when you create it, everywhere in your code that references that variable will show an error. Fix the problem so your variable is created and the errors where the variable is referenced go away. You should work on bugs starting at the top of your code (that’s the order the compiler presents them to you). Fix the first line with a bug and then recompile. Often, this will clear additional errors. You may have to make some assumptions about what was actually intended. That’s OK. When the code compiles, run it and get a screen capture of the output.
Here is the code.
// Week 2 Assignment-1
// Description: Compile time errors in C Strings, Arrays, std:string,
// struct, enum, pointers, and std::array.
//———————————-

//**begin #include files************
#include // provides access to cin and cout
#include <> // provides access to std:array
#include // required for getline

//–end of #include files———–
//———————————-

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

//**begin global constants**********
const int arraySize = 4; // **there is a subtle bug here (needs “const”)
enum MyEnum // Needs to be before the struct that uses it
{
Dog, Cat, Fish, Squirrel
};

struct MyStruct
{
int a;
float b;
string c;
MyEnum d;
};

//–end of global constants———
//———————————-

//**begin main program**************
int main()
{
// Initialization
char myCString[arraySize] = {0};
char myOtherCString[] = {‘Yet another string’};
int myInt[3] = {27, 39, 0, 42};
string myString;
MyStruct aStruct = { 4,3.5,Dog ,”Dogs”};
int x;
int * pX = x;
array Animals;
// Storing values in uninitialized variables
myCString[0] = “A”;
myString = “A third string”;
x = 4;
for (int i = 0; iAfter creating and allocating memory for nArray.” << endl; cout << " nArray address is <" << nArray << "> and contains the value ” << hex << *nArray << dec << endl; for (int i = 0; i < arraySize; i++) { nArray[i] = i*i; } cout << " --->After initializing nArray.” << endl; cout << " nArray address is <" << nArray << "> and contains the value ” << hex << *nArray << dec << endl << endl; for (int i = 0; i < arraySize; i++) { cout << " nArray[" << i << "] = " << nArray[i] << " at address <" << nArray+i << ">” << endl; } // You'll need a command here to fix the memory leak cout << endl << " --->Before reallocating memory for nArray.” << endl; cout << " nArray address is <" << nArray << "> and contains the value ” << hex << *nArray << endl; nArray = new int[arraySize + 2]; cout << dec << " --->After reallocating memory for nArray.” << endl; cout << " nArray address is <" << nArray << "> and contains the value ” << hex << *nArray << dec << endl; for (int i = 0; i < arraySize+2; i++) { nArray[i] = i*i; } cout << endl << " --->After reinitializing nArray.” << endl; cout << " nArray address is <" << nArray << "> and contains the value ” << hex << *nArray << dec << endl << endl; for (int i = 0; i < arraySize+2; i++) { cout << " nArray[" << i << "] = " << nArray[i] << " at address <" << nArray+i << ">” << endl; } // . . . and also here. cout << endl << " --->Getting ready to close down the program.” << endl; cout << " nArray address is <" << nArray << "> and contains the value ” << hex << *nArray << dec << endl; // Wait for user input to close program when debugging. cin.get(); return 0; } //--end of main program------------- //---------------------------------- 3. Create a Program From Pseudocode (TCOs 1, 2, 4, 5, and 6) 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. The difference from last week is that you must put your character attributes in a structure. You can make up your own variable names. Here is the pseudocode. // Week 2 Assignment-3 // Description: CRPG Character attributes using a struct //---------------------------------- //**begin #include files************ #include // 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 structure
// initialize structure data members
// 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 data members in the structure.
//**End of your code
// Wait for user input to close program when debugging.
cin.get();
return 0;
}
//–end of main program————-
//———————————-

Relevant Material
Screenshots
Assignment 2: Part B
Assignment 2: Part B

Assignment 2: Part C
Assignment 2: Part C
Assignment 2: Part A
Assignment 2: Part A
Instructions
* If you want to purchase multiple products then click on “Buy Now” button which will give you ADD TO CART option.Please note that the payment is done through PayPal.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at support@iqrajavaid.com.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at support@iqrajavaid.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at support@iqrajavaid.com.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Privacy Policy
We take your privacy seriously and will take all measures to protect your personal information.
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
Refund Policy
Incase you face any issues with the tutorial, please free to contact us on support@iqrajavaid.com
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.
Payment Details
Lab Price = $12
Please feel free to send us your queries at: support@iqrajavaid.com

Payment methods

Add to Cart

Buy Now

View Cart

Leave a Reply