3,386 Posted Topics
Re: #include <stdio.h> #include <stdlib.h> int main() { return(EXIT_SUCCESS) } And zeroliken's pseudo code should be enough help to start. | |
Re: We are flabbercasted by your poetry, but did you have anything specific to ask or your efforts to show? | |
Re: Are you sure that you needed to remove them instead of only not show them or pass them? #include <stdio.h> #include <stdlib.h> int iarr[] = {1, 3, 0, 0, 5, 7, 0, 0, 0, 9, 9, 6, 0, 9}; int len = sizeof(iarr)/sizeof(iarr[0]); int main() { int i; for (i … | |
Re: I do not get why the dice value is doubled for computer, on first post you describe two die. | |
Re: You are not using the parameter T for anything. | |
Re: You must not define the method twice, and usually it is better practice to return value or set attribute of class, than print in function. | |
This came up, maybe it is usefull to somebody. Later I plan to do a managing context interface to `with`statement for this. | |
Re: > Configuring in OpenLDAP 2.1 and later - Since 2.1, the client libraries will verify server certificates. This change requires clients to add the TLS_CACERT (or, alternately, the TLS_CACERTDIR) option to their system-wide ldap.conf(5) file. Without this setting, the LDAP clients will fail to make any TLS/SSL connections to any … | |
Re: You have return out of function at line 9, and extra ** at line 4 as bold is not allowed in code. Based on http://snippets.dzone.com/posts/show/724: import win32clipboard as w import win32con from time import sleep def get_text(): w.OpenClipboard() d = w.GetClipboardData(win32con.CF_TEXT) w.CloseClipboard() return d def set_text(to_put, the_type=w.CF_TEXT): w.OpenClipboard() w.EmptyClipboard() w.SetClipboardData(the_type,to_put) … | |
Re: [backquotes](http://www.codecoffee.com/tipsforlinux/articles/26-2.html) with `cat`? | |
Re: I do not understand, you are doing string compare with uninitialized allwords array, before you read word inside the while, shouldn't you use for or do..while and check after reading?. | |
Re: The hover part is little tough (ie impossible) in my mobile, so no rep then from me, sorry! | |
Re: You can do triple for loop, one for each letter. | |
Re: As I can not run your code without the icons, I can not answer your questions, I for now only offer this clean up of your functions (untested), even I think their action should be reconsidered. #-----function definitions----- def font(): basicFont = pygame.font.SysFont(None, 50) questionFont = pygame.font.SysFont(None, 30) startcolor = … | |
Re: If you solved it yourself, it is nice of you, if you can post the solution for your thread, so other's can get help from it in future. | |
Re: > Student::Student(int ID, string Name) > { > ID = newid; > Name = newname; > } Shouldn't this maybe be (looks so but I am more C than C++ guy, never did OO with C++): Student::Student(int newid, string newname) { ID = newid; Name = newname; } | |
Re: [by recursion](http://www.devshed.com/c/a/PHP/Fundamentals-of-Recursion-in-PHP/) | |
Re: I have not used one, but this looks promissing and comes with example directory: https://github.com/sciyoshi/pyfacebook/ | |
Re: Major hindrance is for me only which is running faster, column or row number. Different programming languages have different practices. It is easy to name row for column and exchange the roles. Good thing is that it really does not matter so much as mostly this transposing does not matter, … | |
Re: You forgot your code and description of your problem. | |
Re: Usual way to guess optimally is to guess average of low guess (initially 0) and high guess (initially 101). | |
Re: Take care that you have strings, not integer values, so '9' would be maximum at column 1 and '10000' would be minimum at column 2. | |
Re: You forgot your code and description of your problem. | |
Re: It would be kind of you to post corrected code, so it can help others in future. Your sum example is not correct as I get 1+7+13+4 = 25. You must consider though that this is considered even sum, but the values are 1,3,5,7 by human counting even they are … | |
Re: I would use count down style without fixed number to be able to do any given number of repeats, and do Hello(1000) to do thousand of them, probably something like (I have not VB installed in my computer): Public Sub Hello(ByVal howmany As Integer) If howmany > 0 Then ListBox1.Items.Add("HelloWorld") … | |
Here slightly edited code from one of my earliest posts to DaniWeb. Limitted by recursion limit of Python as it uses recursion, but interesting for me. | |
Re: For me this is better and simpler: #include <stdio.h> #include <stdlib.h> #define fact 5 int main(void) { int i,result=1; for (i=1;i<=fact;i++) { result*=i; printf("factorial of (%d) = %d\n", i, result); } return(EXIT_SUCCESS); } | |
Re: You should have import seaWorld, not global seaWorld. I think it is not quite so clever to have 3 identifiers only differing by cases, use `my_seaworld` or something like it. | |
Re: If you do not find it, it is not there. | |
Here is my take on [balanced ternary](http://en.wikipedia.org/wiki/Balanced_ternary) conversion (the base considered by [Donald Knuth](http://en.wikipedia.org/wiki/Donald_Knuth) "Maybe the prettiest") | |
I would like to take string argument for class BalancedTrinary intializer, but the string type of argument is processed before it enters the init function. I guess I must override any class method which deals with those for int/long? def val(number_sequence, base): """ produce integer value of number_sequence as base … | |
Re: I would suggest lowest_terms function in accordance to above DRY rule 639 ;) | |
Re: You should always take small steps and add functionality only after fully tested last one to know that it is reasonably sure that the bug in code is in the last code added. General philosophy of testing is geared toward [defining test cases](http://blenderartists.org/forum/showthread.php?211957-Test-Development-Design-%28TDD%29-in-Blender-python "Test Driven Development") for the functions and … | |
Re: I would fix your code tags but it has no value as your code formatting indention does not make any kind of sense. See Formatting help from link in right top corner of the editor box. Basically you should highlight your code and push TAB to indent it. But first … | |
Re: You can not undo membership, but you can stop receiving emails from DaniWeb if you so desire from **EDIT PROFILE** | |
Re: You should maybe check updating of your bug list, you got anchor ampersands reported before. | |
![]() | Re: Redesign the algorithm, there must exist better algorithm than order of O(n^20). |
Re: Unfortunately we do not do homeworks, but we do help if you get stuck and post your code and debugging efforts. | |
Re: > generic template Yes we have one, it is called membership rules, and is clearly available from top bar. I see more problem on abandoned threads, where OP does not come back to read the answers and response to suggestions. For unanswered messages there is Unanswered and even more relevantly … | |
Here is base conversion function written to deal also with [negative bases](http://en.wikipedia.org/wiki/Negative_base). Not yet balanced ternary, where numbers themselves can be negative, maybe later I add it.. Based on the code in the wikipedia article, which has bug for converting 0.[**Edit: I fixed the bug in wikipedia**] | |
Re: >>> test = "cat ate the catfood and went to cat's bed to see cat dreams on catepillars." >>> test = ' '.join('dog' if word == 'cat' else word for word in test.split()) >>> test "dog ate the catfood and went to cat's bed to see dog dreams on catepillars." … | |
Re: > speed of insertion/deletion is not top priority. Array? | |
Re: This is not C code, it is C++ (cin&cout) | |
Re: Something like: def main(): badfoods = [] keys = ['Food','Chemical','Imminent death'] for food in [['alcohol', 'alcohol poisoning', 0], ['anti-freeze', 'ethylene glycol', 1], ['apple seeds', 'cyanogenic glycosides', 0], ['apricot seeds', 'cyanogenic glycosides', 0], ['avocado', 'persin', 0], ['baby food', 'onion powder', 0]]: badfoods.append(dict(zip(keys, food))) print badfoods main() ? | |
Re: First of all, looks like you have doubled values at col 2 and col3, so you can keep only one of them, you could produce upto 100 sorted files by the two first digits of col1. But important thing is how big this second file is? If it is not … | |
Re: http://www.cplusplus.com/reference/algorithm/sort/ | |
Re: The b is not in string, but it is sign of binary bytes string without set encoding. Why you produce copy of grp for printing, wouldn't it be more clear to print the grp? Or actually do for loop over items in grp. # you had first ) missing from … | |
Re: Ensure us on legality of this stuff you are asking. We are not cracking forum. See [Member Rules](http://www.daniweb.com/community/rules) |
The End.