No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
C++ Programming Exercise: Implement a command-line calculator that allows the user to enter an expression containing numbers, variables, brackets, and operators. The calculator will also allow assignments to a variable. After the user enters the expression the program will evaluate it and display the value. If the expression is part … |
|
I am trying to write this recursive function: void printFactors(int n) For this function, I need to print prime factors in ascending order. e.g. for n = 24 the output would be 2 2 2 3. I cannot use loops and static variables for this function. Here is my solution: … |
|
I'm trying to write the function: int sum(int x, int y) For this function, I need to return sum of m and n using only increment, decrement and unary -. m and n can be any integers e.g. if m is 4 and n is -5, the return value would … |
|
I am trying to create a recursive function: double fifthRoot(double x, double maxError) In this function, I have to return y such that y^5 will be within maxError of x. Assume x > 0. Also assume maxError is big enough to prevent problems due to rounding. In order to make … |
|
Define a C-string function void append(const char * v, const char * w, char * buffer) that appends the characters of C-string w to the characters of C-string v and stores the result in buffer. (Don't forget the terminating null character .) You can assume that the function is called … |
|
Define a function string sort(string s) that returns a string with the same characters as s, but arranged in ascending order, according to ascii value . For example sort("hello") will return the string "ehllo". Notice that the function returns a different string from the original argument, since s is not … |
|
Write a function int findLast(string words[], int numWords, string target) that returns the index of the last occurence of target in words or -1 if there is no occurrence. Remember: you can compare string objects using ==, these are NOT C-strings ! Here is my solution: int findLast(string words[], int … |
|
For this programming exercise, you may use ONLY these instructions: and nor or ori sll srl xor Start a program with the instruction that puts a single one-bit into the low order bit of register eight ($8 or $t0): ori $t0, $0, 0x01 Now, by using only shift logical instructions … |
|
For this programming exercise, you may use ONLY these instructions: and nor or ori sll srl xor Run the programs by verifying the value of the PC is 0x00400000 (right-click the field and use Change Register Contents to set it) and then single stepping (pushing F10) and observing the results … |
|
Define a function named isDivisor that has two parameters of type int and returns a value of type bool. A call to isDivisor(m,n) should return true if and only if (iff) m divides n. For example isDivisor(6,24) will return true but isDivisor(5,24) will return false . Note that every number … |
|
Define a function int getRoots(double a, double b, double c, double & s1, double & s2) that solves a quadatic equation with coefficients a, b and c. If there are no real roots than the return value will be 0 and the values of s1 and s2 will be left … |
|
Define a function void order(int & a, int & b, int & c, bool ascending) that places the values in ascending or descending order, depending on whether the last parameter is true or false . For example, if x, y and z contain the values 3,1, and 2, respectively, then … |
|
Define a function bool isWin(char board[][3], char target); that returns true if character target has a winning position on this tic-tac-toe board. That means three occurences of target in a line, column or along either diagonal. For example if target is 'O' and if board[0][2], board[1][1] and board[2][0] all equal … |
|
Write a complete program that reads an integer k > 1 from the console and finds the first positive natural number n hat is divisible by all whole numbers between 2 and k inclusive. Your program may only use do-while loops , even if you think a for-loop or while … |
|
Write a complete program that reads three integers from the console and outputs the number of distinct values entered. For example if the input is 34 55 23 then the output will be 3, since there are three distinct values . If the input is 42 78 42 then the … |
|
Your Math class has five 100 point tests over the course of a semester (and nothing else that counts toward your grade). In addition to getting an average score of 70/100 you must pass at least three individual tests in order to pass the class . For example, if your … |
|
Without using arrays, write a complete program that reads three integers from the console and outputs the same three numbers in ascending order on separate lines. For example if the input is 5 4 3 then the output will be 3 4 5. Do not prompt the user or produce … |
|
Working on the maze program, with '*' indicating a wall, ' ' indicating a corridor, and '#' indicating a solution path, where I must use a recursive backtracking algorithm, I cannot seem to print the '#' symbol for the solved maze. Here is my new code: #include<iostream> #include<fstream> using namespace … |
|
For the maze program, with '*' indicating a wall, ' ' indicating a corridor, and '#' indicating a solution path, where I have to use a recursive backtracking algorithm, I am still having trouble print the maze solution. Here is the unsolved maze: 8 12 ********** * * * * … |
|
In this program, I am trying to print a solution for the maze with '*' indicating a wall, ' ' indicating a corridor, and '#' indicating a solution path. I am using a recursive backtracking algorithm in this program. For instance, here is a small (8-by-12) maze: 8 12 ********** … |
|
Write a program to read a maze from a text file into your array, print the unsolved maze, solve the maze, and then print the solution. You may assume the maze will fit in a 24-row by 81-column character array (for 80 character C-strings). The maze will be in a … |
|
Write a program to read a maze from a text file into your array, print the unsolved maze, solve the maze, and then print the solution. You may assume the maze will fit in a 24-row by 81-column character array (for 80 character C-strings). The maze will be in a … |
|
Here is the website for the assignment: http://www.docdroid.net/6ap6/inheritance5.pdf.html Note: The ones highlighted in blue are the ones I completed, and the ones highlighted in yellow are the ones I need help with. Here is the website for the first header file (point.h): http://ideone.com/6bAeqv Here is the website for the first … |
|
CSCI-15 Assignment #4, operator functions/methods. 25 points. Due 11/6/2013 Extend your class MixedExpression class to include operator methods for addition, subtraction, multiplication and division, and to have friend operator << and operator >> functions for reading and printing the MixedExpression objects. Allow cascaded input and output per the << and … |
|
Here is the website for the assignment I am working on: http://view.samurajdata.se/rsc/5c1dd0b4/ Here is the website for my header file (MixedExpression.h): http://ideone.com/G9aC9D Here is the website for my library source file (MixedExpression.cpp): http://ideone.com/PfH8f0 Here is the website for my calculator client file (Calculator.cpp): http://ideone.com/4wGayu Here are the input lines: ( … |
|
Here is the website for the assignment I am working on: http://view.samurajdata.se/rsc/5c1dd0b4/ Here is the website for my header file (MixedExpression.h): http://ideone.com/oJ6mI8 Here is the website for my library source file (MixedExpression.cpp): http://ideone.com/inEyqe Here is the website for my calculator client file (Calculator.cpp): http://ideone.com/EDTWeS The header file is correct. I … |
|
Here is the website for the assignment I am working on: http://view.samurajdata.se/rsc/5c1dd0b4/ Here is the website for my header file (MixedExpression.h): http://ideone.com/oJ6mI8 Here is the website for my library source file (MixedExpression.cpp): http://ideone.com/RSrshS Here is the website for my calculator client file (Calculator.cpp): http://ideone.com/U5F2O8 My question: I got the code … |
|
The local baseball team is computerizing its records. Write a program that computes batting averages and other statistics. There are 20 players on the team, identified by the player ID 1 through 20. You will have two input files: roster.txt and statistics.txt 1) The Roster File (roster.txt) - This file … |
|
Assignment 9, Due Dec 2 Design and implement a program that allows the user to keep track of students in a college course. The program will function as a simple database in which students can be inserted, removed and updated. Additionally, the user can display students in order by name … |
|
Define a getTopTwoScores() function with the specification and prototype shown below: // Set highest to the score with highest value and secondHighest to the score with the next highest value. // If there are two highest scores with the same value then set both highest and secondHighest to that value. … |