5,237 Posted Topics

Member Avatar for almared_6

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.

Member Avatar for Bench
0
140
Member Avatar for neeludhiman
Member Avatar for Salem
0
85
Member Avatar for toara

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 …

Member Avatar for Salem
0
98
Member Avatar for princess_lia
Member Avatar for Ancient Dragon
0
285
Member Avatar for frank1984

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 …

Member Avatar for Salem
0
152
Member Avatar for degamer106

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

Member Avatar for Salem
0
356
Member Avatar for chelo77
Member Avatar for chelo77
Member Avatar for Salem
0
104
Member Avatar for renzo666

Post what you can achieve so far, so we don't explain stuff you know how to do already.

Member Avatar for renzo666
0
104
Member Avatar for srishekh

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

Member Avatar for Ancient Dragon
0
2K
Member Avatar for debugger

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.

Member Avatar for debugger
0
84
Member Avatar for vicky_dev

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

Member Avatar for Salem
0
74
Member Avatar for Kellaw

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 …

Member Avatar for web_developer
0
854
Member Avatar for pete0

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

Member Avatar for dubeyprateek
0
99
Member Avatar for leedurr

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.

Member Avatar for Bench
0
234
Member Avatar for musicmancanora4

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

Member Avatar for Salem
0
157
Member Avatar for d_gabs123

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]

Member Avatar for Salem
0
58
Member Avatar for bofarull

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.

Member Avatar for bofarull
0
298
Member Avatar for shlinky

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

Member Avatar for shlinky
0
155
Member Avatar for neeludhiman

A quick stab in the dark would suggest you seek out the project web site / documentation / mailing lists.

Member Avatar for Salem
0
87
Member Avatar for avik1612

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]

Member Avatar for Salem
1
167
Member Avatar for fsloke

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]

Member Avatar for Salem
0
337
Member Avatar for btech

Why don't you write some test programs for yourself to create trees with varying degrees of unbalance to test the function.

Member Avatar for Salem
0
137
Member Avatar for MrBrilliant

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.

Member Avatar for MrBrilliant
0
246
Member Avatar for narsimha.ram
Member Avatar for Salem
0
105
Member Avatar for perlsu

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

Member Avatar for Salem
0
176
Member Avatar for ilikerps

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

Member Avatar for ilikerps
0
233
Member Avatar for Melissa111

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

Member Avatar for DMR
1
3K
Member Avatar for ilikerps

> strcpy(sendBuffer, temp.c_str()); If you're going to do this, why are you bothering with 'C' strings at all?

Member Avatar for ilikerps
0
158
Member Avatar for kharri5

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.

Member Avatar for kharri5
0
176
Member Avatar for letmec

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.

Member Avatar for Salem
0
120
Member Avatar for stupidenator

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

Member Avatar for stupidenator
0
122
Member Avatar for mogey
Member Avatar for Quan Chi2

Assuming you mean via a network, then perhaps [url]http://beej.us/guide/bgnet/[/url]

Member Avatar for Nedals
0
105
Member Avatar for shortLived

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

Member Avatar for Ancient Dragon
0
147
Member Avatar for moznmar

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

Member Avatar for moznmar
0
113
Member Avatar for Aldin

> if ( filename == "day_01.txt") Use if ( strcmp( filename, "day_01.txt" ) == 0 )

Member Avatar for masa
0
463

The End.