jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yeah, sorry I couldn't be of more help. If you are using C::B, you really don't need the text UI as the IDE has built in support for gdb...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Try it like pictureBox1->BackgroundImage = System::Drawing::Image::FromFile(filename); instead of line 5

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Can you post a bit of your code? Stretch should do that for you, are you applying it right after setting the background image?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That's the right way to do it with the if/else. Now all paths through that method will return a value.

In doing it the way you did, as long as your calling function could tell the difference between the error condition and the actual value requested as [0][0], but I'm not sure how you could do that without adding an extra parameter. I'm not sure what the best return value would be for the error. That'll be up to your design.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Evidently there's a configuration option that needs to be set (see http://davis.lbl.gov/Manuals/GDB/gdb_21.html at the top of the page)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

On line 34, why do you have your else within the braces of your if?

What the compiler is telling you is that there is a path through that method (the path taken if x >= rows || y >= cols || x < 0 || y < 0 is false) where there will be no value returned.

You'll need to rearrange that if/else structure, but also provide a return value to the calling method in the case that the dimensions are not correct.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Call srand((unsigned)time(0)) only once before your first call to rand() . This seeds the random number generator with the current time.
You'll need to include ctime (formerly time.h) for this.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Just type [code] at the beginning of your code and [/code] at the end :)

Yes, post back on this thread with any problems related to this assignment, start a new thread if it's pertaining to something else.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Please use the [code] //code here [/code] tags, that way all of the formatting is preserved.

Why are you using p as your index for totalDefect? You probably meant d.

Also, how do you know the array you are passing in will have trackDays spots? If it has less than that your program will crash.

Relatedly, when you have a for loop going from 0 to trackDays (inclusive), you're going to have trackDays+1 elements.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Post the relevant portion first and then we can see if we need more information.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

See http://www.codeproject.com/Messages/3198006/Communicating-with-main-GUI-thread-from-worker-thr.aspx you can't write directly to the GUI thread as that could lock up your main application.

You cannot use an ofstream object. Any unmanaged types have to be transferred in between the unmanaged and managed parts through marshaling. Use a StreamWriter (http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx) but as it says in the documentation, it is not thread-safe. There is a Textwriter::Synchronized available, but I've never used it.

cwarn23 commented: Thanks for the hand. +6
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

All of those are unmanaged pointers which are not going to work in the CLR, unfortunately.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Question What are the style quote-tags?

You're misinterpreting. He means ">> style" "quote tags" (quote tags in the style of >>) not ">>" "style quote tags".

(just for clarification, not to steer this OT)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Poke around C# sites that cover BackgroundWorker too. The only issue is translating the syntax (. being both :: and -> at times). The forum here will probably have some examples too.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm not 100% certain myself. There may be issues of having to marshal copy the map values (as they are an unmanaged type and not compatible with the managed code).

As far as how to pass parameters, I'm assuming that for example on the line: e->Result = ComputeFibonacci( safe_cast<Int32>(e->Argument), worker, e ); e->Argument would have to be some kind of data structure or ref class containing all of your parameters (see http://www.codeproject.com/Messages/2369118/Re-Custom-DoWorkEventArgs.aspx for a posting on custom event args), but again, I don't think that will work with the std::map. I wish I had more help to give you, but hopefully this gives you some more terms to search on.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Use the BackgroundImageLayout property pictureBox1->BackgroundImageLayout = ImageLayout::Stretch; (then, once you resize the PB, the image should stretch with it)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Great! Yeah, you were right on the cusp of it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It's s bit confusing, but it seems to be asking you to apply sumN() to each element of your array. This would be a good spot to use a loop over each of the #size inputs. Keep it in main() and model it after your input loop.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

@AD Since his application is on the CLR, it's probably easier to incorporate all of this as a BackgroundWorker class.

@OP Check out http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx and scroll about halfway down to "Examples" and make sure you have the C++ tab selected. It's not identical to what you are doing but you should be able to adapt it readily. I did not find a lot of information on C++/CLI threading out there, but if you look up the concept of delegates for C# you can adopt some of the information by changing the syntax (as it's all .NET under the hood).

