15,300 Posted Topics

Member Avatar for marzuki

use a linked list of structures. Read a value from the file, search the list to see if its already in the list. If found just increment the count. Otherwise if not found then add a new node and initialize the count to 1. Note: for [b]value[/b] in the below …

Member Avatar for Ancient Dragon
0
85
Member Avatar for johny112

What? there is nothing to correct because the function [b]even[/b] already returns true or false, unless you just want to rewrite it like this: [code] bool even(int x1) { return (x1%2 == 0) ? true : false; } [/code]

Member Avatar for johny112
0
223
Member Avatar for matt nagel

line 12: should be this: [icode]while(p)[/icode] Your program gets segment violation when strtok() returns NULL. >>I realize its probably overkill for my purpose so if anyone could point me to a simpler solution that would be appreciated too. In C language that's about the best anyone can do.

Member Avatar for Duoas
0
7K
Member Avatar for picklesandmayo

how about a linked list ? or something like this: [code] void foo(int x) { int n = 0; cout << "Enter a number " << x << ":\n"; cin >> n; if(x < maxNum) // maxNum declared elsewhere foo(x+1); cout << "n = " << n << "\n"); } …

Member Avatar for Salem
0
191
Member Avatar for Ancient Dragon

Smiles list in the advanced edit window often does not work -- it does nothing. Sometimes when it does work the list is generated below the edit window (see thum) and I have to scroll down to see them all . I've noticed this behavior in only the last few …

Member Avatar for MidiMagic
0
263
Member Avatar for dsuh06

The first line initializes the values of the array. The second line is a syntax error. It should be [icode]int* ptr = &array[0];[/icode] The last line sets the value of te first array element to -1.

Member Avatar for Ancient Dragon
0
116
Member Avatar for d0ugg
Member Avatar for camberos

If you are taking an assembly class why are you wrinting C program? How write to the screen that depends on the operating system you are using because each one is different. For MS-DOS, [URL="http://spike.scu.edu.au/~barry/interrupts.html#ah2c"]start here[/URL]

Member Avatar for camberos
0
95
Member Avatar for MardukLitzer

see the answer [URL="http://www.programmingforums.org/thread14600.html"]here[/URL]

Member Avatar for Ancient Dragon
0
115
Member Avatar for superbob

If you want [b]findMax() to change the value of ptr in main() then you have to pass the parameter by reference and not by value. [code] void findMax(int arr[], int n, int** pToMax) { ... *pToMax = &arr[0]; } int main() { ... findMax(nums, 4, &ptr); } [/code] Or since …

Member Avatar for Ancient Dragon
0
82
Member Avatar for DREAMER546

Your code formatting is absolutely horrible! Completly unreadable. And that is probably why you don't understand the error. Reformat it, indent it properly, and you will probably see the problem. And don't be afraid to put { and } on their own separatelins, unlike the horrible code in line 122.

Member Avatar for DREAMER546
0
82
Member Avatar for johnnyjohn20

This is one way to do it. [code] int main () { float f = 123.457678F; int a = (int)f; float b = f - (int)f; if(b > 0.5F) a++; cout << a; return 0; } [/code]

Member Avatar for WaltP
0
970
Member Avatar for Nemes

on MS-Windows fopen() returns NULL on error, which it should do on all other operating systems.

Member Avatar for Ancient Dragon
0
482
Member Avatar for tootypegs

Of course nothing happens because there you did not post any executable code. All you have is a structure and a function prototype. also try reading some of [URL="http://www.google.com/search?hl=en&q=how+to+create+icon+in+system+tray"]these google links[/URL]

Member Avatar for Ancient Dragon
0
98
Member Avatar for johny112
Member Avatar for Ancient Dragon
0
87
Member Avatar for java.cream

>>that means tells the operating system a program finish? No. There is other code that you did not write that does that. main() returns not to the os but to the start-up code that called main(). What that startup code does is not specified by standards and is therefore different …

Member Avatar for Ancient Dragon
0
108
Member Avatar for nicz888

Line 17 should be moved to the first line of main() because srand() should be called only once throughout the lifetime of the program. lines 17-21: If you want to keep asking the questions then why didn't you use a [b]while[/b] loop here ? The [b]if[/b] will execute it only …

Member Avatar for Ancient Dragon
0
130
Member Avatar for The Dude

Your score is 10 on a scale of 1 to 10. You are a True Believer in President Bush. Your loyalty and devotion to him is matched only by your desire to see his liberal detractors locked away and declared enemy combatants. Given the chance, you'd gladly vote Bush a …

Member Avatar for sneekula
2
419
Member Avatar for The Dude

The problem is that we don't know if that great nothingness still exists. If it took one billion years for us to see the void then it will take at least another billion years to find out if it was ever filled with anything. Maybe right now that void is …

Member Avatar for sneekula
0
79
Member Avatar for The Dude

[QUOTE=twomers;433109]>> I >> Who are you saying is right? Jail over bad food ... I think there's no question about that who's in the wrong there. I misread and thought the worker was still in prison.[/QUOTE] Yes, if it is known that an employee deliberately and malitiously put poison in …

Member Avatar for sneekula
0
115
Member Avatar for The Dude
Member Avatar for DREAMER546

You are confusing a vector of ints with a vector of student_record classes. [b]ex[/b] is an array (or vector) of integers, not student_record classes. And that's why your compiler is complaining about lines 32 and 33. [edit]^^^^ what Duoas said more detailed than what I said[/edit]

Member Avatar for DREAMER546
0
102
Member Avatar for The Dude
Member Avatar for picklesandmayo

correct the compiler errors and warnings. Below are the ones I get. I realize you might not be using the same compiler but you should have gotten similar errors. error C3861: 'counter': identifier not found error C3861: 'incorrect': identifier not found error C3861: 'correct': identifier not found

Member Avatar for vmanes
0
96
Member Avatar for anshul.dilli

can't help you, sorry. You are using too ancient a compiler, non-standard header files and obsolete stream header files. Delete dos.h and conio.h, then replace <iostream.h> with <iostream> and replace <fstream.h> with <fstream> then maybe, just maybe people might be able to help.

Member Avatar for anshul.dilli
0
112
Member Avatar for picklesandmayo

I don't see anything that would cause the problem you report, but I do see problems with that [b]square()[/b] function. In main() if you first select 'S', the value of the three variables are all 0. I don't know what [b]minMax[/b] does, but assume it finds the minimum and maximum …

Member Avatar for picklesandmayo
0
102
Member Avatar for adikesan

see [URL="http://www.google.com/search?hl=en&q=linked+list+in+c&btnG=Google+Search"]these google links[/URL]

Member Avatar for rajusankar28
0
124
Member Avatar for The Dude
Member Avatar for java.cream

I can understand your confusion. >>Loops and other non-sequential code are still involved, but occur in the operating system rather than the program that you write Wrong. I think that paragraph is attempting, though somewhat poorly, to describe the difference between [b]procedural[/b] and [b]event-driven[/b] programs. A [b]procedural[/b] program is executed …

Member Avatar for java.cream
0
102
Member Avatar for enuff4life

The second parameter to OpenData() should be char* not simply charf [icode]void OpenData(int ** arrayPtr, [color=red]const[/color] char[color=red]*[/color] file, int *arraySizePtr )[/icode] Didn't your compiler give you a bunch of errors because of that? There are several other syntax erorrs too, and in some cases you need to add typecasts.

Member Avatar for enuff4life
1
181
Member Avatar for enuff4life
Member Avatar for Ancient Dragon
0
120
Member Avatar for dev.cplusplus

>>I receive assignments like fix BUGS or write small functions in the projects. Yup, that's the life of a programmer for the first 20 or so years. Much of the time is spent in program maintenance.

Member Avatar for Ancient Dragon
0
101
Member Avatar for zandiago

They still are at the top when I look at them using IE7 on Vista.

Member Avatar for zandiago
0
38
Member Avatar for Sturm

[QUOTE=bobbyraw;471683]. if they bypass which they will, once they post in the forum a moderator should get a pm and contat .[/QUOTE] I hate that idea! I don't want my PM inbox flooded with all those messages.

Member Avatar for MidiMagic
0
497
Member Avatar for enes

The only way you could possibly access it is if the variable is global and non-static. In that case you could declare it with the [b]extern[/b] keyword in your program. If your program links then you should be ok. If it doesn't link, then tough luck, you will not be …

Member Avatar for WaltP
0
105
Member Avatar for fudawala

>>I need some help writing this program Which part are you confused about? We are not going to write the program for you. So you might as well do what you can, post your program, and ask specific questions. The instructions seem to be pretty clear to me.

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

[QUOTE=eren;477247]i did only part of prime number but i haven't got any idea about the other parts you can say only how can i do other parts.. or you can't say.. it's your choice ;)[/QUOTE] You're missing the point -- we are not mind readers so we have no idea …

Member Avatar for Ancient Dragon
0
136
Member Avatar for boyz

[QUOTE=Jishnu;477818]boyz is banned. I thought this thread would be closed.[/QUOTE] We don't close threads just because the thread starter gets banned.

Member Avatar for Ancient Dragon
0
269
Member Avatar for hellokitty88
Member Avatar for cursedbyfreud

[b]Flights[/b] is a three-dimensional array because it has three stars. If what you really want is a 2d array then remove one of the asterisks in its declaration.

Member Avatar for cursedbyfreud
0
169
Member Avatar for juoyaf

Line 53: T is uninitialized so its value is any old random value, including 0. You need to initialize it to some known value on line 51. Using a while statement to read integers here is not a good idea because the >> operator does not stop at end-of-line. Better …

Member Avatar for juoyaf
0
87
Member Avatar for BigBen747

[QUOTE=BigBen747;476753]I just want some help.[/QUOTE] Learn to crawl before you can walk. You have to learn the language before you can even think about undertaking such as huge project. The people who wrote those program have years and years of experience. You will only fail miserably if you try to …

Member Avatar for WaltP
0
180
Member Avatar for spaceintheworld

you need to validate the value of [b]arr_siz[/b] entered on line 26. What happens to your program if I enter 1000 on that line? Or if I enter a negative value ? Your program will die a very quick and ugly death. >>it must work as well on Maximum also …

Member Avatar for spaceintheworld
0
94
Member Avatar for IRSSRI

>>How would I go about completing this task? Did you try to compile the program? If you did, what errors did the compiler produce? If you did not compile it, why not? Hint: lines 7, 13 and 14 are wrong.

Member Avatar for Jishnu
0
109
Member Avatar for Sturm

Jishnu: Instead of hijacking this thread you should have used the [b]Flag Bad Post[/b] button.

Member Avatar for Jishnu
1
86
Member Avatar for joshua.tilson

line 27: what is that [b]length[/b] function you are calling? In your program [b]number[/b] is the length of the array so there is no need to call another function just to get that. You don't need [b]total_facts[/b] at all, just replace it with [b]number[/b] on line 28. There really is …

Member Avatar for ioncrew
0
239
Member Avatar for boyz

moved to c++ board. >>please tell me how to become a member of this tag??? Huh? Have no idea what you want.

Member Avatar for vijayan121
0
105
Member Avatar for boyz
Member Avatar for boyz
Member Avatar for joufaf

I think I would use a [b]vector[/b] of structures. You need two structures [code] struct numbers { int saleNumber; float amount; }; struct person { int ID; string lastName; string firstName; vector<numbers> numberList; }; [/code] Now just make a [b]vector[/b] of the above person structor, e.g. [icode]vector<person> personList[/icode]

Member Avatar for joufaf
0
204

The End.