338 Posted Topics

Member Avatar for Premlal

[QUOTE=Premlal;1066905] This code will not compile because I am trying to assign a myTemplateClass <int> pointer or myTemplateClass <char> pointer to myTemplateClass pointer. Can we declare a pointer array that can hold myTemplateClass pointer of any type? Using void pointer will not help much, since it needs a lot of …

Member Avatar for Premlal
0
2K
Member Avatar for floyd54

Unless I'm mistaken, your code won't compile. The first problem is that the compiler doesn't like you to declare the size of an array at runtime, it wasn't to know how big the array will be at compile time. (You can get around that by using an array that you …

Member Avatar for Murtan
0
93
Member Avatar for jessicamelillo

Also, when posting your code for us to look at, please use code tags: [noparse][code] // Your code goes here [/code][/noparse] It makes the code MUCH easier to read. (There are several people that won't even look at your problem unless you use code tags.)

Member Avatar for Murtan
0
89
Member Avatar for fummy

When posting python code, please use python code tags You have to post your code with code tags so we can see the indents. And as this is your second thread on the same topic and you didn't answer my question in the first...is searching a single file what the …

Member Avatar for Murtan
0
187
Member Avatar for lisedaton

I don't think I understand the second example... [QUOTE] input: i have 2 bananas and 3 oranges print: 1+2+3= 6 [/QUOTE] Where'd the 1 come from? Code comments: line 6: [code]data = input("Please enter a string\n")[/code] Should use raw_input to get string data. You appear to be dividing the characters …

Member Avatar for Namibnat
0
93
Member Avatar for new programer

You're losing the first character of the full name inside the first for loop (of concat()). The second and third loops add each character to what was in fullname, but the first loop assigns each character to fullname. The second character in title overwrites the first. (If the title were …

Member Avatar for new programer
0
157
Member Avatar for ncwolfe

Templates require the users to see all of the member functions. You can't have the methods 'hidden' in a c++ file. If the code creating the instance of the template doesn't "see" the method, the method does not get implemented. This is due to the way templates are implemented. They …

Member Avatar for ncwolfe
0
224
Member Avatar for fummy

Lets try to describe the problem better... Is the problem: a) search the directory for a file name b) search a specific file for string data c) search all of the files in a directory for string data d) search all of the files in a directory tree for string …

Member Avatar for fummy
0
94
Member Avatar for Snapster5

Based on what you have there, I suspect you're supposed to write the two functions: int empty_array_insert(int[], int); void display_in_reverse(int[], int);

Member Avatar for Dave Sinkula
0
122
Member Avatar for redwolf99

Assuming that your sort works... [CODE] if (n[0] == n[1] && n[3] == n[4] && (n[2] == n[1] || n[2] == n[3]))[/CODE]

Member Avatar for redwolf99
0
2K
Member Avatar for laelzio.mosca

Work the problem in steps. I see the steps as something like: Prompt the user for where to put their symbol Accept the user input Validate that they entered something acceptable and that the location they asked for is available Set the location to their character You would then probably …

Member Avatar for Murtan
0
181
Member Avatar for ffs82defxp

The %d in [icode]print("wait %d seconds ..." % sec)[/icode] will be replaced with the numeric value of sec. I didn't see the %s, but it is used for string values. @Gribouillis Shouldn't line 39 test start + 3 against the length of the list? We're going to be referencing array …

Member Avatar for Gribouillis
0
173
Member Avatar for dvbrooks