(the code box starts out below the second screenshot, the one above that has nothing in it)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I don't know that it's going to be possible to do with Dev C++ (which is outdated as it is, and won't offer you a GUI designer nor the .NET libraries). Grab the VC++ 2010 Express Edition. The dialect used in this case is C++/CLI and is probably not a good entry point into C++, IMHO. If you want to use Dev, you'd probably have to use the Win32 API. See something like http://www.winprog.org/tutorial/ for details on that.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Please post your code, as you are probably on the right track. Think of how you would do it in life. Change is 1.01, how many dollars? 1. Remaining change 0.01. How many quarters? 0. dimes? 0. nickels? 0, pennies? 1. Remaining change, 0.00. What would happen if the change were 0.41?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

No, there's two different things. Libcurl is the library, which understandably probably takes some tweaking to get running. Curl is the executable program that same site puts out as a binary (which their code is probably based on Libcurl). No need to compile or write anything. Sorry it's so confusing, but there's a mixture of binaries and source on that page I gave you.

http://www.paehl.com/open_source/?CURL_7.21.2 is a direct link to a page of someone who has compiled the binaries for Win32. If you feel more comfortable going from the curl site, on the page I gave you scroll down to Win32 Generic and the first 2 links go to url above (make sure they say "binary" in the next column).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Try plain old "Curl" it comes as an .exe file (it still has some learning curve, but you don't have to compile anything).

Go to http://curl.haxx.se/download.html and pickup one of the binary packages.

Also, if you are trying to use C++/CLI, then a reference on .NET's methods for C# would be helpful to you (see http://www.csharp-station.com/HowTo/HttpWebFetch.aspx)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I know the issue that I'm having, and perhaps the other are as well, is that if you don't know enough about the syntax of basic control structures in C++ and/or C++/CLI then someone translating it for you is not going to do you any good. I'm not trying to be mean, I'm just being realistic with you.

Run through a tutorial like http://www.functionx.com/cppcli/index.htm (a bit outdated but still valid), and the first couple of lessons should show you what you need to know.

If you can, use VC++ 2008 Express as the 2010 Express and Full do not have good intellisense for C++/CLI.

If your method doesn't work then post back with specific concerns about lines that you cannot convert. Line 3 is an array, which may not be so evident from its VB call.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You could have check answer return a 1 (for 1 correct answer) or 0 (not a correct answer) and have doOneProblem return that to the caller.

Where is num_of_problems defined in main()? It's not. Take a quick look at your book's section on scoping. You are not calling getProbsperset with the right number of parameters (it needs one according to your prototype and definition). Either pass num_of_problems by reference (which is suspect is ahead of where you are) or have it return an integer value. I would avoid the global variables if at all possible.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It would just be addresses->Length - 1 (the ^ in String ^ means it is a handle, so its members are accessed in the same way as if it were a pointer.

Both VB.NET and VC++.NET are converted to the same intermediate language (IL), but the syntax isn't necessarily going to be similar. There should be a way to call your VB code from C++/CLI but I have never done that.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

myarray is a 2D array and you are trying to assign a single value to a row in 22 and 27, and return a row instead of a single value in 34 and 39. What is happening to that other dimension? myarray[m][n] is an integer, where m and n are in bounds.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Is it similar to this thread's problem? http://www.daniweb.com/forums/post1340978.html#post1340978

I think Dani had to go to the ad vendor, so it might help if you told her which ad it was.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What are the compilation errors that you are getting?

Note that among other things, your call to the putel() method in main doesn't take the same number of parameters as it does in the class definition.

Also, with your out of bounds checks you place the element or return it even if it doesn't exist. This will give you nothing but problems down the line.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If you are using C++/CLI you should be able to use the Regex portion of the .NET library. See http://msdn.microsoft.com/en-us/library/3y21t6y4.aspx for the namespace and syntax. If you're trying to do it to native C++, Taywin is correct, and you'd have to find a library to do your Regex processing (I don't have any experience in that area beyond what there is in .NET). It will be helpful to know if you want to do it under managed or unmanaged code. If you need to do a lot of conversion automatically, there are products such as http://www.tangiblesoftwaresolutions.com/Product_Details/VB_to_CPlusPlus_Converter_Details.html (again, never used it, can't speak for it) to do so.

Rather than focusing on how to convert the for loop, relearn how to do it in C++. There are some nuances, but basically it's the same. You know you don't have to "dimension" variables in C++, you can just say int i; instead.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, it's the same. Structs and classes in C++ only differ by the default visibility of their elements (public for structs and private for classes).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Please use code tags [code] //code here [/code] next time. Hint, use an if statement to either increment your index (value doesn't match with other) or leave it the same (if it's a duplicate). You will probably need to shift your while loop around to reflect this (and base its condition on that index rather than a boolean).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Pass your after pointer to your temp_ptr's setNext method, something like temp_ptr->setNext(after->getNext());

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I know it's not the answer that you want, but google for "macro recorder," and you can probably save yourself a lot of coding.

I really don't know how to direct you to begin, but since this is one of those gray areas of computing, see if there's another way to accomplish your task like via a REST API.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

In line 18 of the header file, the function's signature states that you are passing in a reference to a constant int. In line 58 of the CPP file, the signature is just a constant int. Modify line 58 to reflect the reference variable (i.e., add an & to it).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You are being very confusing about your requirements. I suggest you use google and get more information first. Have you programmed in assembly before? There is a forum here dedicated to it and there are some sticky threads there to read about getting started.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Check line 58 of the CPP file versus what you have in the header. They don't match up.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Seems to me your line class should contain the start and end points for a line. Then pass in a point to your "distance" method in Calculating. Seem like you might want a Point class too, perhaps...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What have you tried so far? Which parts are giving you the hardest time? No one is going to be able to help you without some effort from you first.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

http://www.kernel.org/ has all of the Linux kernel source code.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It's probably in the same location as the .exe file. Either go to the directory into which you started the project or use Window's search utility to find it (you may have to expand the search area to include more than your documents, etc.).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I know everyone was hanging on for the suspenseful ending of this one, but in the last 12 hours or so it seems to have gone away! So whatever you did (DB update or whatnot) fixed it. Solved.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Looks pretty good so far.

1)Which way does "dis" display the elements?

