6,741 Posted Topics
Re: >i was wondering whenever you create a file in c++ where does it go If you don't supply a full path when opening a file, a relative path is used. That depends on how your system deals with relative paths, but I'd wager that you're on a system that uses … | |
Re: No. Do your own homework. | |
Re: >a. change the locale of std::cin from the default locale to one using an ASCII char set. >b. read the char entered by the user >c. convert it to an int to get the ascii code point. >d. use the tolower member of the ctype facet of the locale imbued … | |
Re: >Any help would be greatly appreciated I have been banging >my head on the desk for the last 7 hours working on it. Remove the unnecessary code and work directly with the linked list. You're definitely not handling the links correctly, so I'm going to assume that you need a … | |
Re: >I dnt want to purchase a book as yet. Then you're already walking on thin ice. >Can any one refere me to a site from which I will be able to learn the basics relatively quick. Yes. There's only one site that offers basic C++ tutorials that I'll recommend (until … | |
Re: >I don't know much in depth about recursion, so have no idea how or what to pass there. It doesn't really matter that the function is recursive. Just pass the parameter along without changing it and everything will be fine: [code] #include<iostream> using namespace std; int Sum(int s, int n) … | |
Re: cin's >> operator and getline don't play well together. Formatted input treats whitespace differently than nonformatted input. More precisely, cin's >> operator leaves a newline character in the stream for getline to terminate immediately on, so it appears as if the call is being skipped. You can fix it by … | |
Re: You're overcomplicating things, I think. Here's a sample without the "again" crap that should give you an idea of what's expected when functions get involved: [code] #include <iostream> int findbig ( int num1, int num2 ) { return num1 > num2 ? num1 : num2; } void getnumbers ( int& … | |
Re: >So is that actually your program or did you copy it of someone. I'd wager that since he went from nothing (knowing nothing) to that in two hours, he copied it from somewhere. | |
Re: >Basically, I don't understand how a header file being included makes a connection >with the source file that has the definitions for whatever is in the header file. It doesn't. There's no connection at all. The header is there to declare names so that you can compile your source. If … | |
Re: >Where else can I get it? You might be able to find it somewhere with google, but I'm willing to bet that the dependencies will kick your ass. It's a much better idea to just bite the bullet and download the SDK. | |
Re: Look [url=http://www.dinkumware.com/manuals/?manual=compleat&page=string2.html#basic_string::replace]here[/url] and try to find an overload of replace that takes two arguments. | |
Re: >I need the helps, The helps? That sounds like some kind of communicable disease. >please send me the code as soon as you can Why don't you just give us your teacher's email address so that we can send the code directly. | |
Re: >anymore help also i have no idea what prototype is because we haven't learned it yet This is a function definition: [code] int change(float money, int onedollar, int twentyfivecent, int tencent, int fivecent, int penny) { float temp; // ... return 0; } [/code] Note that it has no semicolon … | |
Re: >can anybody help me ? If by "help" you mean "write it for me", no. Nobody will help you. If you mean help in the more traditional sense of you do the majority of the work and we give you hints and tips, and suggest ways to improve your solution, … | |
Re: Ugh, what an awful example. >void main() int main ( void ). No excuses, and the only portable return values are 0, EXIT_SUCCESS, and EXIT_FAILURE (defined in stdlib.h). Returning nothing isn't an option. >student var1,*a; While your C++ compiler might accept this, the C language requires that you include the … | |
Re: >If \0 is the same as 0 then why isn't \t the same as t or \n the same as n? AD wasn't being quite clear when he said "literally". '\0' isn't a special escape sequence like '\t' or '\n', it's a manual escape sequence where you define the integral … | |
Re: [quote] Relax Ancient Dragon. No sense in waving accusations like that around. Be cool. OK. Jeez. Nevermind, Mr. Dragon, i'll figure it out myself. I'll just remove the post since it offense everyone. [/quote] Translation: "Oops, I got busted trying to cheat." ;) | |
Re: What have you tried? The answer you're looking for is a classic example of a controversial solution, but it's not overly difficult if you know how loops and pointers work. | |
![]() | Re: >This program gets very easy with the use if recursive >function if the job is only to print the number in the reverse order. So, was it worth resurrecting a three year old thread to post some bad code? |
Re: >there was a error telling "namespace name required" Post your code. | |
Re: You're...um...not using a loop at all. You can't expect code to repeat if it doesn't loop somehow. | |
Re: >this is about my sjf project and srtf........................... What the hell are sjf and srtf? Speak plainly and properly. >so pls help me ryt now I'm afraid help is impossible as you haven't described any problem with the posted code. If you'd like a code review, I'll be happy to … | |
Re: >so the question is how can the compiler think that this is function This is how it would be parsed: [code] deque<int> c ( istream_iterator<int> cin, istream_iterator<int> ); [/code] That looks exactly lot like a function declaration, doesn't it? | |
Re: >is there any limit/constraint on the maximum number of nodes that a linked list can have? It depends on how you implement the list. >a linked list does not have to be implmented with a pointer. what else can be implementeation of linked lists? Anything that can specify the location … | |
I've noticed several times a couple of odd occurrences on the forums recently. 1) Sometimes I simply cannot mark a forum as read. I'll read all of the forums, explicitly mark the forum as read, and mark all forums as read, yet the forum will still show as having unread … | |
Re: Google came up with [url=http://www.newty.de/fpt/index.html]this[/url] as the first hit. Did you even attempt to search for information before asking here? | |
Re: Still too vague. Printing is system dependent, and sometimes hardware dependent. You can try opening a file to "LPT1", or "PRN", and pray that it works. Otherwise, tell us your OS and compiler so that we can give you more specific help. | |
Re: >-it just skips through cin.getline(File, 255) without waiting for the user's input Probably because you have a [INLINECODE]cin>> x;[/INLINECODE] somewhere earlier in your code and a newline is left in the stream for getline to terminate successfully on right away. Nothing is getting skipped, it's working as written. You just … | |
Re: >I think my biggest problem is not being able to see how to create this nested loop. Okay, you know you need to loop to fill up the array, right? [code] array [0..MAX] of integer num as integer while size < MAX do get num from stdin if eof ( … | |
Re: >It works good now, but i would like to know how it works. These two links should give you more information than you probably want right now. ;) [url]http://www.eternallyconfuzzled.com/tuts/algorithms/jsw_tut_rand.aspx[/url] [url]http://www.eternallyconfuzzled.com/arts/jsw_art_rand.aspx[/url] | |
![]() | Re: >Finally I have made my site valid XHTML 1.0 transitional and CSS! Now go for strict. That's what [url=http://validator.w3.org/check?uri=http%3A%2F%2Fwww.eternallyconfuzzled.com%2F]my page uses[/url]. >do you bother to make your sites valid markup? Yes, if only so that I can thumb my nose at lesser developers. :D |
Re: You definitely want to open the stream as binary. | |
Re: >I'm trying to develop my final year computer science project, >but don,t know were to start from....cannot think of any ideas. It's scary how often I see this situation. How could you [b]possibly[/b] have gone through x number of years toward a CS degree and have [i]no clue whatsoever[/i] what … | |
Re: >transform(names[count]begin(), names[count].end(),names[count].begin(), toupper); Good idea, unsound implementation. The problem is that toupper is overloaded and your compiler may create an ambiguity behind the scenes. On top of that, even if your compiler does the right thing and picks the C toupper, the behavior is [b]still[/b] undefined because transform expects a … | |
Re: >ifstream infile; You define infile, but then proceed to use indata. Perhaps you meant to define indata rather than infile? | |
Re: God, can't you stick to one forum? I hate splitting my answers between cprog and Daniweb. | |
Re: >but using cout or any object of ofstream also makes the data to be outputted You're mixing things up. Any object derived from ostream contains a buffer. It's this buffer that "makes the data to be outputted", and when it sends characters from the buffer to the destination (the destination … | |
Re: >can anyone do recursive binary search using a single argument Yep. ![]() | |
Re: Please search the forum instead of asking a question that's been asked before. | |
Re: >first i need to know if my implementation to the function is right Does it compile? Does it run? Does it produce the results you expect? Do you get the expected results for a large number of test cases? Those are the first questions you ask yourself to see if … | |
Re: [code] void printDate( enum Months, int day, int year ) { switch ( enum Months month = JAN ) [/code] I'm guessing what you really wanted here was: [code] void printDate( enum Months month, int day, int year ) { switch ( month ) [/code] Your random month isn't exactly … | |
Re: >you must read something before the loop test, then read >that element as the last action in your loop body, similar to: What a waste of effort. How about, instead of having to figure out the order of operations and throw in redundant code to make it work, you just … | |
Re: >all my code does is generate a seg fault whenever I try and add a new element. That makes perfect sense. Here's how you call elementCreate: [code] Element *new; /* new element */ if (!(new = elementCreate(new, data))) return(NULL); [/code] And here's the definition of elementCreate: [code] Element *elementCreate(Element *new, … | |
Re: >I've tried so hard to do it but I couldn't I don't believe you. Post your attempts and describe how they didn't work to prove that you've tried "so hard". >I have to send it to my professor tonight so please HELP We generally don't care how much of a … | |
Re: It would be more productive if you told us what errors you were getting rather than begging for free solutions to your homework. | |
Re: >So, how can I "destroy", not the raw storage, but the "arrayUnsignedChar"? Why are you trying to call the destructor for a built-in type anyway? | |
The End.