1,177 Posted Topics
Re: You should post the code either directly on DaniWeb (using code tags) or on something like [url]http://codepad.org/[/url] . And your teacher was right - you shouldn't use goto :) David | |
Re: Put them into an std::vector of std::string's and then std::sort() them: [url]http://programmingexamples.net/index.php?title=CPP/AlphebetizeString[/url] | |
[QUOTE]Ov course you don't, but many people here feel that vectors are the only solution to using arrays. They love suggesting things obviously beyond your level.[/QUOTE] This is not beyond his level. There is no reason to learn arrays before vectors. Novices should learn vectors because they convey the same … | |
Re: You should look into the Qt library. Poke around for some tutorials. I also have some examples here: [url]http://programmingexamples.net/index.php?title=Qt[/url] and a "crash course" here: [url]http://rpi.edu/~doriad/Talks/Qt_Introduction.pptx[/url] David | |
Re: You should be able to simplify this 230 lines down to about 20 relevant lines for us :) | |
![]() | Re: Welcome to DaniWeb! We are all about learning here. No one really benefits if we just write code for you. What you should do is: 1) remove punctuation: [url]http://programmingexamples.net/index.php?title=CPP/Strings/DetectPunctuationparse[/url] 2) parse the file on ' ' : [url]http://programmingexamples.net/index.php?title=CPP/Strings/Split[/url] 3) put all of the words in a std::set and keep track … |
Re: Welcome DaniWeb! A few suggestions: 1) Use code tags when posting code. It makes the code much easier for us to read. 2) Use real English words. I.e. "Please" instead of "Plz". It helps the community maintain a professional image. 3) You are outputting 'str' before assigning anything to it. … | |
Re: You can do some cool tricks with stringstream: [url]http://programmingexamples.net/index.php?title=CPP/HexToInt[/url] | |
Re: Are you opposed to using a library? ImageMagick, ITK, VTK, VIL (from VXL), CImg, and OpenCV should all do the trick :) | |
Re: The type before the function name is the return type: [code] std::vector<long double> yourFunction() { vector<long double> a; return a; } [/code] | |
Re: sunny - please use code tags. loyd - no one is going to do your exam for you. Also, please don't "hijack" threads - that is, if your comment isn't directly useful for the original poster, you should start a new thread instead of replying to this one. David | |
Re: I suggest hard coding a very small input, solving it by hand, then putting some output statements in your loop so you can see where what your programming is computing differs from your correct hand-computed solution. | |
Re: Ok, you have multiple problems. 1) Those are not .o files. They are .cpp files. 2) At line 87 in diamond.cpp, you have [code] for (y = 1; y <= size - x; y++) { cout << " "; } cout << border; } [/code] That is an extra }, … | |
Re: Hi BanKuZ, welcome to DaniWeb! Which operator would you like to use? Maybe you can also post your class structure, I'm not sure I followed what is going on from what you posted. David | |
Re: I couldn't get this to completely work right now, but here is what I came up with when I tried to do it a while back. It certainly needs some cleaning! [code] // need to // export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/octave-3.2.4 // export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/octave-3.2.4 #include <octave/octave.h> #include <octave/oct.h> #include <octave/parse.h> #include <iostream> void … | |
There are lots of stand alone programs (sqlitespy, sqlitestudio, etc) that give you nice spread-sheet style access to tables: [url]http://www.yunqa.de/delphi/lib/exe/detail.php/products/sqlitespy/sqlitespy.png?id=products:sqlitespy:index&DokuWiki=2oa8egb90q7fck3t3q2uk9nv61[/url] but does anyone know of a web based way to do this? Thanks, David | |
Re: What do you mean "How do I use c++ to do ..." - it is a language - once you know what you want to do, you have to figure out how to do it within the language. You'd probably want to have a CoffeeMachine class that has functions like … | |
Re: Welcome to DaniWeb! You could do two things. 1) Make a struct, fill the struct with the two values, and return it. 2) "Return" a and b by reference. Also, please use code tags when posting code. Good luck, David | |
Re: What is ACE? I suggest you ask the ACE people how to do this, as it is not standard c++. Here is an example how concatenating STL strings: [url]http://programmingexamples.net/index.php?title=CPP/Strings/Concatenate[/url] | |
Re: What are all of those cutoff* variables? Why wouldn't you just assign the calculations to 'tax' as was done originally? | |
Re: Please also provide sorted_list_example.cpp. However, both files should not need to be longer than about 15 lines to demonstrate the problem :) | |
I finally got my navigation drop down menu working! [url]http://ewh.ieee.org/r1/schenectady/[/url] I had been testing in Chrome, Firefox, and IE8. Before my celebration even really started, a user pointed out (correctly) that it doesn't work in IE7 :( The menus drop down on hover, but they aren't aligned, and you can't … | |
Re: Why post 500 lines of code? Can you simplify the code to < 20 lines so we can look at it? | |
Re: You will not find the source of a linker error anywhere in the code. It means you are not linking to the opengl libraries properly. Please send the actual error output. It would also help if you could make and send us the shortest program that you can that gives … | |
On this page: [url]http://ewh.ieee.org/r1/schenectady/New/[/url] it seems like the gray background object is larger than the screen - i.e. scroll bars appear even though the content is not long enough to warrant them. I have the following properties: [code] body { height: 100%; } html { height: 100%; } [/code] Shouldn't … | |
On this page: [url]http://ewh.ieee.org/r1/schenectady/New/[/url] I have two elements, "bluegradient" and "whitebox". The bluegradient height is 80% (of the page, right?). The whitebox height is 80% (I think this "80% of the height of the bluegradient" since it is nested, right?). The whitebox has top and bottom margins of 10% (this … | |
On this page: [url]http://ewh.ieee.org/r1/schenectady/New/[/url] I have the title image and title text: [code] <center> <a href="index.php"><img style="vertical-align:middle;" src="/r1/schenectady/images/IEEE.gif"></a> <span id="lightblue" style="vertical-align:middle; font-size: 40pt;" >Schenectady Section</span> </center> [/code] then a paragraph break: [code] <p/> [/code] then a row of drop down lists, then another [icode]<p/>[/icode] then some text. The problem is … | |
Re: I suggest you make a small compilable example. What is the problem? Compiler errors? Crash? Incorrect result? | |
Re: What are you trying to do? I'll assume simply run something in another thread? You could use boost threads: [url]http://programmingexamples.net/index.php?title=CPP/Boost/Threads[/url] or Qt threads: [url]http://programmingexamples.net/index.php?title=Qt/Widgets/Thread[/url] | |
Re: Please use code tags when you post code. Also, this doesn't really sound like a c++ question - maybe you should post here: [url]http://www.daniweb.com/forums/forum71.html[/url] | |
This is my page with only the header row of the table: [url]http://ewh.ieee.org/r1/schenectady/New/test2.html[/url] When I start adding rows, everything looks good, until I add row 13. Here is an example: [url]http://ewh.ieee.org/r1/schenectady/New/test.html[/url] You can see the header (the grey box) "wiggles" just a little bit. I thought there may have been … | |
Re: You could email the guys in charge: [url]http://sqliteman.com/page/7.html[/url] and tell them you are interested in writing this and see if they can point you in the right direction. Sometimes they will give you the best free tutorial you can imagine, sometimes they will yell at you and tell you go … | |
I have a drop down box like this: [code] <select name="DateDropDown"> <option value="2010 selected">2010</option> <option value="2009">2009</option> <option value="2008">2008</option> </select> [/code] I use the value that the user selects to refresh the page and perform a query on a database. Is there a better way than the following to keep the … | |
I have a database, test.db, with a table called Events. I tried this: [code] <?php try { // open the database $database = new PDO('sqlite:test.db'); $result = $db->query('SELECT * FROM Events'); foreach($result as $row) { // both of these lines produce a blank page //echo $row['EventName'] . ' | ' … | |
Re: ImageMagick has a c++ API: [url]http://www.imagemagick.org/script/index.php[/url] that could certainly do this. Otherwise, libjpeg sounds like a reasonable choice: [url]http://www.ijg.org/[/url] though I've never used it. David | |
Hi all, I am transitioning a bunch of data from html (yuck!) to some sort of separated schema. I was going to use xml: [code] <events> <event> <title> <date> <speaker> <description> </event> </events> [/code] but now I am wondering if I should use a real database instead. Can anyone comment … | |
Please excuse my newness. Currently I know how to execute a php script by simply naming the script [filename].php and browsing to that file on my webserver. I have also learned how to parse and display an xml file using php. What I want to do is have a .xml … ![]() | |
I want to have files like this: File1.xml [code] <titletag> Title1 goes here </titletag> <contenttag> Content1 goes here </contenttag> [/code] and then use this data with something like: [code] <html> <body> ... Place <contents of titletag from File1.xml> here </html> [/code] Is this a reasonable request? How would I do … | |
Re: Check out the insert() and copy() function. There are examples here: [url]http://programmingexamples.net/index.php?title=CPP/STL/Vector[/url] David | |
Re: I would suggest you go to sourceforge.net or github.com and search around for something that interests you. Many of these projects are small so people may be excited to receive help. | |
Re: Can you use vectors instead of arrays? Then you get a .size() function :) | |
Re: So what is the problem? Are there compiler errors? Does it crash? Do you get the wrong result? I suggest hard coding a simple input that you can compute the entire algorithm by hand. Then you can check your programs state every step of the way. | |
Re: I bet you can demonstrate the same problem in < 30 lines (down from 265 :) ) | |
Re: You should step through the code with a debugger and determine exactly which line the segfault happens on. This will give you (and us) a better starting point. | |
Re: MylesDBaker, Is this for a course (where they have made you write your own graph class, etc)? Or because you actually need to use a maxflow algorithm? If it is the later, I would like to suggest that you use an existing graph library (I use vtkGraph from VTK (vtk.org) … | |
Re: I think you'll have better luck asking the OpenCV people: [url]http://tech.groups.yahoo.com/group/OpenCV/[/url] | |
Re: You have posted everything except the findLowest function! What have you tried? I bet it should involve some conditionals (ifs) and some < operations. | |
Re: I strongly suggest Qt. The crossplatform-ness is a HUGE plus in today's very varied operating system landscape. There are some examples here: [url]http://programmingexamples.net/index.php?title=Qt[/url] And the Qt documentation itself is very good: [url]http://doc.qt.nokia.com/latest/classes.html[/url] | |
Re: Please try to pose your question in a way that can be demonstrated in < 20 lines of code and is generally usable for other readers. | |
Re: Here is an example: [url]http://programmingexamples.net/index.php?title=CPP/RandomNumbers[/url] What is the error you're getting? |
The End.