Share
Explore BrainMass

C++

C++: Arrays, Pointers and more

1. Explain how an array works. 2.Define the purpose of a pointer. Provide an example of how it can be used 3. What are the drawbacks to using pointers? 4. What risks does Open Source Development Platforms present that may not be present with Proprietary Development Platforms? Is C++ an Open Source or Proprietary Program

C++ Stack and Queue

Convert the following infix expressions to postfix notations: a. (A + B) * (C + D) - E b. A - (B + C) * D + E / F c. ((A + B) / (C - D) + E) * F - G d. A + B * (C +D) - E / F * G + H

A Vector Class in C++

Your class VectorDouble will have a private member variable for a dynamic array of doubles. It will also have two member variables of type int; one called maxCount for the size of the dynamic array of doubles, and one called count for the number of array positions currently holding values. (maxCount is the same as the capacity o

Three different looping examples in C++

Design a While Loop that lets the user enter a number. The number should be multiplied by 10, and the result stored in a variable named product. The loop should iterate as long as product contains a value less than 100. Design a For loop that calculates the total of the following series of numbers: 1/30+2/29+3/28+...30/1

C++ Recursion

A. What is direct recursion? b. What is tail recursion? c. Suppose hat intArray is an array of integers, and length specifies the number of elements in intArray. Also suppose that low and high are two integers such that 0 <= low < length. 0 <= high < length, and low < high. That is, low and high are two indices in intArray

Examples of C++ Programs

Please see the attached file. The formula for number 4 is as follows a = r3 + r4 b = (r2*a)/(r2+a) Thev equiv = r1 + b

C++ exception classes

Suppose an exception, class myException, is defined as follows: class myException { public: myException() { message = "myException thrown!"; cout << "Immediate attention required!" << endl; } myException (string msg) { message = msg; cout << "Attention required!" << endl; } string what() { retur

C++ Programs: Loops, Input Detection

Need programs that fulfill the requirements in attached document. Write a method called check Value that will meet the following criteria: - Initializes total both to the default initialization value. - Get input for the starting number (assume important statement is already present) - Set total to the input above. -

An easy to understand example of arithmetic in C++

Write a c++ program. 1. As a part time student and a part time worker, you earn $4.50 an hour. Your parents will buy you a used car, but you must pay for the gas. gas costs $1.10/gallon and you use 20 gallons/week. How many hours will you work each week to pay for the gas to fuel your car?

Reading and writing a file with a Java Program

Please assist with the following: Write a C++ or Java program that reads from one file and writes to another, in both Windows and Linux operating systems. Keep in mind that the key goal in this assignment is to identify the command used to copy a file. The other goal is to determine how to perform system calls in each operati

Implement Dijkstra in C++

Please include the code and the .exe file. For the Graph in figure 16-28(a), replicate the trace of Dijkstra's algorithm to find the minimum path from vertex A to F. For each step, create the list of minInfo elements in the priority queue and indicate which element is removed from the queue. Please see Graph 16-28(a) below

C++ using multidimensional dimensional array

A certain professor has a file containing a table of student grades, where the first line of the file contains the number of students and the number of scores in the table; each row of the table represents the exam scores of a given student and each column represents the scores on a given exam. The maximum possible score on eac

C - Write a Function that Accepts a Score for a Driver's License

(Please include comments in the code). It is required that in all assignments a Cast should be used to convert float to int. 1- Write a function that accepts a score for a driver's license facility, an int or a float, and returns a letter. If the score passed in is less than 75, then the letter returned is an F for Fail. Ot

Data Structures - C++

Convert the following infix expressions to postfix: a) a + b*c b) (a+b)/(d-e) c)(b^2-4*a*c)/(2*a)

List in C++

Please include the code. Implement, according to the instructions in parts (a) and (b), the fnction count(), which takes item as argument and returns the number of times item occurs in a list. template <typename T> -------please see attachment for this portion int count (const list<T>& aList, constT& item); a) implemen

output of the codes

Trace the following code and give the output: (be sure to include the code used) int arr[] = {4, -6, 22, 7, 13, 8}; in arrSize = sizeof(arr)/sizeof(int); vector<int>v(arr.arr+arrSize); while (!v.empty()) { cout <<v.back() <<" "; v.pop_back(); }

Data Structures + C++ STL

Give the value of v.size() after executing each of the following statements: (Be sure to include the code used to execute the statements. One program will be fine to execute all statements, no need to write multiple programs.) vector<int> v(25); v.push_back(-4); v.resize(40); m = v.back(); v.pop_back();

Westfield Carpet Company

Use C++ to write a program: The Westfield Carpet Company has asked you to write an application that calculates the price of carpeting for rectangular rooms. To calculate the price, you multiply the area of the floor(width times length) by the price per square foot of carpet. For example, the area of floor that is 12 feet long

Data Structures C++ for array generation

Write a program that generates an array of 10 random integers in the range from 0 to 999. Output array using the template function writeArray(), and then call the function bubbleSort() to sort the list. Output the sorted list.

Data structures C++

The free newString() takes string objects strA and strB as arguments. For its action, newString() compares the string by using < and returns the concatenation of the arguments, with the lesser sring coming first. a) give a function prototype for newString() b)Give the implementation for newString() c) The main program has the

Reversing integer using recursion

I need a recursive function that accepts an integer and returns its reverse. for example int reverse( int n ); int main() { int n; n = reverse (123) ; // this returns 321 } I can do this easily without recursion but I have to use recursion. Thank you.

C++ Student Gradebook Program

Write a program, use class to create many fields: Name,DOB,Address,Class,Mark,Average mark. Allow user save data to a text file, user also can add more students, can delete student, edit info about student. Write it in type of menu Drawing flowchart for this problem Please use C++, don't use C.

C++ String Class Counter

Write function to count the number of sentences entered into a string class. Assume a sentence ends in either a period, question mark or exclamation mark. Count the number of words as well as the sentences and return and average the number of words per sentence. Attached is what I have done so far.

Matrix Multiplication Program Using Arrays

Attached are the requirements for the program. You are going to write a program to multiply two matrices. The matrices are stored in a two-dimensional array: int[][] matrixA int[][] matrixB Recall: Here is the way to declare a two-dimensional array: int testArray[3][4] = {{1,2,3,4},{2,3,4,1},{5,4,3,0}}; // three rows,

Classes and Data Abstraction

Consider the definition of the following class: class CC { public: CC(); //Line 1 CC(int); //Line 2 CC(int, int); //Line 3 CC(double, int); //Line 4 . . . private: int u; double v; }; a) Give the line number containing the constructor that is executed in each of the follow

Classes and Data Abstraction

See attachment. Please do not make the code very complicated on this C++ program. The topic is Classes and Data Abstraction. Please make sure to use this concept for the program.