6,741 Posted Topics
Re: Let's start with the basics. A string in C is a sequence of zero or more characters followed by the '\0' character. By saying [inlinecode]char input1[/inlinecode], you're effectively restricting yourself to only one character, and because strings must be terminated with a null character, you're only allowing yourself empty strings. … | |
Re: >Please let me know what are the options to specify these includes in command line for various >projects (vc++,C#,vb,net) Is MSDN down, or something? I'd like to believe that you're smart enough to check the reference for your compiler before asking a question that will be answered with "RTFM!". :icon_rolleyes: | |
Re: Walk through the execution of your program on paper. You'll be able to see the contents of the variables at each step and you can build a table of your expectations. Then run the program in a debugger and verify that the actual execution matches your expectations. Most likely you'll … | |
Re: >I am making a string class If you want it to be as flexible as possible, you'd do something like the standard string class and use an [url=http://www.dinkumware.com/manuals/?manual=compleat&page=memory.html]allocator[/url]. The default for allocators are new and delete. However, you're free to use whatever you want since this is a class that's … | |
Re: >and its due tommorrow So? That's not going to get you help any faster. In fact, some of the more perverse members will delight in watching you rush to finish the homework that you put off until the last minute. >The question asked me to determine and explain how the … | |
Re: >still use float, it will work on almost any compiler! Almost any compiler, huh? And here I thought that because it's a standard type, [i]every[/i] C++ compiler is required to support it. :icon_rolleyes: >That does work It does? Presumably you want 60.5 to give you 1 hour and 30 minutes, … | |
Re: >main () The main function is defined as: [code] int main ( void ) { return 0; } [/code] Place your code before the return statement. Anything else is wrong. As it is, you're relying on an obsolescent feature (implicit int) and neglecting to return a value, which is undefined … | |
Re: >I mean, if it wasn't explicitly in the standard that 'the pointer will be unchanged on failure', >implementors of the cstdlib library could be free to implement the internal workings of the >function it in their own way True, but the behavior in this case is carefully specified by the … | |
Re: >And why a class might provide a "set" function and a "get" function for a data member? If you wisely give your data members only private access, then the only way to access them from outside of the function they're declared in is to use public or protected member functions. … | |
Re: >how do you tackle such tough situations? I take a break. Most of the time any severe difficulty I'm having stems from pushing myself too hard. If you take it slowly and work through problems in a methodical way, you shouldn't find yourself overwhelmed. If you try to force too … | |
Re: I'm seeing a disturbing trend. You get one question answered and then you treat us like your personal homework service. It's not going to work, so try doing it yourself first. | |
Re: >I just think it is funny that Dev(Bloodshed) finds it O.K., but VC2005 wont allow it? Your code is wrong, and one of the compilers you use happens to allow the wrong code while the other correctly bitches at you. That's typical behavior when you step out of the realm … | |
Re: >scanf( "d%", &a_guess); Format modifiers start with a % symbol. It should be "%d" instead of "d%". >test; Your test function takes two parameters, so you need to provide the arguments. Also, C doesn't allow the omission of parens even if a function takes no parameters: [code] test ( a_guess, … | |
Re: >How do you read values from a file you created Open it and read it? How is that not working for you? | |
Re: Is it that time of year again? :icon_rolleyes: | |
![]() | Re: >but I CANNOT get the grade nodes to correspond. How so? You didn't post any code, so we have no idea what you've tried. The grade list is just another linked list. There's nothing different just because it's a member of a node in another list. |
Re: We're not here to do your homework. Try it yourself first. | |
Re: >Anyone know what this is? The number of parameters don't match between the function declaration and definition for determinant. | |
Re: >By defualt compiler will assume that main return an int. Only prior to C99. In C99, omitting the return type is a syntax error. >Its ok because string literals are in the heap and not the stack. The who and the what? It's easy to write an implementation that places … | |
Re: >does it matter that the root is not the smallest value? If you designed it to be then yes, because that's a bug in your implementation. But as you describe the problem, your book is showing a min heap and the wiki article is showing a max heap. Both are … | |
Re: >My int Main is basically all messed up because based on the examples in my text book it >appears that I should have my cout statements in main, but they are also in the function on some examples. Your main is basically messed up because it's a declaration and not … | |
Re: >If any mod reads it and is in the mood to change my code adding the & I would be very grateful. It's generally better to leave the code as you originally posted it so that any replies remain relevant. If you have a new version of the code, create … | |
Re: When you want help with your code after making changes, it's customary to post the latest version. Otherwise it's extremely difficult to help you effectively. ![]() | |
Re: >a constructor to set the month using the first three letters in the name of >the month as three arguments That's weird. >a constructor to set the month using an integer as an argument, a default constuctor You can merge these guys with a default argument: [code] Month ( int … | |
Re: >int ndatamax=100; >string line[ndatamax] C++ requires array sizes to be constant. >while(!myfile.eof()) *sigh* It seems we have to tell [b]everyone[/b] that this is the wrong way to use the eof member function. The eofbit is only set [i]after[/i] an attempt has been made to read from the stream and failed. … | |
Re: >would you like to look at the code? This just slows down the process. Post your code, tell us what errors you're getting, and someone will get to it. "Will you look at the code?", "Can anyone help?", etc.. will invariably be answered with "Yes! Ask already!", so why not … | |
Re: >I get undefined refrecence errors relating to 'main' and the log and sqrt functions. I'm not >sure why I'm getting these. I am using gcc in Linux. I'll make an educated guess and say that you didn't link with the math library: [code] $ gcc main.c -lm $ ./a.out [/code] ![]() | |
Re: >can someone please help?! Two very qualified people have already given you good advice. Are you ignoring their suggestions and hoping that someone does all of the work for you? If not, explain what you've done to troubleshoot and how it didn't work. | |
Re: >You could also use #pragma once but it is compiler dependent and deprecated. All pragmas (well, most with the coming of C99) are compiler dependent. You should avoid them whenever possible. And if #pragma once is compiler dependent, how can you say that it's deprecated? Have all compilers documented it … ![]() | |
Re: >By default, the standard input in c is in the canonical mode, which means that all input is >line buffered and the line would be received only after the linefeed. That's not how buffering in C works. You're confused about the connection between a command shell and a C program. … | |
Re: >Now I hear that that is wrong and you have to do it the other way. This is a style issue. If your employer requires it, then their word is law. Otherwise, tell the person who said it was wrong it stuff it and do what you find most comfortable. … | |
Re: >tell me what i need to do to better it Be careful what you wish for. Your actual problem is that you aren't making a histogram out of a frequency table. A frequency table is the count of occurrences, which is not what you're doing here: [code] array[ val / … | |
Re: >That must be a compiler thingy because VC++ 2005 Express doesn't mind it wihout the space. I believe Bjarne Stroustrup called this sort of thing a glorious hack. C++0x will require that the space isn't necessary anymore, but compilers have already started to adopt the new feature as an extension. … | |
Re: Your vector doesn't have any elements to assign to. You need to set the initial capacity, or insert new elements with push_back: [code] #include <iostream> #include <string> #include <vector> using namespace std; int main() { vector<vector<string> > edge_set_test ( 1, vector<string> ( 2 ) ); edge_set_test[0][0] = "1"; edge_set_test[0][1] = … | |
Re: >URGENT PLEASE CORRECT FOR ME! THANKS A LOT!!!! You'll get better results if you describe the problems that you're having. | |
Re: >Provided I cannot make define the object globally or at the start of main(). You have to define a variable before it's used, and you have to define a variable within a visible scope. What you're doing is illegal because g1 is defined in a nested scope but used beyond … | |
Re: >What I really looking for is a tutorial regarding the linked list, stack and >queues with a good explanaitions. I haven't yet gotten around to covering stacks and queues, but [url=http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx]this[/url] may be useful to you. >Have you tried Cprogramming.com Yes, I have. The FAQ is good, the forums are … | |
Re: [url]http://winapi.foosyerdoos.org.uk/[/url] | |
Re: >Well.. I wouldn't know how to do the rest then.... Well, let's start over. What [b]do[/b] you know? We're not mindreaders, so there's no way to tell how much hand holding you need or expect. >how do I get the program to sort the scores Oddly enough, C++ has a … | |
Re: It looks like your logic is reversed a bit. You want to sum both the odds and evens, but in your current logic, it's either one or the other depending on the initial number. Since the range of odd numbers is wider than even numbers, you can include the test … | |
Re: nightwishmaster hasn't annoyed me yet. :) | |
Re: >I can't figure out how to make it word wrap. What's "it"? This question is incredibly vague, and you're unlikely to get a decent answer from it. >the window comes up for a split second, then just disappears Please ignore the majority of what everyone else has told you in … | |
Re: >How much do most people donate on avg? I donate my time and expertise, so at my usual consultancy rate and a guestimate of about 15 minutes per post, I've donated about $53,000. Add to that the PITA fee of 15% the regular rate and it goes to an even … | |
Re: >I don't see that path in the parings. I beat rash and go to the final, and rash beats everyone in the loser's bracket. Or the opposite: rash beats me and goes to the final, and I beat everyone in the loser's bracket. Either way we meet in the last … | |
Re: >thanx in advance. For what? You didn't ask a question. You totally overused periods, but I don't see a question mark anywhere in your post. |
The End.