6,741 Posted Topics
Re: I think this thread has gone far enough. Since we're getting into the realm of remedial hacking advice, I'm going to call an end to it. | |
Re: That might alleviate the confusion about how to post a tutorial for review. | |
Re: Assuming by "empty" you mean if you try to read any characters, the input will fail immediately at end-of-file, then testing for an empty file is trivial: [code] #include <fstream> #include <iostream> int main() { const char *filename = "test.txt"; std::ifstream in ( filename ); if ( !in ) std::cerr<< … | |
Re: I'm not entirely sure I see the point of these graphs aside from the initial novelty. Keep in mind that there needs to be some sort of justification for a new feature because there's a cost to both the implementation and maintenance going forward. Since I'm reasonably sure Dani has … | |
Re: Define your own constructor for Form2 that accepts this information and sets control values accordingly. For example: [code] Form2^ frm = gcnew Form2("Hydrogen"); frm->ShowDialog(); [/code] | |
Re: [QUOTE]i just want to extract the last bit of the given variable.[/QUOTE] Which bit do you think is the "last bit"? The term is ambiguous as it could be interpreted as either the most significant bit or the least significant bit. [QUOTE]note:dont extract the bits by dividing it by 2[/QUOTE] … | |
Re: That's like asking what the possible uses of arithmetic are and applications for everyday life. Can you narrow down your question just a little? | |
Re: [QUOTE]my question is are both of these lines equivalent? or is one wrong and one right? int (*pFcn)(int, int) = Add; int (*pFcn)(int, int) = &Add;[/QUOTE] They're both correct and functionally identical. The reason why is because you can only do two things with a function: call it and take … | |
Re: Ideally you would use the std::vector class instead of trying to manage dynamic memory and pointers. | |
Re: You're checking every character in the array, not every character in the string. The latter is likely to be much shorter, which means you'll be looking at a lot of indeterminate characters. However, since you're already taking the length of the string, just change this: [QUOTE][CODE] for (int i = … | |
Re: There's not really a comment feature for posts. You really have only two options at present: [list=1] [*]Give the post positive or negative rep with the up or down arrows, respectively. This gives you the option to include a reputation comment. [*]Reply to the thread with a quote. The easiest … | |
Re: Welcome aboard. We can always use folks with C and C++ experience, those are two of the more active forums on Daniweb. | |
Re: You're SOL, sorry. The Mono project supports .NET to a certain extent, but only via C# last I checked. | |
Re: [url]http://en.wikipedia.org/wiki/Function_(computer_science)[/url] | |
Re: >Well, given the number of new threads posted daily, >most don't seem to have any difficulty figuring it out. The site design has changed significantly at least once since this thread was started in 2005. | |
Re: [QUOTE=peter_budo;1667363]@Netcode if you do not have anything constructive to discussion then please do not comment[/QUOTE] A reasoned argument against your suggestion [i]is[/i] constructive. Professionals are more likely to browse github et al. because there's a better chance of finding something. Daniweb doesn't have a lot of tutorials, which puts it … | |
Re: [B]>Might the sir be needing anything else? [/B] For future reference, please be aware that email addresses in posts are against the rules and extremely likely to be removed by the moderators. If you quote the email address, that doubles the work required to clean up the mess because the … | |
Re: Your code is awful and I'm not terribly interested in making it better. Please read [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_bst1.aspx"]this tutorial[/URL] and try to match your algorithms to the sample code. | |
Re: Haha! That's far more entertaining than I thought it would be. It's a refreshing break from the usual Java applet visualizations. | |
Re: [QUOTE]Nobody Click on these links.[/QUOTE] The broken links were broken but have been fixed. The correct links are safe. | |
Re: Without knowing the format, all I can suggest is breaking the string down into tokens where each token represents a word, a space, or a special character. Once you have a list of those tokens, you can parse them more easily according to the format's rules: [code] #include <ctype.h> #include … | |
Re: [QUOTE]So is this the thing that C can do that C++ can't?[/QUOTE] Um, no? C still allows the [ICODE]auto[/ICODE] keyword as a storage class specifier, but as Mike said, it's useless to anyone but a compiler writer. As far as C doing something that C++ can't, I'd say C++'s new … | |
Re: [QUOTE]Can you suggest a better code for this?[/QUOTE] Yes, but given past history, I suspect you'll continue to use your current awful code style even if somebody shows you a much better alternative. Thus, I'm inclined to think that suggesting better code for you would be a waste of time. | |
Re: [url]http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm[/url] [url]http://floating-point-gui.de/[/url] | |
Re: Use the disk you originally installed from. If you don't have it, upgrade to one of the Express versions (they're free). | |
Re: We're not here to fix all of your problems. Learn to debug your own code. If you have a specific problem, ask a specific question. | |
Re: Convert the character to lower case before using it as an index: [code] num[tolower(userstring[c]) - 'a']++; [/code] Note that you'll need to include <ctype.h> for tolower(). | |
Re: You don't need to avoid using scanf() to read a character, though it [i]is[/i] a relatively heavy function compared to getchar(). | |
Re: [QUOTE=daianahoney;1664740]Hello. I am wondering how to split a string lets say char *a="raining apples training away" using a delimiter like "g a" and the result will be: rainin pples trainin way I tried using strstr but I got stuck. Any hints will be greatly appreciated. Thank you in advance![/QUOTE] Assuming … | |
Re: The first thing your inner loop does is read from the file into [ICODE]Positive_Integers[/ICODE]. However, the first number was already read to determine if it was a sentinel in the outer loop. So you're basically discarding the first number. The next number should be read [i]after[/i] the current number is … | |
Re: [QUOTE]what does it all mean for C/C++?[/QUOTE] Nothing at all. C++ will continue chugging along in the areas that it's best suited. People will continue to claim that C++ is dead or dying, and they'll continue to be wrong for the foreseeable future. People will still come up with reasons … | |
Re: [QUOTE]what fflush(stdin)means??[/QUOTE] It means whatever the implementation chooses it to mean. The C standard says that calling fflush() with an input stream is undefined. However, many implementations choose to make it read and discard unread input from the stream in a manner similar to this explicit loop: [code] while (getchar() … | |
Re: Matlab likely guarantees a higher precision than C, and what you're seeing is the round-off errors creeping into the C algorithm. | |
Re: For future questions, please copy and paste the error in its entirety instead of paraphrasing. This is what the error actually says, which is different from your interpretation: [code] error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [/code] Going to the line that's specified, … | |
Re: In the project properties you can choose to compile as C or C++. | |
Re: scanf() will only accept a valid integer using that code, and return a value other than 1 if the input string isn't a valid integer. It's your job to check the return value for success and handle errors: [code] #include <ctype.h> #include <stdio.h> void clear_stream(FILE *in) { int ch; clearerr(in); … | |
Re: Presumably the brace mismatch at the end of out_stack_push() isn't a typo. You need one more closing brace before starting out_stack_pop(). | |
Re: The expression is undefined and can have any result, please stop trying to analyze it. | |
Re: [QUOTE]No I'm not trying to do anything malicious or harmful to his computer. I'm just looking to have fun.[/QUOTE] Fake viruses tend not to go over well as pranks. I've heard stories of students suspended or expelled for benign but seemingly malicious software. My suggestion would be to take a … | |
Re: Two hours, eh? Just out of curiosity, how long have you been working on this assignment? | |
Re: [B]>void FACTORIAL(int factorial=1, int N)[/B] Defaulted parameters must follow non-defaulted parameters. Though in this case I don't see any need for the first parameter. On a stylistic note, names in all caps are typically reserved for macros. Your function name would likely cause some raised eyebrows. [B]>for(y==1; y<=N; y++)[/B] == … | |
Re: [QUOTE][CODE] j=n-1; while(j>=1) { item=del(tree,j,item); tree[j+1]=item; } [/CODE][/QUOTE] Where do you update [ICODE]j[/ICODE] inside of this loop? | |
Re: [URL="http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_rand.aspx"]Clicky[/URL]. | |
Re: Perhaps you should simply study the material and take assignments as they come. Professors don't generally give assignments that are far removed from previously taught material. | |
Re: Technically those aren't prototypes, they're old style declarations. To be proper prototypes you need to specify the parameter list (void if there are no parameters): [code] void addatbeg(void); void delete(void); void display(void); [/code] My educated guess is that's your problem. What compiler are you using? | |
Re: If that's the full code then you're missing definitions for all of the member functions. | |
Re: [QUOTE]Bump...............?[/QUOTE] Please don't bump your threads, it's inconsiderate to all of the other people who need help. [QUOTE]I can't figure out how to iterate through the LinkedList and delete all students whose birthYear is greater than 1995[/QUOTE] I fail to see the problem. Your main() function has code to iterate … |
The End.