Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

~7K People Reached
Favorite Forums
Favorite Tags
c++ x 31
Member Avatar for bmos31

So I have an assignment to redefine an array-based Stack push() function. The problem itself sounds like it totally defeats the purpose of a stack, but this is what I have been assigned: Rewrite the push function so 'myTop' is always 0 instead of one more than the index of …

Member Avatar for Fbody
0
149
Member Avatar for bmos31

I'm having trouble getting a recursion template reduceArray() function to divided elements in an array. I have +,-, and * working fine, but division is not working for me. The function should take the given elements and divide as follows ((((4/2)/7)/1)/9) Here's my code...any tips? [CODE]#include<iostream> using namespace std; template<typename …

Member Avatar for bmos31
0
214
Member Avatar for bmos31

I'm new to recursion and am wondering how the output of the code below is 6. So from what I can understand, there are 2 base/anchor cases which return 0 or 1? Is this correct? And the recursive/inductive case is the f() calling f(), but I'm confused on what it …

Member Avatar for mrnutty
0
99
Member Avatar for bmos31

I'm trying to write a program that prints out Euler's triangle as follows: 1 1 1,1 1,4,1 1,11,11,1 1,26,66,26,1 1,57,302,302,57,1 1,120,1191,2416,1191,120,1 It uses the following formula, where A is a vector of vectors: A[x][y] = (x-y)A[n-1][m-1]+(m+1)A[n-1][m] I've already implemented the formula to the function I've created to printEulersTriangle(), but it …

0
88
Member Avatar for bmos31

I'm trying to solve a maze that originally chooses moves randomly, keeping track of its last move...left and forward, right and foward, and forward, and by chance will choose to 'undoMove' if a 'moveBlocked', but not guaranteed. I am attempting to use a stack to solve. according to instructions the …

Member Avatar for bmos31
0
1K
Member Avatar for bmos31

So I'm having trouble performing a linear search of a linked list class. The inList() search function is supposed to recieve a value for an element and search for that element, return a bool value based on whether or not the value is in the list or not. Below is …

Member Avatar for bmos31
0
1K
Member Avatar for bmos31

I'm attempting to create a function getPredecessor() in which the function recieves an int in reference to a position in the list and should return a pointer to the node [U]before[/U] that position. If the position is the first place in the list, return 0. Here's my header (followed by …

Member Avatar for bmos31
0
1K
Member Avatar for bmos31

I think I'm there, but I'm not sure if the insert() is correctly doubling the dynamically allocated memory. In an attempt in my insert() I tried to: 1 double the allocated memory (not sure if that was accomplished) 2 copy original values to the newArray 3 free original space 4 …

Member Avatar for bmos31
0
1K
Member Avatar for bmos31

I'm having some problems finding memory management errors in this code. The only one I see as a possible error is the deleting the dereferenced pointer, but I'm not even sure if thats correct. Some of the errors should include memory leaks, memory deletion when still in use, two objects …

Member Avatar for bmos31
0
190
Member Avatar for bmos31

I was just wondering how to pass two objects s1 and s2, both of which have to arguments, to a function, someFunction(). I actually only want to pass the second argument of each object for s1 and s2 to the same function, compare the two arguments and then display some …

Member Avatar for bmos31
0
163
Member Avatar for bmos31

So I have a program scenario for a postman who carries out an experiment: 1. He has mailboxes numbered 1-150 all of which are 'closed' 2. Starting with mailbox 2, he 'opens' all even-numbered mailboxes, leaving all others 'closed' 3. Next, beginning with mailbox 3,goes on to 'open' every third …

Member Avatar for bmos31
0
785
Member Avatar for bmos31

I'm writing a code that takes a 5-bit binary string from a file 'message.txt', converts it to integers. The encoded letters are assigned numbers starting with a=1, b=2, etc. So if the original letter is 'a' and the key(fixed number of spaces) is 2, the encoded letter is 'c' which …

Member Avatar for bmos31
0
477
Member Avatar for bmos31

Ok, so I'm writing a program to convert decimal into binary. It all works with the exception that my binary shows up in reverse order and I'm having trouble with reversing the array of chars in my intToBinaryString() function. Any tips on how to get this started? [CODE]#include<iostream> #include<cstring> using …

Member Avatar for prvnkmr449
0
172
Member Avatar for bmos31

I'm having trouble even getting started with this problem. I've tried looking at other examples, but I'm completely stuck. The question and my code(not even sure if im on the right track) is as follows: Write a function called decToBinaryString that recieves a non-negative int and returns a string that …

Member Avatar for bmos31
0
191