5,237 Posted Topics
Re: > thanks for the things about frequency tables but we arent allowed to use them. Which is why it is pointless to ask people to do your homework. Not only would we have to vaguely guess at what you really wanted, we also have to guess at how much to … | |
Re: Pretty close with the last effort, but you still need to work on whether you're programming in C or C++. [code] #include <stdio.h> #include <math.h> int main() { /*!! missing */ char buff[BUFSIZ]; int i, a, b, c, x, n; printf("Enter the value for n:"); /*!! not scanf */ /*!! … | |
Re: Apart from using void main (this is wrong), what's your question? | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] | |
Re: > for (int i=0;i<row_size;i++) This is C, not C++ You must declare int i; at the start of the block, and then for (i=0;i<row_size;i++) > attempts++; Since the preceding if and else both contain continue, how is this line ever executed? Using a few more braces would help as well. | |
Re: Seems to me like it's a variation of the knapsack problem. [url]http://en.wikipedia.org/wiki/Knapsack_problem[/url] One way would be - all permutations of 1 coin - all permutations of 2 coins - all permutations of 3 coins etc For each permutation, add them up and see if they match the total you want. | |
Re: > im a frend of stringgader,, So create your own account (it's not hard) so we know who we are talking to. > this is my problem: And [URL="http://www.daniweb.com/techtalkforums/announcement8-2.html"]this[/URL] is the standard answer to effort-free posts such as yours. | |
Re: > for ( age = (START_AGE + 1); age <= STOP_AGE ; age++ ) //age + 1: counter starts at 0 > newPrin = newPrin + (newPrin * INT_RATE) ; If you want the rest of the code to be part of the for loop, then you need to use … | |
Re: Here is the new thread - [url]http://www.daniweb.com/techtalkforums/thread71992.html[/url] Suggest closing this before it attracts flies. | |
Re: > main() You may as well get used to saying [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376"]int main[/URL] Implicit declarations for anything are deprecated, meaning they simply won't work at some future date. > while (!feof(dataptr)) Read [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1046476070&id=1043284351"]this[/URL] [INLINECODE]while ( fgets( data, sizeof data, dataptr ) != NULL )[/INLINECODE] Is a good way of safely reading … | |
It's even smaller than an 80x25 terminal now! Just a mere postage stamp stuck in the bottom-left corner of the page, with acres of white space all around it. | |
Re: > i need some examples of combat systems. Read up on "[URL="http://en.wikipedia.org/wiki/Rogue_(computer_game)"]rogue[/URL]", the classic text mode game. You have weapons, which cause variable amounts of damage - knife, 1 to 5 - broad sword, 20 to 50 You have armour, which resists damage - leather, 1 to 5 - plate, … | |
Re: > says where "case 81" is that i already used it but I have not. 'Q' is 81 in ASCII, so yes, you used it twice. So if all your other magic numbers are really letters, then use letters. | |
Re: Doesn't anybody know how to search the web anymore? [url]http://en.wikipedia.org/wiki/Big_O_notation[/url] | |
Re: > Does the U in at the end of 1234U signify that it is unsigned? Yes. > The kind of number it is a uint64_t. Does this mean it is an usigned integer 64 bit? Probably, though perverse people could equally write [INLINECODE]typedef double uint64_t;[/INLINECODE] and the compiler might not … | |
Re: A few instant problems 1. Over reliance on global variables. 2. Your print routine starts at 'p', not first. Your p variable is the last node created. 3. scanf("%s",&tl); t1 doesn't point at any memory. At a push, the minimum would be these snippets [INLINECODE]char t1[10]; scanf("%s",t1); while( t1[0] != … | |
Re: I dunno, maybe actually try it for yourself rather than wandering from [URL="http://cboard.cprogramming.com/showthread.php?t=89006&highlight=days"]board to board[/URL] in the hope that someone will spoon-feed you the answer. | |
Re: [url]http://en.wikipedia.org/wiki/Floating_point[/url] The number of bits you dedicate to the exponent determine the range of floating point numbers you can support. The number of bits in the significand (I don't know what sigment could mean otherwise) determines the accuracy of any individual floating point number. The bias is an offset applied … | |
Re: Read this, then edit your post so we can read it. [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] Actually say what the problems are, this isn't a service where you can just dump your code and expect people to magically figure out what you want. In future, press "compile" every 10 lines or so to make … | |
Re: > #define FUNC(x) ((*func)(x)) Why? [INLINECODE]func(x)[/INLINECODE] works just as well, even when it is a function pointer. > gets(filename); No points for using [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1049157810&id=1043284351"]gets()[/URL] > buffer = (float*) malloc (sizeof(float)*lSize); There is no need to cast malloc in C either, if you've done things properly. [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1047673478&id=1043284351[/url] At best, it does … | |
Re: > how can i draw a box using graphics library , and what library should i use Well you need to start by saying which OS and compiler you're using. Though I'm going to guess it's Turbo C and XP or some other hopelessly mis-matched combination. | |
Re: And don't forget the code tags when posting code. http://www.daniweb.com/techtalkforums/announcement8-3.html | |
Re: > Wouldn't you use a public member function to access and modify private member variables? Yes everyone else would. But some people seem to like asking stupid questions like this which subvert the whole idea of using an OO language for data encapsulation. Like somehow knowing that if you could … | |
Re: > if (a(left) == b(left)) When did ( ) become the array subscript operator? | |
Re: > And why respond to a year-old thread? Because they can :rolleyes: > if(!*check[through]=={'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}) Gotta wonder what the hell that's supposed to achieve. | |
Re: Maybe they're compiling it with some 16-bit fossil compiler, then wondering why the program produces weird results past say 7! or 8! | |
Re: > I need to come up with a new method of region growing with better memory managment. Maybe lists? It would have to be a pretty sparse array to make this work well. You can't index a list the same way you can an array, so any more than a … | |
Re: > usingnamespace std; Whatever crappy code colouring tool you're using, stop using it and use the board code tags. Few people are going to be bothered to trawl through unindented code which isn't even compilable, and has been corrupted in transmission. [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] > help with encryption! asap Your urgency isn't … | |
Re: [url]http://www.daniweb.com/techtalkforums/post306665.html#post306665[/url] Lemme guess, you're real OS is actually Win2K, but you're clinging to some crappy old 16 bit compiler and pretending that you're using DOS. I guess the DOS emulation on your machine isn't up to supporting that particular network hackery code (yes, networking in 16-bit real mode was always … | |
Re: > because to me it looks like you pass the sum and cBit into the function Well one is a pointer, and the other is a reference. So they could both be used for input, input/output or output. The other two parameters are declared const, so that just makes them … | |
Re: > "term does not evaluate to a function taking two arguments" You have an int parameter called rand, which is hiding the function rand() by scope. | |
Re: [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] I'll go with your LUC array isn't big enough, or you don't set x to 0 before you start, or you don't reset x to 0 when you read the second file. | |
Re: [URL="http://www.catb.org/~esr/faqs/smart-questions.html#prune"]A pot of gold at the end of the rainbow[/URL] > i try to write this problem in c++ but didn't work can somebody please help me with this Well post it, then we can really start to help you rather than do the work for you (which isn't going … | |
Re: Since structure assignment is supported, just do [code] temp = Quote[j+1]; Quote[j+1] = Quote[j]; Quote[j] = temp; [/code] where temp is the same type as the struct used for your array. | |
Re: Even better if you're on Unix/Linux/Cygwin [code] $ split --help Usage: split [OPTION] [INPUT [PREFIX]] Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is `x'. With no INPUT, or when INPUT is -, read standard input. Mandatory arguments to long options … | |
Re: > but i was wondering if there is a faster way to do this Why do you need it to be faster? Seems like a case of [URL="http://www.petefreitag.com/item/509.cfm"]POD[/URL] If you need to do it a lot, then construct (with mktime) two time_t's which are 5am and 6am. Then do difftime() … | |
Re: 1. If your destructors are always calling delete, then every single constructor you have MUST initialise the pointers to at least 0. 2. Your copystate function just makes copies of the pointers (you now have two pointers pointing at the same memory). Bad things happen when you try and delete … | |
Re: > Have you considered simplifying your code by using a couple of structs? Have you considered the possibility that this thread is 2 YEARS old, and that the OP has probably moved on. | |
Re: The string returned by getline probably has a newline on the end of it (which won't be in any string you're comparing against). Or it's the classic mixing "cin >> var" with getline, and getline just returns with the newline which cin left behind. | |
Re: This should be in a bigger font, because people keep missing it. [B][url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] [/B] Work on your question titles as well [url]http://www.catb.org/~esr/faqs/smart-questions.html#bespecific[/url] | |
Re: [url]http://www.mono-project.com/FAQ:_General#What_does_the_name_.22Mono.22_mean.3F[/url] | |
Re: Show us that you deserve some help. [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] | |
Re: Except simply seeking to the end doesn't take into account any translations which may occur when the file is read byte by byte (even if you do read them all in one call). [url]http://c-faq.com/osdep/filesize.html[/url] | |
Re: [LIST=1] [*]Read the manual [*]Try some examples [*]Adapt to your own requirements. [/LIST] Or maybe it's one of those new controls which is only in .net, in which case you're sunk. You're not giving us much to work with, with that terse post. | |
Re: > And our instructors havent told us about the int main() yet I doubt they even know (or care). One wonders what other rubbish they're going to teach you based on their broken understanding of the language. > so i dont want to get in trouble by using it Or … | |
Re: > while (!feof(fp)) { > fgets(line,LINE_BUF,fp) Don't use feof() in a control loop [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1046476070&id=1043284351[/url] Do something like [INLINECODE]while ( fgets(line,LINE_BUF,fp) != NULL )[/INLINECODE] Perhaps he means remove the newline which fgets returns. Which would be [code] while ( fgets(line,LINE_BUF,fp) != NULL ) { char *p = strchr( line, '\n' ); … | |
Re: > Is VB the only way the program will open up in a windows like window? You have a choice - create a console application, or create a windows application (or several other types as well). Console (what you call DOS, but it isn't) begin with main() Windows GUI programs … | |
Re: > it starts producing negative numbers Yeah, somewhere between 40 and 50 IIRC, the size of F(n) becomes larger than what can be stored in a 32-bit integer and that's what you're seeing. One fix is to use a bignum package like [URL="http://www.swox.com/gmp/"]GMP[/URL] | |
Re: > apen = CreatePen(PS_SOLID, 1, colorG[7]); So delete/release/free/whatever the pen as well. |
The End.