2)Denote the type of function "per" (hint, line 38)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Use of the "dis" function (or a series of cout statements) at strategic points in your program will let you trace it through step by step (or step through it using a debugger if you have one). If you then write a couple of sentences, someone can look at it for you and tell you if you are correct.

I know it's not the answer you wanted, but you'll learn a lot more doing it that way.

Also, main() always returns an int, according to the standard.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Your "else" is associate with the if(L1==L2 && L2==L3) you want it to be associated with the if(L1+L2 > L3) All I was saying is that if L1+L2 <=3 then it skips everything else and returns whatever is in the empty shape variable.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Look at the condition on line 54. What happens when all of the sides are equal? Try testing for equilateral first.

Also, while you are restructuring the loop, what happens when L1+L2 <=L3 (I think you tried to account for it but be careful which if/else pairs are associated with each other)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Any more on the "me too" train? Evidently it hasn't left the station yet...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Can you post your code with those if statements in there?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Loop over the number of shows, and since shows is an array of structs, shows[0] is the first show, so use the dot operator on it just like you did in lines 28-30.

After line 48, or even on line 48, output an extra endl or two. It doesn't have to be an endl, it could be a "\n" (which doesn't automatically flush the buffer).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Hand trace through the do/while loop with different conditions and you'll see that even if gender was equal to one, it would not be equal to 2 and vice versa, therefore your loop condition is true and the loop continues.