Explore BrainMass


C++ List

Write C++ code that does the following:  Create a list with the elements: 43,67,11,78 and 52  Add item 60 to the list  Sort the list in descending order  Delete item 52  Use Binary Search to find item 70 in the list Sample output shown: Printing the 5 elements in the list...

Two Dimensional Array

Write a C++ program that uses a two dimensional array, testgrades[][], for 10 students and scores from 5 tests.  Write a function initializeArray(), which will initialize the array to the following values o 1,75,65,85,90,60 o 2,70,85,90,60,70 o 3,65,68,73,83,95 o 4,86,92,73,89,64 o 5,78,89,72,63,97 o 6,65,93,83,

Recursion C++

Consider the following function: int Func(int x) { if(x == 0) return 2; else if(x == 1) return 3; else return (Func(x - 1) + Func(x - 2)); } What is the output of the following statements? a. cout<<Func(0)<<endl; b. cout<<Func(1)<<endl; c. cout<<Func(2)<<endl; d. cout<<Func(5)<<endl;

Recursion C++

Consider the following recursive function. int mystery(int number) { if(number == 0) return number; else return(number + mystery(number - 1)); } a. Identify the base case. b. Identify the general case. c. What valid values can be passed as parameters to the function mystery? d. If mystery(0) is a valid call,

linked list and output of the c++ statements

What is the output of the following C++ statements? See attached file for full problem description. 2. What is the output of the following C++ statements? a. cout<<list->info; b. cout<<A->info; c. cout<<B->link->info; d. cout<<list->link->link->info; 5. Write C++ statements to do the following: a. Make A poin

Election Vote Program in C++

1. Write a program that allows the user to enter the last names of five candidates in a local election and the votes received by each candidate. The program should then output each candidate's name, the votes received by that candidate, and the percentage of the total votes received by the candidate. Your program should also

Data Structures C++

13. Suppose that vecList is a vector container and vecList = {12, 16, 8, 23, 40, 6, 18, 9, 75} Show vecList after the following statement executes: copy(vecList.begin() + 2, vecList.end(), vecList.begin()); 14. Suppose that vecList is a vector container and vecList = {12, 16, 8, 23, 40, 6, 18, 9, 75} Show vecList after the

Data Structures C++

4. Write a statement that declares and stores the elements of the following array into a vector object: char vowels[5] = {'a', 'e', 'i', 'o', 'u'}; 8. What is the output of the following program segment? (Assume that screen is an ostream iterator initialized to the standard output device to output elements of the type

Data Structures C++

Explain the difference between a shallow copy and a deep copy of data. a. Overload the operator + for the class newString to perform string concatenation. For example, if s1 is "Hello" and s2 is "there", the statement s3 = s1 + s2; should assign "Hello there" to s3, where s1, s2 and s3 are newString objects. b. Overload t

Data Structures C++

Let us say that ip is a pointer pointing to an item in an integer array. Which of the following expressions point to the valid items within the array? ip[-2] or ip[2]? Why?

Data Structures C++

Suppose that a class employeeType is derived from the class personType. Give examples of data and function members that can be added to the class employeeType. For example: myClock yourClock hr: 2 hr: 14 min: 26 min: 39 sec: 47 sec: 28 Consider the following statements: class yClass { public: void

C++ Programming

Create a class named RealtorCommission. Fields include the sale price of a house, the sales commission rate, and the commission. Create two constructors. Each constructor requires the sales price (expressed as a double) and the commission rate. One constructor requires the commission rate to be double, such as .06. The othe


Attached is a C++ program four of us did many years ago.I have a much better understanding of C++ than Matlab, but in this program their are many arrays I think in the form of for example j[]=[3 5 6], etc. First, I am terrible at arrays and through this program, which another guy took care of the arrays part since he did a prev

Modularity - C++ Program

A farmer has a bunny farm. He has cage capacity for a limited number of bunnies. A pair of adult bunnies will give birth to 2 bunnies (1 male and 1 female) at the end of every three months. A bunny is an adult when he or she reaches the age of 4 months. (i.e. 1st pair at age 3 months give birth to1 male and 1 female at the end o

Application for Geometric Calculations VB.NET

You have been hired by an engineering company to develop software to perform advanced geometric calculation. Your new boss asked you to develop an application that allows engineers to calculate the surface area and the volume of a sphere. For this, you will need to use the following formulas. Surface Area p = 4r2 Volume = 4

software categories

Define and distinguish the following software categories: operating systems; drivers; utilities/libraries; programming languages; and applications.

Conversion of Binary number to Decimal number

Write a C++ program that converts eight (8) bit binary numbers to their decimal equivalents. The program should retrieve the binary numbers (one at a time) from a data file (use a long int for the variable that represents the binary number). For each binary number, convert the number to decimal one bit at a time (or all at onc

If exponentiation were not a part of our pseudocode, you could use the following simple algorithm to compute xy when y is a nonnegative integer. Trace through the algorithm using paper and pencil, and be sure you understand exactly how it works. Then, implement the algorithm as a C++ program using the template given below.

Declare x as float Declare y as integer Declare i as integer Declare result as float Input x // can be any float Input y // has to be a positive integer Set result = 1 // initial value For i = 1 to y result = result * x End for Output result Convert this pseudocode into a C++ program. Note the restrictions on x a

Compile and run the program.

It contains the C++ wages program using a repeat loop in order to enable the user to compute several wages. The loop ends when the user enters -1 for either the hours_worked or the pay_rate. C++ uses the "do" keyword instead of "repeat". /* Program to compute the weekly wages repeatedly */ /*

Roman to Decimal Conversion in C++

Write a program that converts a number from Roman numerals to decimal. It needs to consist of a class, romanType. And object type of the type romanType should do the following: A. Store the number as a Roman numeral B. Convert and story the number into decimal C. Print Roman or decimal as requested. M 1000 D 500

Write a stringlast function in C++ to find the last n characters in a string.

The C++ libraries on strings have several functions that can be used to handle various string operations. Write a function called stringlast that can be used to find the last n characters in a string and return a pointer to this new string. Write a main program that calls the function with the pointer to the string and the numbe

13365 Programming > C++

I am attempting to complete Assignemt Exercise 13.12 in the Deitel&Deitel 5th edition version of C++ How to program. I am running into some early errors in trying to incorporate the Date class into the existing Employee inherited class heirarchy. One issue is that I'm getting erros in the dervied classes that there are virtual

Intro to C++

Would like you to check and correct this problem. When the program is ran it is supposed to look like this on the screen. Serendipity Booksellers Date: Qty ISBN Title Price Total _______________________________________________ Subtotal

Intro to C++

Need you to check and correct answer to problem. The computer screen should look like this when the program is run. Serendipity Booksellers Main Menu 1. Cashier Module 2. Inventory Database Module 3. Report Module 4. Exit Enter Your Choice: int. main() { cout << "Serendipity Booksellers"; endl; c

Implementation approach

Interested in a sample program where two classes communicate with each other per the following requirements: Consider two classes: Foo and Bar, where Foo is a sender, and Bar the receiver. Foo allocates 3-1 megabyte chunks of memory. The first chunk is filled with the value 0xA5, the next chunk with value 0xB5 and the third

Matrix Identity in C++

Write a function in c++ Isidentity (t) t is two dimensional array. (int t[rwos] [columns] return true, if it is an identity matrix, return false if it is not like example square tolls colum all 1's on principal diagonal, otherwise 0's 1 0 0 0 1 0 0 0 1 Note: This is a c++ question. This is not a math questions.