6,741 Posted Topics
Re: You're using a Win32 application project when you want a console application project. Win32 applications expect WinMain instead of main. | |
Re: Is there any reason you resurrected a seven month old thread to post ugly code? Be careful with your answer because it will dictate whether or not I close this thread (and my finger is on the big red button as it is). | |
Re: >fin >> isFirst; I think you mean: [code] fin>> val; [/code] isFirst doesn't strike me as a data variable, it seems more like a status variable. You don't even need it. Oddly enough, I didn't bother looking at Dave's code, but my solution is only slightly different (but it avoids … | |
Re: Don't forget that a stringstream is still a stream. This should work for you: [code] #include <iostream> #include <sstream> #include <string> int main() { std::stringstream s ( "This is a test" ); std::string token; while ( s>> token ) std::cout<< token <<'\n'; // Clear the stream state s.clear(); // Rewind … | |
Re: Use [url=http://www.daniweb.com/techtalkforums/misc.php?do=bbcode#imgcode]code tags[/url] for any future code. I've added them for you this time, but next time I may just feel the need to delete your post if you fail to do it properly. >After the ID and name are poped from the stack, I need the program to >automatically … | |
Re: You surround the formatted code with [url=http://www.daniweb.com/techtalkforums/misc.php?do=bbcode#imgcode]code tags[/url]. | |
Re: >[edit]Moments after posting, I couldn't shake the feeling that someone >saw this and was planning to post a binary-tree version of the lookup. >::wierd:: That is wierd. Maybe you have binary search trees on the brain. I'm big into trees, but I would probably do it like this: [code] template … | |
Re: >Do I just remove the semi-colon? Are you incapable of experimenting? It seems sort of silly that you're trying to be a programmer yet you can't even make such a simple decision as removing a single semicolon without running to us for permission. Here's a piece of advice. Rember it … | |
Re: >couldnt you just reverse them without it? or is it needed? It looks like width is strictly for pretty formatting. Rather than assume the largest possible number of digits and suffer extra leading spaces, width is used to ensure that only a single space precedes the reversed number regardless of … | |
Re: It means you're using the wrong project type. You created a Win32 application (which requires WinMain instead of main) and then treated it as if it were a console application (by using main instead of WinMain). | |
Re: >Here is a short version of my code that repeats the same error I just get a bunch of syntax errors. How about posting something complete that we can cut/paste and compile? By the way, your code as it is is filled with problems. | |
Re: I suggest you actually [b]read[/b] your C++ book before trying to write a program of any complexity. You have mistakes that should not be made by someone who has paid attention in class. | |
Re: I only looked at the line you mentioned, but it sure is a doozy: [code] for ( int i= 0; int i > 100; i++); [/code] Remove int from the condition, you want the loop to iterate 100 times I assume, so it should be i < 100, and a … | |
Re: >What is vtable ? A fancy term for an array of function pointers. >How many vtables created for this sample. Maybe none. The virtual mechanism doesn't [b]have[/b] to be implemented using the vtable concept. However, if it did, the answer would probably be one, but it's implementation-defined. | |
Re: >length() was left in the string class for backwards compatibility with something The string class existed in C++ before the STL was adopted, so length() was kept for backward compatibility with existing code and size() added in a poor attempt to make string more like a standard container. >Also, size … | |
Re: >hi here is the solution for your problem. Wonderful, yet another helpful bozo who's willing to teach beginners to be ignorant and rely on others to do their work for them. >run the above code and get the disired result Maybe, but then again, maybe not. Your entire program is … | |
Re: >is there a way to input a new usewr while the program is running? Yes, of course. Just maintain a list of valid users, and when adding a new user, append to the list. Unfortunately, without further detail about how you're going about things, I can't be more specific. | |
Re: You're not likely to get an answer to a question in the Community Introductions forum. Might I suggest the [url=http://www.daniweb.com/techtalkforums/forum107.html]Hardware->Peripherals[/url] forum? Before posting, it's a good idea to find the most relevant forum for your post. | |
Re: Unless Dani has changed it, you need 10 posts before the full feature set of membership is available. | |
Re: >Am I correct that the way "char* &p" is written, that this is because the parameters of sort2 are array's of pointers No, they're references to pointers to char. The reference syntax is required to allow the function to rebind p and q and have the changes reflected back in … | |
Re: >i am needed to represent an array using pointers only That suggests that you're required to use pointer arithmetic and dereferencing rather than subscripting. But, because the requirements clearly say "array", and not "dynamic array", or "simulated array" (granted, most teachers aren't intelligent enough to make the distinction), I would … | |
Re: Use code tags. I've added them for you this time, but next time I won't be so nice about it. >but the book's name, author, and isbn are all garbage That's no surprise. You're initializing the string data of the new node with the addresses of local arrays. When the … | |
Re: Today 06:41 PM gmrod Today 06:43 PM gmrod Today 06:48 PM gmrod Today 06:56 PM gmrod Today 07:08 PM gmrod Today 07:10 PM gmrod Much ado about nothing, I see. For future reference, you can edit your posts. It's generally a better practice than flooding the thread with pointless additions. | |
Re: >for (col; col < size; col++) { You're half way there. Now, actually assign 0 to col instead of just evaluating whatever indeterminate value is already there. | |
Re: >What's wrong???? You created a new thread when you have an existing thread with [B]THE SAME QUESTION![/B] That's what's wrong. And this thread is locked; please direct further replies to the original thread. Thank you. | |
Re: Locked how? You can set it to be read-only and hidden using SetFileAttributes. That's a quick and easy way to prevent simple viewing of and writing to the directory: [code] #include <stdio.h> #include <stdlib.h> #include <windows.h> void werror ( void ) { char msg[BUFSIZ]; DWORD err = GetLastError(); FormatMessage ( … | |
Re: It's trying to tell you to replace your old ass compiler with something that conforms to the C++ standard. Let me guess, your operating system is Windows XP, right? >unable to open file "c0s.obj" Go to Options, Directories and make sure that you see something like this sitting around there: … | |
Re: >could somebody please simplify it for me? No, but we [b]can[/b] help you to understand it better if you'll do more than offer vague references to general techniques. | |
Re: A brief search of google gave me [url=http://www.libpng.org/pub/png/pngaptk.html]this[/url]. Alternatively, though nobody wants to do this because it requires "work", is download the PNG specification from [url]www.wotsit.org[/url] and program your own handling routines. | |
Re: When you name your files, you can choose to use a .c extension. Or you can go to the Project->Properties dialog, select C/C++, then Advanced, and next to Compile As, select Compile as C Code to ensure that you're actually compiling as C. | |
Re: >They really form the basis of all the rest of visual studio etc.. Wait, how does Borland software form the basis of Microsoft software? Are you making some silly connection that the rest of us can't see? While you're at it, why not recommend Cfront as long as you're trying … | |
Re: What kind of mouse is it? Have you cleaned the hardware? Have you tried another mouse? Have you tried another mousing surface? What other troubleshooting steps have you gone through? | |
Since C and C++ are different languages, would it benefit Daniweb to split the C/C++ forum into separate C and C++ forums? ![]() | |
For those of you who don't know, Daniweb has an IRC server. I'm there a lot, and I don't see any of you. That's not good because I'm there, of course. Real time chat with the resident guru ([B]shamless[/B]) will make you smarter ([B]utterly shameless[/B]) and cooler ([B]words cannot express … | |
Re: When you get a syntax error, it's customary to post the code as well as the error. :rolleyes: | |
Re: >It is skipping some of the datas. Which parts of the data are being skipped? Help us to help you by narrowing down the problem as much as possible. Otherwise we'll just ignore you. | |
Re: >Write a ClassTemplate for a linked list. I think it means write a linked list class that uses templates for the type, not whatever you were trying to do with a vector. Infusing myself with the power of concentrated ugly, I wrote this for you. Maybe you can glean something … | |
Re: >But, how do you see if one string is less than the other? strcmp returns one of three values: 0 if the strings are of equal length and content, a value less than 0 if the first string is shorter or smaller in value than the second string, and a … | |
Re: Your question is vague, and there are multiple answers. Can you be more specific as to how you intend to use a? | |
Re: >What does it mean by saying that? Can we see some code? | |
Re: >HOW DO I WRTIE THE CODE FOR THIS TASK? I believe your caps lock key is stuck. Just like any non-trivial program, you break it up into manageable chunks. Instead of trying to do everything at once, start by writing the program without using separate processes. That's simple, so once … | |
Re: Enumerations are just convenient sets of named integers. For example, in your code, scalene is 0, isosceles is 1, equilateral is 2, and noTriangle is 3. Printing out one of those low values as a char will likely give you something funky. You can fix it by returning a string … | |
Re: >Can anyone help me? Sorry, I don't help people who spam as many forums as they can with their problem. You obviously don't trust the answers you'll get here, or you wouldn't have posted on other sites, so go there to get your help. | |
Re: For any user-defined type, you can overload operator<< for output to ostreams: [code] ostream& operator<<(ostream& out, const Relation& r) { return out<< r.toString(); } [/code] Then all you need to do is define Relation::toString to return a string in the format that you want. Pretty simple really, and overloading operators … | |
Re: >Why can't you program it yourself? Too lazy to be bothered? Too stupid to figure it out? We get the round robin homework problem a lot, and I have yet to see someone show an attempt at it. | |
Re: How is your code close? You don't use loops to handle more than one record, you don't use a structure to store a single record, and you don't have a function that processes the records into a bill. I think you should talk to your instructor so that you have … |
The End.