338 Posted Topics

Member Avatar for BobLewiston

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'.

Member Avatar for Murtan
0
77
Member Avatar for tutti

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 …

Member Avatar for Murtan
0
76
Member Avatar for blboyd

You could do something like this with regular expressions: [code=Perl] if ($stringToSearch =~ /string_id\((.*?)\)/) { print "Found $1\n" } [/code]

Member Avatar for Murtan
0
77
Member Avatar for uxp

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 …

Member Avatar for uxp
0
141
Member Avatar for Phil++

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 …

Member Avatar for Murtan
0
301
Member Avatar for heimdhal

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) …

Member Avatar for heimdhal
0
105
Member Avatar for taichou

[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]

Member Avatar for Murtan
0
91
Member Avatar for acoxia

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 …

Member Avatar for ashutosa
0
171
Member Avatar for RenFromPenn

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 …

Member Avatar for Murtan
0
148
Member Avatar for kiddo39

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 …

Member Avatar for kiddo39
0
343
Member Avatar for winrawr

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 …

Member Avatar for Rashakil Fol
0
117
Member Avatar for abhishek2301

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 …

Member Avatar for Murtan
0
280
Member Avatar for mnmustafa

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 …

Member Avatar for kbshibukumar
0
121
Member Avatar for IMJS

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.

Member Avatar for Murtan
0
153
Member Avatar for nitrooreo

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 …

Member Avatar for nitrooreo
0
310
Member Avatar for michaelmorris

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 …

Member Avatar for michaelmorris
0
325
Member Avatar for aramakri

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.

Member Avatar for Murtan
0
58
Member Avatar for Zach1188

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 …

Member Avatar for Murtan
0
117
Member Avatar for Grimshad

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] = …

Member Avatar for Grimshad
0
181
Member Avatar for revenge2

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 …

Member Avatar for mn_kthompson
0
122
Member Avatar for cam875

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 …

Member Avatar for cam875
0
118
Member Avatar for Swemp

You never initialized aantal_getallen which is the number of records to read/sort/print.

Member Avatar for Swemp
0
5K
Member Avatar for Ghostenshell

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 …

Member Avatar for Murtan
0
105
Member Avatar for blackslither

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?

Member Avatar for Murtan
0
1K
Member Avatar for Ronen444

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 …

Member Avatar for twomers
0
186
Member Avatar for Simran1

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, …

Member Avatar for Agni
0
157
Member Avatar for codedhands

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: …

Member Avatar for codedhands
0
107
Member Avatar for mmxbass

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.

Member Avatar for mmxbass
0
157
Member Avatar for fireballnelson

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 …

Member Avatar for ArkM
0
169
Member Avatar for RenFromPenn

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.)

Member Avatar for RenFromPenn
0
114
Member Avatar for Relative0

[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 …

Member Avatar for ArkM
0
82
Member Avatar for Ronen444

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 …

Member Avatar for Murtan
0
129
Member Avatar for kikloo

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 …

Member Avatar for Murtan
0
269
Member Avatar for krm08

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 …

Member Avatar for MosaicFuneral
0
108
Member Avatar for apaciboy

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 …

Member Avatar for Murtan
0
148
Member Avatar for leegeorg07

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 …

Member Avatar for Stefano Mtangoo
0
562
Member Avatar for rajesh_pec

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?)

Member Avatar for Murtan
0
82
Member Avatar for athar89

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 …

Member Avatar for Murtan
0
185
Member Avatar for NewtoC++

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 …

Member Avatar for NewtoC++
0
18K
Member Avatar for m24r

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; …

Member Avatar for death_oclock
0
168
Member Avatar for AstralCorpse
Member Avatar for mn_kthompson
0
135
Member Avatar for ademsaykin

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.)

Member Avatar for ademsaykin
0
299
Member Avatar for CPPRULZ

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.

Member Avatar for CPPRULZ
0
145
Member Avatar for mrboolf

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 << …

Member Avatar for Murtan
1
527
Member Avatar for tutti

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 …

Member Avatar for bvdet
0
121
Member Avatar for lehe

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 …

Member Avatar for ajay.krish123
0
123
Member Avatar for mesnomer

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*> …

Member Avatar for ArkM
0
84
Member Avatar for POKEMONMASTER26

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 …

Member Avatar for Murtan
0
156
Member Avatar for Rejinacm

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?

Member Avatar for Rejinacm
0
76
Member Avatar for SpeedMath

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 …

Member Avatar for SpeedMath
1
809

The End.