Explore BrainMass

Explore BrainMass

    C++

    BrainMass Solutions Available for Instant Download

    Data Structure

    Which data structure (i.e. array based list or linked list) is the optimum one for following problems? - Read only look-up table - Class roster - When lots of inserts & deletes are involved - When you have no clue about how big the list will grow.

    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++

    Consider the following statement: class strange { . . . }; a. Write a statement that shows the declaration in the class strange to overload the operator >>. b. Write a statement that shows the declaration in the class strange to overload the binary operator + as a member function. c. Write a statement that shows the

    Data Structures C++

    What is wrong with the following code? class classA { protected: void setx(int a); //Postcondition: x = a private: int x; }; . . . int main() { classA aObject; aObject.setx(4); return 0; } Consider the following code: class one { public: void print() const; //Outputs the values of x and y

    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

    C++ Program Explained

    This was another program did as a group many years ago. Explain in detail what everything, everything, is going on after the for loop please!!! Also, if you need to explain anything else that ties into the code below the for loop it is all right since it will help me.

    C++

    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

    String of Symbols

    Suppose f is a function that returns the result of reversing the string of symbols given as its input, and g is a function that returns the concatenation of the two strings given as its input. If x is the string abcd, what is returned by g(f(x),x)? Explain your answer.

    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

    C++ Programming for Personal Information

    Programming Assignment 7 - Arrays Purpose: This assignment is designed to demonstrate your understanding of repetition structures with an unknown number of iterations as well as arrays. Assignment: Write a complete C++ program with jGrasp to do the following:  Store the first 100 multiples of a user-supplied integer

    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

    Application for matrix addition

    Create an application that would perform matrix addition. Each matrix must be three rows by three columns. The following is an example: Store each matrix in an array. 1. The form must allow the user to input each element for both matrices. 2. The input must be done through text boxes, and the number of characters must b

    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

    Virtual Functions in Derived Classes that have Non-Virtual Destructors

    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

    A c++ program that prints a count of invalid characters

    This program reads a data file that should contain only integer values, and thus should contain only digits, plus or minus signs, and white space. The attached file is what I have done so far any help is appreciated in advance. More explanations are in the file.

    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