Posts
 
Reputation
Joined
Last Seen
Ranked #3K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
100% Quality Score
Upvotes Received
5
Posts with Upvotes
4
Upvoting Members
5
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
3 Commented Posts
0 Endorsements
Ranked #13.1K
Ranked #2K
~6K People Reached
This member's community profile is only visible to logged in members until they have earned 15 reputation points.
Favorite Forums

15 Posted Topics

Member Avatar for SCass2010

Using a mutex to make things “thread safe” is actually pretty easy. That is what they are designed to do. However, keep in mind, the purpose of a mutex is to protect a Resource, generally some sort of data storage element. You protect Operations (that is sections of executable code) …

Member Avatar for varungandhi
0
2K
Member Avatar for tiredoy

A recursive function needs to do several things. 1. It has to test to see if it is done (To see if it has reached a base case). 2. It has to call itself. 3. The data that the function looks at should be different for each iteration, otherwise, it …

Member Avatar for tiredoy
0
181
Member Avatar for DoubleZ

One approach would be to read in a line at a time, and then parse the line rather than turning copying characters on and off. You can use some of the string operators to manipulate each line, and then write the resulting line to the output. You still will need …

Member Avatar for Panathinaikos22
0
243
Member Avatar for caltech

Try something like: [code] // Create an array, one element per quarter, to hold the index into the records array of // the product with the highest profit. This is compared to the profits of the other // products. int GreatestProfitProd[4]; // Create an array, one element per quarter, to …

Member Avatar for caltech
0
145
Member Avatar for phorce

I am assuming that you need to keep track of the data as if it is still in a two dimensional array after you read it in. Basically, you have to keep track of three things. You need an index for the one dimensional array, and you need a “row” …

Member Avatar for WaltP
0
254
Member Avatar for stevanity

Well, the most obvious bug is that you don’t have a default case for your switch, and you don’t bounds check the user input. Also, you don’t use Pi to calculate the area of the circle. You don’t use Pi to calculate the perimeter, but if you did, the formula …

Member Avatar for Zcool31
0
128
Member Avatar for CY0T3R

Al41007 is on the right track, but in his version, on the first pass through the “i” loop (that is when i=0), the “j” loop does not execute. This may be okay. I think it may help to more clearly describe the algorithm. It is actually the sum of (X*(X^n)/n! …

Member Avatar for CY0T3R
0
244
Member Avatar for myk45

I’m not positive, because I am far from an expert on GCC, but I believe you can (or at least should) only select one optimization level at a time. There are a number of different things that could be done to optimize a program. In GCC, these are controlled by …

Member Avatar for myk45
0
228
Member Avatar for ruval002

I agree that the best way is to put the node where it belongs in the list in the first place. Linked lists should always be ordered in some way. If they are not ordered, then a linked list is the wrong data structure to be using. You should have …

Member Avatar for Ancient Dragon
0
145
Member Avatar for The_Purple_Mask

You are getting a message “Debug Assertion fails”, and you are 100% sure that it is from the Sort function. And you are wondering what is wrong with the Sort function. Well, let’s start with the basics. The fact that you get a “Debug” error implies that you are running …

Member Avatar for Fortran IV
0
213
Member Avatar for loumbut

To expand on what Eagletalon said, linker errors are usually not caused by a syntax error in a line of code. They are caused because the linker can’t find something it needs, it finds too many of something, or pieces don’t match. Quick lesson (which you may already know): Linkers …

Member Avatar for Fortran IV
0
1K
Member Avatar for NickPatton

This would be a good place to use a debug output. Print out the value of power, base, product, and i inside of your "for" loop. This should make it obvious what is going on. Also, you declare "product" in tow different places in your code. You didn't say which …

Member Avatar for Caligulaminus
0
252
Member Avatar for chaoz014

Okay, I’ll start on my soapbox. I’m not a fan of recursion. It tends to be difficult to add features and enhancements to recursive code without breaking it. Of course, this is not a concern for a student project. Also, recursive code is most applicable to applications that have arbitrary …

Member Avatar for Fortran IV
0
481
Member Avatar for sha11e

In my experience, people from a hardware (i.e., Electrical Engineering) background tend to prefer C over C++, and I suspect this is mostly because they have never had any classes on C++. These are often the same people who are writing embedded software, which is probably where the perception of …

Member Avatar for sergent
0
226
Member Avatar for liveurlifeteddy

As David said, the strucs are fine. You may want to create a structure to hold the results of your calculations, too. From the problem description, it looks like you have quite a ways to go. I would suggest breaking the problem into a number of pieces: 1. Get input …

Member Avatar for liveurlifeteddy
0
122

The End.