5,237 Posted Topics
Re: All you need is a record of the total, and a record of the smallest. When you're done, subtract the smallest from the total, and calculate the average. No arrays necessary. | |
Re: Type [inlinecode]man libcurl[/inlinecode] at the command prompt. | |
Re: Maybe start with the program where each club sends the ball a fixed distance. Or maybe start with the program which only has one club. Break it down into manageable tasks, or simpler versions of the tasks, then refine the program as you go along. You don't have to write … | |
Re: [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] | |
Re: Well I think there are some redundant white space characters you can get rid of for total unreadability :rolleyes: For example, please reformat this [code] student *select(student *k) { int a; printf("\n enter chosen"); scanf("%d",&a); student *t=null; t=k; while(k!=null){ if((k->gpa)>a) printf("\n (%d %s %f ",k->id,k->name,k->gpa);} k=k->link; } [/code] To look … | |
Re: > How do you clean out the contents of an array after you take input? The problem goes away (or more precisely, never arises) if you use fgets() to read [b]all[/b] input, then use sscanf() / strcpy() / strxxx or whatever to extract information from the line returned by fgets(). … | |
Re: Hasn't anybody figured out the magic of code tags in this place? | |
Re: Post what you can achieve so far, so we don't explain stuff you know how to do already. | |
Re: > But when I give 1000 for a,b,c Do the math - 1000 * 1000 * 1000 * sizeof(double) Do you have 8GB of memory? > if(dp==NULL) Should be outside the first for loop, not inside. Also, what's with all the printf/scanf inside a C++ program? | |
Re: Well that seems to be OK in itself. Perhaps the problem is with the way you create the queue in the first place, and this is just where you notice that it doesn't work. Post some more code please. PS. Use the CODE tags when posting code. | |
Re: > Why does the following program work correctly There is a big difference between "produces expected output" and "works correctly". Your program is not correct, even though it seems to pass the "works for me" test. When run with some diagnostic software, I get [code] $ valgrind ./a.out ==20047== Memcheck, … | |
Re: There are essentially two steps to the problem, given void foo ( int num ); 1. do something with num % 2 2. call foo ( num / 2 ); Changing the order of those two steps changes what happens - feel free to experiment. Oh, and you also need … | |
Re: > { if (schedule[i] == true) > { strcpy(schedule[i], "Booked"); The strcpy() makes no sense - schedule is an array of bool, not a string. Does your compiler even warn you about this? Or do you just ignore all warnings and just try it anyway? | |
Re: Read this and edit your posts to include code tags [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] > i got 2 errors n 1 warning on here so far after i compiled it So post those as well. It's even better if you comment the code you post indicating which lines are causing you problems. | |
Re: > void displayCalendar(unsigned month, unsigned year, int* daysOfMonth[]) The simplest rule is to simply copy/paste the declaration of the array you want to pass, so it would be [inlinecode]void displayCalendar(unsigned month, unsigned year, int daysOfMonth[])[/inlinecode] Calling the function, you just use the array name, so instead of [inlinecode]displayCalendar(month, year, daysOfMonth[]);[/inlinecode] … | |
Re: You appear to have missed this on your way in [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] Better have a read of this on your way out. [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] | |
Re: It's certainly an excellent example of not following the rules [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] A lot of people just find other posts to read when presented with pages of unformatted code. | |
Re: > already searched the web, but no luck so far So, is this a homework exercise in seeing who has the best google skills, or some attempt to weed out the lazy wannabe's (aka you) from someone far more interested and capable in programming? If you're not even going to … | |
Re: A quick stab in the dark would suggest you seek out the project web site / documentation / mailing lists. | |
Re: Looks like some tutor's dusted off an old assignment. Recently bumped by a fellow student perhaps ? [url]http://www.daniweb.com/techtalkforums/thread7832.html[/url] | |
Re: No way anyone is going to wade through that unless you edit it to include code tags [url]http://www.daniweb.com/techtalkforums/announcement8-3.html[/url] > VERY VERY SUPER URGENT [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] | |
Re: Why don't you write some test programs for yourself to create trees with varying degrees of unbalance to test the function. | |
Re: fgets() to read a line of input. strtol() to validate, convert and check for numeric overflow. Both provide some success/fail indication in their status returns. | |
Re: Oh, you mean like cachegrind - [url]http://valgrind.org/info/tools.html[/url] | |
Re: > void main() main returns int. > while ( 0 == isOpen) Cute trick. Will you remember the == when you're comparing two variables? The problem is, the compiler doesn't see your sneaky way of changing the variable, so it just assumes that isOpen is constant since you don't change … | |
Re: > int sr = recv(acc, buffer, sizeof(buffer), 0); 1. recv doesn't store a \0 on the end to make it a proper string 2. You need to leave room to store the \0 yourself 3. You need to code for the possibility that recv() doesn't receive the whole message in … | |
Re: > urgently needed as submissions by next week... What makes you special? [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] Noting also that this was 9 months old before you said "me too". | |
Re: > strcpy(sendBuffer, temp.c_str()); If you're going to do this, why are you bothering with 'C' strings at all? | |
Re: Perhaps it's more to do with entering more than 80 characters rather than the number of words. How does getline for example know how many characters to input, and not overflow the buffer? According to my info, the 2nd parameter is a length, not a char to stop at. | |
Re: I'd suggest you look around say [url]http://www.avrfreaks.net/[/url] if you want to get into AVR programming. ARM processors are used in a number of mobile phones, I've no idea about that specific one though. | |
Re: > cin >> inp[40]; The next problem is you're inputting only a single char, but its off the end of your array. cin >> inp; Would input a single word into your array. > inp[k] = '\n'; This loop does nothing useful. > if (trade(word[i] == '\n')) This performs a … | |
Re: Assuming you mean via a network, then perhaps [url]http://beej.us/guide/bgnet/[/url] | |
Re: [url]http://cch.loria.fr/documentation/IEEE754/ACM/goldberg.pdf[/url] Read this and understand how all floats are approximations, which means no matter what you do, you invariably end up with ab.cd0000001 or ab.cc999999 type numbers as being the nearest representable value to ab.cd Using floats for storing money is a really bad idea. | |
Re: > cout << "Type 1 to exit or 0 to continue." << endl; > cin >> exit; Put these two lines inside your inner while loop, so you ask after each response. > while (!correct) Change to while (!correct && !exit) exit is also the name of a function in … | |
Re: > if ( filename == "day_01.txt") Use if ( strcmp( filename, "day_01.txt" ) == 0 ) |
The End.