I NEED THESE BY TOMORROW. SUNDAY JULY 26TH ANY TIME THIS DAY

1.Use the bubble sort on the array below and construct the first 3 passes of the sort (assume the sort is from smallest to largest).

19 - 4 91 0 -17

1.

2.

3.

3.What prints when each of the following statements is performed consecutively? Assume the following vaiables declarations:

Char s1[50] = “jack”;

Char s2[50] = “jill”;

Cahrs3[50];

  1. cout < strcpy(s3,s2)endl;
  2. coutstrcat( strcat( strcpy(s3,s1), “ and “), s2) < endl;
  3. coutstrlen(s2) + strlen(s2) < endl;
  4. coutstrlen(s3) < endl;

4. Write a single statement that performs the specified tasks. Assume that floating point variables number1 and number2 have been declared and that number1 has been initialized 7.3. Assume that variable ptr is of type char*. Assume that arrays s1 and s2 are each 100 element char arrays that are initialized with string literals.

-Print the address of number1

-Print the value of number2

–Print theaddress stored infPtr

-Copy the string string stored in array s2 into array s1

-Compare the string in s1 with the string in s2

-Append the first 10 characters from the string in s2 to the string in s1

-Detertmine the length of the string in s1

-Assign to ptrthe location of the first token in s2. The tokens delimitesr are commas (,).

5. -Create a structure that can be used to maintain inventory in a hardware store. It should be contain a string for the items name (hammer, saw etc), the quantity (int) and the price (not as a string, as a double). Structure should be called Tools.

- Show how to create an instance of the structure. Call it hammer.

- Show how to access the price data member of the structure with the variable from 2.

6. What will the following code display?

Enum {HOBBIT, ELF = 7, DRAGON}; error? No key word with enum

Cout < HOBBIT < “ “ < ELF < “ “ < DRAGON < endl;

8.look at following code

Struct Town

{

Char townName[51];

Char countryName[51];

Double population;

Double elevation;

};

Town t = {“Canton”, “Haywood”, 9478};

  1. What value is stored in t.townName?
  2. What value is stored in .countryName?
  3. What value is stored in t.population?
  4. What value is stored in t.elevation?

Choices are:

1. Zero

2. Uninitialized

3. null

9. Write a program segment that defines a file stream object named employee. The file should be opened for both input and output (in binary mode). If the file fails to open, the program segment should display an error message.

10. Create a class definition that meets these requirements. Class name of Tools. Has data (a members for the quantity(int), price(double) and name (string). Accessors and Mutators for the data members. A default constructor that has 3 inputs for the quantity, price and name. there should be NO code.

11. Create an array of 3 Tools (from previous question) objects. It should use the constructor three different ways, one as a default, then two other ways. It should all be done when declaring the array variable.

12. what is the public section of a class declaration known as?

13. Only show the class definition and the functions with NO CODE in the functions. NO CODE ANYWHERE. Design a class called Date. The class should store a date in 3 integers: month, day, and year. There should be member functions to print the date. Show a constructor and the destructor. This should include what the functions would look like in the code file for the class, no code is needed for the function just the header file.

14. Write code that dynamically allocates an array of 20 integers, then uses a loop to allow the iser to enter values for each element of the array.

15. Assume that tempNumbers is a pointer that points to a dynamiically allocated array. Write code that releases the memory used by the array.

16. What would the output from the following? If the user entered “Hello my name is John Smith”

void main()

{

constint SIZE=51; char userString[SIZE];

CinuserString;

CoutuserString;

}

17. Show what the cout statement would be if it used pointer notation instead.

Void main()

{

ConstinT SIZE=5;

Int numbers [SIZE]= {1,2,3,4,5};

Int count;

For (count=0; count <SIZE; count++)

Cout < numbers [count] < endl;

{

Cout< numbers[count] < endl;

}

18. Change the for loop so that it uses pointer and pointer arithmetic instead of array notation.

Void main()

{

Const in SIZE=5

Int numbers [SIZE]= {1,2,3,4,5};

Int* numPtr = numbers;

Int count;

For (count=0; count <SIZE; count++)

Cout < numbers [count] < endl;

}