6,741 Posted Topics
Re: The best is the one that works best for your needs. Try out several, there are quite a few free ones you can use to get a feel for what features you want. | |
Re: When an array name is used, it is usually converted to a pointer to the first element. This only works for the [b]first[/b] dimension, so you're actually passing a pointer to an array of size dimensions, not a pointer to a pointer to float. | |
Re: >void main() This is not, and never has been, correct C++. main returns an integer. >int display_array(int array[], int& size) I notice that size is never modified, so the primary reason for passing a non-const reference doesn't apply. Because a reference is usually the same size as an int or … | |
Re: >because of personal reasons That's against the rules. None of the moderators (to my knowledge) would ever consider locking a thread for personal reasons. >because you are an advocate of Microsoft What does Microsoft have to do with C++ dying a slow death? | |
Re: What line does the error refer to, and how are you compiling your program? | |
Re: >Don't forget to read the Microsoft bashing jokes Microsoft bashing is cliche and annoying. Don't people have better things to think of and link to? | |
Re: Off the top of my head I would say it's not easily possible unless you set up the calling program to run as a unique user. Then you could check to see what user owns your program's process (such as with ps) and terminate if it isn't the right one. | |
Re: Is there any reason this has to be an interactive file rather than an interactive terminal session that writes to a file periodically? | |
Re: I'm not quite sure what you're asking. Do you want to stop reading scores for that name at the first negative number? If so, why does your example have a score after a negative number and not a name? If not, what is a negative score supposed to mean? Given … | |
| |
Re: So you want to add a new feature without doing any work? ;) Since the data is already in a file, the path of least resistance is to send it to the spooler by way of a system command: [code] case ON_LEFT_CLICK: system ( "print test.txt" ); break; [/code] | |
Re: Compare and contrast: [code] #include <iostream> using namespace std; int main() { int even = 0, odd = 0; int input; cout<<"Enter a set of numbers: "; while ( cin>> input ) { if ( input % 2 == 0 ) even += input; else odd += input; } cout<<"Even: … | |
Re: To summarize, you want to know how to write a robust program. Unfortunately, that's an art that takes experience and practice. There aren't really any tricks to it. Just know what errors could possibly happen and write code to handle them gracefully (such as with try..catch blocks). | |
Re: >but why? Have you ever tried to convert a complex algorithm written in Pascal to C? ;) | |
Re: What version of Borland? Is it command line or IDE? All compilers support multiple files and search for .h as a default header extension, so most likely you're doing something wrong. | |
Re: >segment _TEXT exceeds 64 k Your program is too big. This has nothing to do with how many variables you use at once or how much dynamic memory is allocated. The machine code instructions and related information after compiling exceeds the limits of your implementation. Trying to fix this would … | |
| |
Re: murgi666: Please use code tags. | |
Re: Think in terms of rows of records consisting of fields instead of rows and columns: [code] in = fopen ( "data1.txt", "r" ); if ( in == NULL ) { /* Error */ } else { int i, j; do { fscanf ( in, "%s", dummy ); if ( strcmp … | |
Re: >this is a quote taken from my text book Your textbook misspelled sentence? strtok is fine if you understand that it modifies the original string. This means that if you need the original for anything later, you need to make a copy first, and if the original string is const … | |
Re: >learn proper OO techniques That I can understand. >proper Java class naming Sun recommends a style for Java, but that doesn't mean it has to be used. I disagree with several of their recommendations and thus, don't use them. As long as the style is consistent, anyone should be able … | |
Re: I assume by acute you mean equilateral. It's terribly difficult to get all of the acute trianglesto print accurately using command line output. Instead of one nested loop, try two. The first nested loop should handle spaces and the second should handle asterisks: [code] for i = 0 to N … | |
| |
Re: [QUOTE=guest][COLOR=Red]he ha ha ha ha ha ah aha aha aha aha haa ha ha ha ha ha ha aha ha aha ahja aha ha ah [/COLOR] [SIZE=4]1[/SIZE][FONT=Comic Sans MS]1[/FONT] :rolleyes: :p :lol: :mad: :( :mrgreen:[/QUOTE] Please refrain from bumping two year old threads. | |
Re: >every program we wrote would excute some programming by inputing data >or outputing data on a black "DOS" looking screen. I make a good living doing just that. In fact, I've never written a GUI or any graphical component. It's funny how everyone seems to think that they're not really … | |
Re: >"error c2447: missing function header (old-style formal list)" And the line of code that goes with this error? Clearly you're trying to do something that looks something like a K&R style function definition, but C++ doesn't allow those. | |
Re: >So I can just change the one entry? Yes, but only if the entry or record is a fixed length. Otherwise you risk overwriting the next entry. Can you describe the format of your file? That's a huge factor in how you read from and write to it. | |
Re: It looks fine, though what happens if you have a one or two node tree here? [code] return isBST(r,r.left.key, r.right.key); [/code] It would be better to come up with some sentinel min and max value to pass to isBST rather than requiring the tree to have at least three nodes. | |
Re: >You need a bubble sort algo. Please don't suggest bubble sort if other options are available. | |
Re: >double powerTo(double, int){ You need to name the parameters as they're declarations, not placeholders. >if(int < 0){ How could the type int be compared with a value of type int? [code] /* x to the nth power */ double powerTo ( double x, int n ) { double ret = … | |
Re: As much as we love to read line after line of unformatted code, please use code tags. I've added them for you this time. | |
Re: Draw a filled rectangle that's n pixels bigger than the image, then draw the image over it. The effect is an n pixel rectangle around the image. | |
Re: Iamhere: This is your first official warning. Don't post multiple threads with the same question. If you keep doing it, I'll be forced to take disciplinary action. If you find you forgot to add something to your post, you can edit it. Also, please use [url=http://www.daniweb.com/techtalkforums/misc.php?do=bbcode#code]code tags[/url] when posting any … | |
Re: Can you rephrase your question? Don't put it in a comment, describe it thoroughly outside of your code snippets. Preferrably with examples of the input and output you want. | |
Re: You have quite a few problems. Compare this with what you have and see if you can find them: [code] #include <iostream> using namespace std; void sort ( int a[], int n ); int main() { const int LIMIT = 5; int array[LIMIT]; cout<<"Enter "<< LIMIT <<" numbers: "; for … | |
Re: I've posted a [url=http://cboard.cprogramming.com/showthread.php?s=&postid=217303]reply[/url] to this question that has proven useful to others before. Maybe you can get some ideas from it. | |
| |
Re: There are basically two ways to ensure that no number is repeated. The first way is to randomly permute a list of numbers with no duplicates. Then you can just ask for n numbers from that list and they should be fairly random: [code] public class scratch { public static … | |
Re: >I figured that it probably was due to the system running out of memory to allocate No, not directly at least. You can get a segmentation fault because malloc failed and returned a null pointer, but the system running out of memory (while incredibly unlikely) wouldn't result in a seg … | |
Re: A good start is something along these lines: [code] #include <iostream> using namespace std; int main() { int n; while ( !( cin>> n ) && !cin.eof() ) { cerr<<"Invalid input"<<endl; cin.clear(); cin.ignore ( cin.rdbuf()->in_avail() ); } if ( !cin.eof() ) cout<<"You entered "<< n <<endl; } [/code] It still … | |
Re: >char FirstCharacter[1]; // Character string to hold to value found by This must be an empty string or it cannot be a string at all. C-style strings require a null character at the end as a terminator. You would really be better off just using a single char. >if (FirstCharacter[0] … | |
Re: Is there any reason you're using inheritance when a few non-member functions for String would work just as well with less work? | |
Re: >i have just got my self a Borland 4.5 from ebay You got ripped off, no matter what you paid for it. Borland 4.5 is too old to be useful these days, and Borland gives away their 5.5 compiler for free. >like to be able to put a shoping cart … | |
Re: Multidimensional arrays are actually arrays of arrays, so you need to allocate memory to reflect that: [code] char **p = new char*[rows]; for ( int i = 0; i < rows; i++ ) p[i] = new char[cols]; [/code] Then to free them: [code] for ( int i = 0; i … | |
Re: This is the third time you've asked the same question, maybe no one here can help you, but then again, maybe you're asking the question wrong. I'll leave this thread unlocked on the off chance that some kind soul wants to tell you what's wrong about your question. | |
Re: I've added code tags for you this time. Please review [url=http://www.daniweb.com/techtalkforums/misc.php?do=bbcode#code]this page[/url] before posting again, and be sure to use code tags when posting code. | |
Re: Start at array.length - 1 instead of 0, and make sure that you don't actually access the -1th index. ;) | |
Re: >I'm not sure if I should click on compile or build. A missing brace is a syntax error. You can get that during the compile stage, so either Compile or Build will work because Build compiles first, then links. |
The End.