Share
Explore BrainMass

C++

Data Structures with C++ (STL)

Consider the class declaration class demoClass { public: // assign arguments as initial values for the data members demoClass(int a = 5, int b = 10); // function returns the maximum of itemA and itemB // int max() const; private: int itemA, itemB; }; (a) Give t

C++

Using the attached file all numbers class do the following: - write a template function for the class called Add15() that adds 15 to each of the two numbers and display the result - write a template function for the class called multiplybypoints5() that multiples 0.5 to each numbers in the parameter list and display result

C++ Problem

Program that does the following: delcale an integer (var1) declare a pointer (ptr1) that points to var1 declare a reference (ref1) to var1 assign the address of var1 to ptr1 print the value of var1 using the pointer use the ref1 to change the value of var1 to var15 print the value of var1 using the ref1

Visual C++

The following class uses composition to define a line object in terms of two point objects. class line { public: Point startingpoint(); point endingpoint(); float length(); line (int startX, int startY, int endX, int endY); private: point startPoint; point endPoint: }; 1) write a fucntin defintion for the Lin

Visual C++

Give the class declaration class point { public: int xcoordinate(); int ycoordinate(); point(in initializeX, in initialize Y); private: int x; int y; }; 1: Suppose we have a type declaration as follows: enum status {on, off}; declare a class Pixel that inherits from class Point. Class Pixel will have an ad

Visual C++ Classes

Write a program that read in an integer. If the integer is a negative number, catch the exception and print an error message "Invalid Integer: value negative" and prompt the user for another number. If the integer is zero, catch the exception and print a message, "Integer cannot be zero, and end the program. Otherwise, just pri

Visual C++

Write a C++ value returning function that implements the recursive formula F(n) = F(n-1) + F(n+2) with base cases F(0)=1 and F(1) =1

Priority Queues (C++ Programming)

I need a program that uses the structure of priority queues that implement the right way to take care of an emergency room. Priorities: 1. Respiratory failure 2. No circulation 3. Hemorrhages It should be taken in consideration that if exists two persons with the same level of priority the first one to arrive is the fir

Inheritance - SalariedEmployee - C++

Write a program that uses the class SalariedEmployee shown below. Your program is to define a class called Administrator, which is to be derived from the class SalariedEmployee. You are allowed to change private in the base class to protected. You are to supply the following additional data and function members: A member vari

Strings and Vectors C++

Please enhance this program. Write the definition of the readAndCount function. The function should read the input line, character by character, counting the number of words (a sequence of letters) and the number of occurrences of each letter. The array to hold the number of occurrences of each letter is the parameter let

C++ Names.cpp

Write a program that reads a person's name in the following format: first name, then middle name or initial, and then last name. The program then outputs the name in the following format: Last_Name, First_Name Middle_Initial. For example, the input Mary Average User should produce the output: User, Mary A. The inp

Friends and Overloading Operators C++

Complete and test this exercise. Implement the default constructor and the constructor with one int parameter. Overload the + and - operators to add and subtract percents. Also, overload the * operator to allow multiplication of a percent by an integer. Write a program to test all the member functions and overloaded operator

Infinite Loop C++ Programs

Can you find a bug in this program and then fix it so that it won't have an infinite loop? #include <iostream> #include <fstream> using namespace std; void CalculateAvgScore(ifstream &fIn,ofstream &fOut); int main(int argc, char *argv[]) { ifstream fin; ofstream fout; char inFileName[20],outFileName[20];

I/O Streams

Write a program that reads text from one file and writes an edited version of the same text to another file. The edited version is identical to the unedited version except that every string of two or more consecutive blanks is replaced by a single space. Thus the text is edited to remove any extra blank characters. Your progr

C++ Programming: Inputting Courses and Students

Please assist with providing a program that will ask the user how many courses he wants to input and how many students he wants to add to each course and the name of each student. Example of a run: INPUT: How many courses? 2 Enter the name of the #1 course: Structure Programming Enter the how many students: 3 Enter t

Simple linked list C++

When I typical write a linked list class to store int values I would setup the class something like this.... struct Node { int _item; Node *_next; }; Node *_head; However, I know have to write a program that will use IntNode.h to create a linked list implementation. The way the designer setup this .h file is

convert a octal value for UNIX file permissions to a text value

Can anyone explain to me how to convert a octal value for UNIX file permissions to a text value to display on screen. For example I need to write code in C++ that would take in octal value 100666 and display rw-rw-rw I have found this information but still can not figure out the conversion. Octal digit Text equivalent Bin

C++ Functions and Responses

C++. See attached file for full problem description. Question 21 Refer to the figure above. Which of the following members in the UML diagram adds an element to the front of the queue? front addQueue back None of the above Question 22 An effective way to implement a priority

C++

C++. See attached file for full problem description.

C++ explained in this solution

C++. See attached file for full problem description. Thank you so much! Question 31 A queue is modeled on a ____ structure. LIFO FIFO stack list Question 32 The function deleteQueue does which of the following? uses one queue to delete another removes the back

C++ Queuing Systems for Objects

C++. See attached file for full problem description. Question 11 What is the time-complexity of the overloaded assignment operator? O(1) O(n) O(log n) O(n^2) Question 12 template<class Type> void linkedStackType<Type>::linkedOperation1() { nodeType<Type> *temp;

C++ Output Functions

C++. See attached file for full problem description. Question 1 What would the operation isEmptyStack return if applied to the stack above? 0 5 true false Question 2 template<class Type> void stackType<Type>::operation1(const Type& newItem) { if(!isFullStack(

Queues C++

Add the operation queueCount to the class queueType (the array implementation of queues), which returns the number of elements in the queue. Write the definition of the function template to implement this operation.

Queues C++

Write the definition of the function template moveNthFront that takes as a parameter a queue and a positive integer, n. The function moves the nth element of the queue to the front. The order of the remaining elements remains unchanged. For example, suppose queue = {5, 11, 34, 67, 43, 55} and n = 3. After a call to the fun

Queues C++

Consider the following statements: stackType<int> stack; queueType<int> queue; int x; Suppose the input is: 15 28 14 22 64 35 19 32 7 11 13 30 -999 Show what is output by the following segment of code. stack.initializeStack(); queue.initializeQueue(); stack.push(0); queue.addQueue(0); cin>>x; while(x != -99

C++ program using parallel vectors

Write a program to keep track of a hardware store's inventory. The sore sell various items. For each item in the store the following information is kept: item ID, item name, number of pieces ordered, number of pieces currently in the store, number of pieces sold, manufacturer's price for the item, and the stores selling price.

Implementing Queues in C++

2. Suppose that queue is a queueType object and the size of the array implementing queue is 100. Also suppose that the value of queueFront is 99 and the value of queueRear is 25. a. What are the values of queueFront and queueRear after adding an element to queue? b. What are the values of queueFront and queueRear after rem

Stacks C++

Write the definition of the function template second that takes as a parameter a stack object and returns the second element of the stack. The original stack remains unchanged.

Project String Manipulation

Trying to put my last program together. I have put all my files in Visual CPP file and 2 text files. I have been working this issue for a while. Would like just a little assistance in getting this program running.

C parameter passing methods.

I do not have any experience in C or C++ so I am struggling with understanding what the parameter passing of these are. Consider the following program written in C syntax: void main() { int value = 2, list[5] = {1, 3, 5, 7, 9); swap(value, list[0]); swap(list[0], list[1); swap(value, list[value]); } void swap(in