338 Posted Topics
Re: I think your only option is to change the color of the characters. Take a look at [URL="http://www.daniweb.com/code/snippet134.html"]this snippet[/URL] If you set your 'default' color to grey or light grey, white characters will appear 'brighter'. | |
Re: I would have sworn I saw starting code almost identical to this a few weeks ago. Did you search for prior solutions? Did any of them have the same problems? Have you applied any of the advice in those threads? Generally speaking, we would prefer you to post your code … | |
Re: You could do something like this with regular expressions: [code=Perl] if ($stringToSearch =~ /string_id\((.*?)\)/) { print "Found $1\n" } [/code] | |
Re: I will comment however that users tend to like things to start at 1 rather than 0. If I'm asking a user questions, it makes more sense to them to answer questions 1 - 10 rather than questions 0 - 9. This is however also easily handled at the output … | |
Re: On most operating systems, you should be able to setup a 'local' ftp server to test the functionality. If you have a local network with at least one other computer, maybe you could setup an FTP server there. I am not presently aware of any computers 'in the wild' that … | |
Re: Show us the code where you create a RuleSet and then where you add a Rule to the RuleSet. [icode]RuleSet * Genome[/icode] declares a pointer to a RuleSet but never actually creates one. If you don't add any code and then call [icode]Genome->AddRule(...)[/icode] Genome is an undefined pointer (probably NULL) … | |
Re: [quote]store them anywhere[/quote] Who gets to pick where they are stored? Ok, post the code for what you already know how to do. Remember to use C code tags: [noparse][code=C] /* your code here */ [/code][/noparse] | |
Re: If the word file is one word per line: [code=python] infile = open('wordlist','r') wordlist = infile.readlines() infile.close() [/code] You do need to strip() the lines, but I would defer it. You could just strip the word you select, and I like random.choice() to pick one from a list. [code=python] selectedword … | |
![]() | Re: I'll try and look at it anyway, but if you have an error, why don't you include where the error came from (almost all compilers will give you a line number). Also, when posting C code, please use C code tags [noparse][code=c]/* code here */[/code][/noparse] like this: [code=c]/* code here … |
Re: The algorithm as posted only counts pixels that are green and only green. There is no provision for counting something that is 'almost' green. The (0,255,0) represents the color...that's 0 parts red, 255 parts green, 0 parts blue. The color (0,255,1) while visually VERY close, is not the 'pure' green … | |
Re: I've never worked with Scheme, or Haskell so I can't readily debate their merits. From what you posted that you know (VB and Assembly) I would recommend that you learn an object oriented language. The goal of working in the language is actually not-so-much to learn the language, even though … | |
Re: You're not showing any of the actual compares. The structs to be compared will need to have implemented whatever operator or method is called to do the compares. Note that the word 'Comparable' in your template definition makes no constraint on the type of things you can put on your … | |
Re: Ok so lets 'draw' one by hand and then figure out how to get the computer to do what we did. (I'm going to use '.' instead of ' ' so you can see them.) Ok so in my head, I start with the base of the triange as that … | |
Re: Looks to me like a template function waiting to happen. Google (or search here) for C++ templates they let you write code where types can be arguments. This allows you to write functions similar to what you propose. | |
Re: I didn't have any problems compiling your code with VC++ Express. There were 3 warnings about converting double to float for [icode]yourPos(.1, .2, .3)[/icode] It seemed to run as expected as well. Just a couple of other comments: Member functions do not HAVE to use accessors, even if it is … | |
Re: I like the vector solution to only read through the file once. I'm presuming you would have 2 vectors, one for genes and one for cells. Is is possible that genes or cells might occur more than once in the file? If they do occur more than once, did you … | |
Re: I think I'd use [ICODE]mktime[/ICODE] or one of its equivalents, it calculates a [icode]time_t[/icode] from [icode]struct * tm[/icode] Read the notes about the [ICODE]tm_isdst[/ICODE] field. | |
Re: I still remember some of those days... I started out trying to modify a "starwars" game (shoot the tie fighter) for the Commodore PET. I found that setting the high bit of the display byte would cause the character to be inverted (black on white vs white on black). So … | |
Re: The if and else need to be 'inside' the case, and the if block and else block need their own set of braces { }. [icode]if (test) { // code } else { // more code }[/icode] [code=c++] case SMS_Construction: if(tfgame.ToggleWarhead == true) { SMNameArray[0] = "Shield (50/30)"; SMIndexArray[0] = … | |
Re: As I understand it, Python couldn't care less how many spaces / tabs you use other than requiring that all lines within a block must have the same amount of whitespace. Any statements you have which start a new block (see above in this thread) require that the new block … | |
Re: This sounds a lot like another recent thread where the developer 'needed' to name the variables based on user input. The name that you use inside the source need not have anything to do with the name the user sees. It would be your responsibility as the developer to map … | |
Re: You never initialized aantal_getallen which is the number of records to read/sort/print. | |
Re: When you get to the actual sorting, you kinda need to compare numbers and not strings. When comparing strings, '1234' comes before '2', and that's just not right. For the splitting of the name from the age, look at [icode]rsplit(' ', 1)[/icode] that splits the string into an array of … | |
Re: Are you saying that you want an algorithm that will return longer paths if the shortest path has too many edges? Is the longer path likely to have fewer edges? | |
Re: I like the concept. You could even pre-initialize the map in memory with default values before attempting to read the file. If the configuration was in the file it would be overwritten. I do have a couple of questions though: Where does the settings.txt file end up?. In order to … | |
Re: Abstract classes are not instantiateable (you can't make one) for example, if Polygon is abstract, the compiler will not let you call: [icode]new Polygon();[/icode] A class is normally made abstract by defining one (or more) methods as 'pure virtual'. A pure virtual method is one that is declared (return type, … | |
Re: I came up with a couple of regexes, depending on whether you want cogger to the end of file, or just cogger to the next agent (or end of file) [code=python] import re data = """User-Agent: Googlebot #Disallow: / Disallow: /comments Disallow: /user Disallow: /poll Disallow: /print Disallow: /search User-Agent: … | |
Re: You could use a dictionary where the key was the composite index, something like [icode]key = "%d_%d_%d_%d" % (w,x,y,z)[/icode] or [icode]key="W%dX%dY%dZ%d" % (w,x,y,z)[/icode]. I think the dictionary would manage the collection fairly well. | |
Re: dougy83 you could make that assignment to hold the allocation, but to me it looks like a memory leak waiting to happen and in a professional setting I would fail your code review for it. There are also data structures that lend themselves to pointers, for example linked lists. As … | |
![]() | Re: Not to be picky, but [icode]#define NUMBERS[/icode] is a pre-processor directive and doesn't get scope. (But it should have been outside the function anyway.) ![]() |
Re: [icode]void[/icode] doesn't return, but [icode]void *[/icode] or in this case [icode]void ***[/icode] does. A [icode]char * * *[/icode] is a pointer to a pointer to a pointer to char. Its a bit of an odd construct, I don't recall using triple pointers much. I would agree that you should avoid … | |
Re: Your code as you posted it is basically correct. The include for some should be [icode]#include "some.h"[/icode] the version you used will not search the current directory the quote version will search there first. The function prototype in some.h should match the function signature. Your some.h has [icode]void some()[/icode] but … | |
Re: If dd[0] and dd[1] contain the character they entered, the character is NOT the numeric value. (For example in ASCII '0' is 48) So if the example is dd[0] = '2' and dd[1] = '3' then [icode]aa = dd[0] + dd[1];[/icode] would give aa the value 50 + 51 or … | |
Re: If you have an assignment you want help with, describe the goal, any requirements and post YOUR code to show what you've done. Then we'll help you get from where you are to where its done. PS- please surround your c++ code with code tags: [noparse][code=c++] // your code here … | |
Re: I think I understand your data structure from your description. I think I understand how you search it. I think I can agree with your premise for the worst case search. I think the math for your average case should be i/2 + j/2. However, I don't think I understand … | |
![]() | Re: The wikipedia article talks about the two fonts because the cipher is designed to be used as steganography (hiding in plain sight). First you take your coded message I'm lazy so my message is "apple". Then you baconize it: AAAAA ABBBB ABBBB ABABB AABAA Then you use the a's and … |
Re: That sure looks like an assignment to me. We generally don't do your assignements for you. If you want help with it, you give it a start and then ask questions about the problems you're having. (And what's with the poll at the top of your plea for help?) | |
Re: The error I got was that ch was being used without being initialized It pointed to line 5 in this code: [code=c++] void express::parse(){ int i=0,x=0; char ch; while(i<len){ if(ch>='0'&&ch<='9'){ [/code] Where it is obvious that you declared ch on line 3 but have not assigned a value. What did … | |
Re: To the best of my knowledge, it is not possilbe, and I can't imagine a scenario where it is really required. I'm pretty sure that the map example (associative array) is really what he wants to do. He wants to create an object and associate it with the name the … | |
Re: If I read the code right, the intent is to split up color table values? bytes in the file come as r,g,b,r,g,b... You want the array to contain r,r,r...g,g,g...b,b,b... Is that close? if so, what do you think of: [code=c] char *glblclrtab; glblclrtab= malloc(3*tmp); for (int i=0; i < tmp; … | |
Re: Does your lower case letter L look like a 1? It does on my screen. | |
Re: most of your compile errors are in the library headers? Are you missing a switch (compiler option)? (I'm trying to compile it in Visual C++ Express and I'm getting an entirely different set of errors.) | |
Re: The constructor did exactly what you asked it to (as all software should.) [code=c++] numgetter() {num=0;} [/code] Defines the constructor to initialize the num to zero. | |
Re: I took the zip file and made a MS project around it. I had to add [icode]#include <algorithm>[/icode] to hand.cpp but other than that it compiled. I then uncommented your troublesome line: [code=c++] void pokerGame::showdown() { for(unsigned int i = 0; i < m_players.size(); ++i) { if(m_players[i].getHand().getSize()!=0) { std::cout << … | |
Re: His posted code was not intended as a solution, but as a guide into you finding your own solution. The function "GetGoodAnswer" is full of comments telling you what it should be doing, but it doesn't actually do any of what you see. And no, that print isn't going to … | |
Re: The printf("\r") works really well to have the console screen overwrite the 'current' line. It will however just be another character in the output if cout is redirected to a file. I used to use that feature to show progress for an old command line compiler, it would output the … | |
Re: The code looks like it ought to work. Could you try something for me? (Look for compiler errors or warning around this area, it might be a clue). (Note: if your first code tag says code=c++ you get line numbers and syntax highlighting) [code=c++] void outputQueue(queue<pcb*> readyQueue) { queue <pcb*> … | |
Re: People write introductions and tutorials so they don't have to answer the same question every time someone new gets it. Please try to use the resources that exist before trying to have someone re-invent the wheel. If you look at something and you don't "get it" feel free to post … | |
Re: Give me a little more help so I can help you. What would an example input string look like? What output(s) would the code need to produce? | |
Re: The problem with using "A-" as a variable name is that it is illegal. You can create a variable A_minus without any problem, but you don't want the user to be inputting your variable names anyway. You will want to take their input as a string "A-" and use that … |
The End.