as far as I can tell, you're only "drawing" the sides of the square, you didn't do the top or bottom yet... In the sides code, the internal loop (for the spaces) is destructively decrementing your limit. (I'm referring to the s-- that limits your loop.) You should either reset …

Member Avatar for dvbrooks
0
77
Member Avatar for vishesh.verma

I'd be much more willing to look for the problem if you listed the line number the compiler complained about. Generally giving us all of the information you have about the problem is a good idea.

Member Avatar for StuXYZ
0
81
Member Avatar for KRal

Wow, deja vu, but better problem description. The last word won't be followed by a space... add another [icode]if (counter > longest_word)[/icode] outside the for loop to handle the last word. or alternatively...you could just add a space to the end of the string to make sure that there is …

Member Avatar for KRal
0
97
Member Avatar for rmcummings

The only obvious thing I see is that it doesn't try to save the length of the last word, it would appear to work for everything else. The last word in the sentence won't be followed by a space, it will be followed by the end of the string. Add …

Member Avatar for Murtan
0
111
Member Avatar for infern0

I'm presuming that x is the number of array entries you filled. A more descriptive name would be more appropriate. line 15 in your code would be executed for every pass of the loop. If the first one doesn't match, then line 15 assumes you can't find it and terminates …

Member Avatar for Murtan
0
112
Member Avatar for Gem74

It looks to me like the status function only writes the prompts that precede an input. The test for status in the code jonsca posted causes the input to be skipped so that might fix your problem. (If not, try entering a value where the program appears to be paused …

Member Avatar for Murtan
0
277
Member Avatar for samipa

We like to help people who appear to at least be attempting to help themselves. I suspect line 7 won't even compile. What is the code supposed to do? What does it do now?

Member Avatar for tkud
1
87
Member Avatar for MRWIGGLES

Should your turtle support a pen up / pen down setting? Should your turtle support a pen color? It should be straight-forward to write the 'forward' code... You have a current location and a direction and a distance. [code=] for each step in the distance: If the pen is down: …

Member Avatar for Lardmeister
1
153
Member Avatar for merse

I was working on a reply similar to Narue's but she says it so much better I threw mine away. But she's right. Generally the rule is first, make it work, then if necessary make it work fast. This isn't a license to do obviously stupid things, but if you've …

Member Avatar for merse
0
170
Member Avatar for aq5

It is BAD FORM to bring a thread that is over 3 years old back to life. If you have a problem, you might follow the suggestions in the thread to get started. Once you've made some progress, start your own thread. For homework or assignment type problems, we expect …

Member Avatar for Murtan
0
459
Member Avatar for theeurostick

Please use code tags so we get indenting and line numbers [noparse][code=c++] // Your code here [/code][/noparse] and if you're wanting help with compile errors, maybe you could post the error message?

Member Avatar for Lerner
0
295
Member Avatar for hondros

The error you were reporting was based in your original code: [code=python] if letters[x] == ' ': y = 0 message_number.append(y) x = x+1 if letters[x] == 'A' or 'a': y = 1 message_number.append(y) x = x+1 if letters[x] == 'B' or 'b': y = 2 message_number.append(y) x = x+1 …

Member Avatar for jlm699
0
151
Member Avatar for snakay

Either the record doesn't exist (the [icode]dfSicilNo.Text[/icode] does not exist) or if the record does exist, the field is null. You should be able to ask the query how many rows (records) it returned (if it is zero, then the record wasn't found). If there was a row returned, you …

Member Avatar for snakay
0
135
Member Avatar for RehabReda

I tried to read your code to understand your algorithm, but I didn't recognize it, and the limited commenting you provided didn't make it much clearer. If you run the program with the sample from the link, do you get the same output? What other test data did you provide …

Member Avatar for RehabReda
0
170
Member Avatar for fatboyandy

Given your input data (14 grades, one of which was an A) I would have expected 3 * for A percent = 100 / 14; // 7 in integer math Acent = percent * a / 2; // 3 in integer math Do the other grades display the number of …

Member Avatar for Murtan
0
117
Member Avatar for lotrsimp12345

The previous posters point was that you have an IF statement on line 17... an if is either true or false... The 'true' clause has a return on line 19 and the 'false' clause has a return on line 23... So in either case, the function has returned before you …

Member Avatar for lotrsimp12345
0
65
Member Avatar for simplyscottif

Well, ignoring that your input doesn't do much to protect the user from themselves (for example, enter "fred" when it asks for the account number and see what happens)... Do you know in advance (or can you ask) how many they want to enter? If you could, you could wrap …

Member Avatar for Murtan
0
229
Member Avatar for kitty7

The code as posted has a few problems: In combination with [ICODE]const int MAXADDRESS = 25;[/ICODE], the statement [ICODE]char people[MAXADDRESS];[/ICODE] declares an array of 25 characters. But later in methods of the class, you treat people like it was an array of PERSON. See: [ICODE]people[head] = p;[/ICODE] and [ICODE]p = …

Member Avatar for jyoti bansal
0
227
Member Avatar for dirnthelord

I don't see where your enqueue function sets the next and prev members of the node. When the queue is empty, front and rear should both be NULL. When you add the first node, front and rear should point to the new node and its next and prev should be …

Member Avatar for dirnthelord
0
214
Member Avatar for bbballin

We like to help those that show some effort, especially when it appears to be an assignment. Show us what you've tried. Tell us what it does and what you expected it to do and we can help you make the two match up better. (I wouldn't be surprised to …

Member Avatar for mrnutty
-1
151
Member Avatar for magicor

If the parent process doesn't have to wait, why does it care who finishes first. If at least one child process needs to finish, then you have to wait.

Member Avatar for dkalita
-1
90
Member Avatar for CurtisEClark

Please use code tags when posting code You will need to re-input the health inside the loop so that it will ask the user for the health again. I suspect the current version outputs the 'health status' waits for enter and then outputs the same status again.

Member Avatar for vegaseat
0
242
Member Avatar for HappyOrangutan

I'm not sure what your problem is, when I compile and run it: start Caught One! Ex. #: 1 Caught One! Ex. #: 2 Caught a string: Value is zero Caught One! Ex. #: 3 end

Member Avatar for HappyOrangutan
0
226
Member Avatar for sleight

For the most part in c++, a class is almost the same as a struct. The key difference is that members in a struct default to public, in a class they default to private. You made all of the members of your class public so it shouldn't really matter. Your …

Member Avatar for sleight
0
204
Member Avatar for Natique

Your problem is inside the while loop. [code=c++] while (whileIter != tmpCsvFile.end()) { whileIter++; if (fileName == (whileIter->fileName).c_str()) break; } [/code] You have advanced the iterator (possibly to the end) before you try to test the filename. Put the fileName test (with the break) before the iterator advancement.

Member Avatar for Murtan
0
350
Member Avatar for low1988

Why not just 'add' the records you want in main, after you construct the list? [code=c++] int main() { List test; test.InsertEmployee("Michael bay",1234,"Design"); test.InsertEmployee("Enrique",5678,"Production"); test.InsertEmployee("Fernando ",9012,"Management"); test.DisplayList(); getch(); return 0; } [/code] Note that DisplayList() as written is broken and will only display one record. I think that InsertEmployee() will …

Member Avatar for Murtan
0
115
Member Avatar for vextorspace

I can't find the examples right now, but I recall modifying the setup.py to perform a search for some DLLs and using the path I found in the data section. so instead of the constant string [icode]'msvcr71.dll'[/icode] you would use a string variable which contains the full path (as built …

Member Avatar for vextorspace
0
279
Member Avatar for teddies

Generally, I like it. (You're right, a GUI would help a lot to follow what's going on. ) Just a couple of nit-picky items: I don't think it is good form to have the Tank's __init__ method prompt the user for a tank name. I'd rather see the prompt in …

Member Avatar for Murtan
0
330
Member Avatar for echo off

I think the forcibly stopped comes from the reader application reading one line and exiting. Can you put the read into a loop of some form? If you're going to write to the stream more than once, you should probably read more than once. You'll probably want to add detection …

Member Avatar for echo off
0
163
Member Avatar for GDICommander

It looks like it compiled, so the symbol was defined enough for the compiler to recognize them. The link process is where the actual executable is built. The linker needs to match up the symbol that your main calls with the actual implementation. You should probably add the pcsfile.cpp to …

Member Avatar for GDICommander
0
116
Member Avatar for TubbyT

The code you posted wouldn't even compile, let alone run. Please be specific in the problem you are having. I think the following is close to what you wanted, but it uses global variables which have their own problems: [code=Python] import Tkinter as tk root = tk.Tk() root.title('background image') def …

Member Avatar for Murtan
0
134
Member Avatar for eproo

I don't know what your problem is in particular, but it may be that you need to allow autocad some time to process the first command before it is ready to accept the second command. Alternatively if you are using OLE or COM to interface with AutoCAD, you need to …

Member Avatar for ognyandim
0
314
Member Avatar for Norbert X

I would reset the player and monster health at the start of the battle. The weapons would make a good class, the weapon has a name, a cost and an amount of damage. Then you could make a list of weapons that could be iterated for display at the shop. …

Member Avatar for Norbert X
0
645
Member Avatar for JimD C++ Newb

Not surprisingly, but your program is doing what you told it to: [code=c] // Wait here for the user to enter a message gets (msg); while (msg != "q") { /* Write out message. */ if (write(sock, msg, sizeof(msg)) < 0) pdie("Writing on stream socket"); /* Prepare buffer and read …

Member Avatar for JimD C++ Newb
0
433
Member Avatar for konczuras

Will the users of your application be connecting to your SQL server or is the intent for them to connect to their own server? The following presumes they will be connecting to your server: Hard coding the connection string makes it a little harder to find, but unless you're encrypting …

Member Avatar for konczuras
0
233
Member Avatar for gotm

You're having an entity vs value comparison issue: [code=python] a = [[1,2],[2,0]] b = [2,0] aa = a[1] # at this point, b = [2,0] and aa = [2,0] # but aa == b returns False # aa[0] == b[0] returns True # aa[1] == b[1] returns True [/code] Python …

Member Avatar for woooee
0
124
Member Avatar for srk619

Maybe you should look at the python bit-wise operators in the [URL="http://docs.python.org/reference/expressions.html#binary-bitwise-operations"]Python Docs[/URL]

Member Avatar for srk619
0
2K
Member Avatar for phpNewbie

I think the problem with the 'both' option is that when you select 'both' on the form, gender is set to '' and not to 'both'.

Member Avatar for phpNewbie
0
152

The End.