6,741 Posted Topics
Re: I've never heard of your problem before. Sorry. >Or perhaps a link to a decent/free compiler that I could use? [url]www.google.com[/url]. Search for Dev-C++ or Bloodshed. | |
![]() | Re: >I need a function that does the same thing as both CLS and Clear. [code] #include <stdlib.h> #include "system.h" void clear() { #if defined(DOS_BASE) system("CLS"); #elif defined(UNIX_BASE) system("clear"); #else #error Unsupported system #endif } [/code] Will it work? Probably, provided you define either DOS_BASE or UNIX_BASE in system.h. Is it … |
Re: There's nothing wrong with your code aside from formatting and redundant braces. Though the last loop could simply be an assignment because all you're doing is adding dag to amount. Here's how my first attempt would do it: [code] #include <cstdlib> #include <iostream> using namespace std; int main() { const … | |
Re: >This is due tomorrow Bummer. >and i am absoltuly lost Try paying attention in class. >can anyone help with some examples or point in the right direction Sure, post your attempt and we'll help. Nobody is going to do your homework for you. Especially since it seems like you're terribly … | |
Re: And your C or C++ question was? | |
Re: >How do I get to compile it in DOS? Are you [b]using[/b] DOS? Or are you one of the many ignorant people in the world who think that the Windows command prompt is DOS? You really are behind the times by many years. There are many superior alternatives to BGI … | |
Re: Don't use the physical size of the string as your limit, use the logical size. The physical size is the size of the array while the logical size is determined by where the terminating null character is: [code] #include <algorithm> #include <cstring> #include <iostream> using namespace std; void sreverse(char *s) … | |
Re: Two virtually useless replies it seems. Dancing around the problem isn't very helpful. Let's cover the first reply: >system("PAUSE"); // in <cstlib> i believe. Bad suggestion. I've explained why before. >getchar(); // in <cstdio> And this is different from cin.get()...how? The only difference is that now you don't attempt to … | |
Re: What an awful question. You make it difficult to tell if it even IS a question, then follow up with a ridiculously vague reference to an acronym that you don't even bother to put in caps. Did you really expect to get any answer other than the one I'm about … | |
Re: Delete the files from within VC++, then go to the project folder and kill them there too. | |
Re: [code] #include <cstdlib> std::system("<path to excel>"); [/code] | |
Re: Argh! Why must you people fill my brain with hurting!? And people ask me why I'm angry all of the time. I direct rage at anyone who insults the effort I put into learning how to use C properly. Too much bad code, going somewhere else to cool off now... | |
Re: Every function declaration should have the following structure: [code] return-type name(optional-parameters); [/code] Every function definition should have the following structure: [code] return-type name(optional-parameters) { } [/code] A function can return void if there's no meaningful return value, and it can accept no parameters if there's no need to: [code] int … | |
Re: >I was just looking for some help thats all We'll be happy to help, when you ask a question that doesn't resemble "Help me with the problem I just pasted but haven't actually tried to solve yet". >I just heard that this is a really good well-established website on helping … | |
Re: There's a language standard that compilers are pretty much required to support if they want any market share, but the language definition also allows for non-standard extensions. Every compiler out there will take advantage of this allowance, so code that uses extensions will not be portable across compilers. The same … | |
Re: isdigit(cin.peek()) is basically the same thing as [code] char ch; cin.get(ch); isdigit(ch); cin.unget(); [/code] It returns the next character on the stream and then tests to see if it's a valid numeric digit without removing the character from the stream. | |
Re: >i just need someone to point me in the right direction. [code] int main ( void ) { return 0; } [/code] >but the problem is that i need it to subract the highest and lowest numbers then add the remaining numbers left. What have you tried so far? Have … | |
Re: >help with getting soda machine program running [code] bool fix ( const soda_machine& machine) { kick ( machine ); slap ( machine ); shake ( machine ); curse_at ( machine ); return machine->is_working; } ... if ( !machine.is_working && !fix ( machine ) ) call_repairman ( machine.serial_number ); [/code] But … | |
Re: >1. I've heard that using pointers makes it much more difficult for the compiler to optimize code. You heard wrong. [b]If[/b] a compiler fails to optimize pointers properly, it's extremely unlikely that all other compilers do as well. >so in this case I'd say that the pointer referencing is unwanted … | |
Re: >im studying programming fundamentals.. Then why are you learning C? >pls can u give me some definition and information about c language Get a good book. Online tutorials have a tendency to suck ass. A good tutorial/reference book is [I]The C Programming Language[/I] by Kernighan and Ritchie. | |
Re: >if it is ..... it should be system("cls"); No it shouldn't. Then you would add two problems to already nonportable code. If a screen clear is warranted, then it should be changed to something that the implementation supports, preferrably by doing something like this to make porting easier in the … | |
Re: >I want to learn Java Servlets, Oracle 8i & Linux Administration. Cool. >I have tried the Sun's site for Java but I can not follow it. I assume you started [url=http://java.sun.com/learning/new2java/index.html]here[/url] and then moved on to [url=http://java.sun.com/learning/tutorial/index.html]here[/url]? If that's too much then you really should get a good beginner's book. … | |
Re: >It would become a lot easier if you use list<string> instead Agreed. >and fstream functions for the file handling Many feel that C++ streams are too awkward and opt for FILE *'s instead. I can understand that feeling for most common uses. >void main (void) First, main doesn't return void. … | |
Re: What kind of problems are you having? I can think of at least three big reasons off the top of my head why a Java server couldn't communicate properly with a C++ client. | |
Re: >Can anyone tell me the complete algorithm analysis of Tower of Hanoi Sure: [code] #include <iostream> using namespace std; int main() { cout<<"I'm too lazy to do my own work\n"; cout<<"I'm too stupid to realize that nobody will do my work for me\n"; cout<<"I'll never amount to anything because I'm … | |
Re: >What exactly are we returning as a pointer to an integer? The shortest path, basically an array of x,y pairs. >Are we making changes to the two arrays that are passed in with each iteration? No, those arrays simply tell you what the distance between two points is. >Try going … | |
Re: I have a better idea. You prove that you've tried to solve these problems on your own, and we'll help you with any errors. No one is going to do your homework for you. | |
Re: To remove a node with two children you need to find the inorder successor or predecessor to replace it with, then reduce to the case of removing the successor or predecessor. A fairly thorough tutorial on binary search trees can be found [url=http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1073433376&id=1073086407]here[/url]. | |
Re: >how do you convert to binary. Try using printing 1 if val % 2 is not 0 and 1 otherwise, then divide val by 2 and repeat until val is 0. This should give you a good start toward the solution. | |
Re: >but y doesnt the "do while" loop terminate upon entering "\r" (enter) cin's >> operator terminates on whitespace. \r and \n are whitespace, so ch and sold will never have those values, the program will simply sit there waiting for input until it gets something it likes. | |
Re: >dear use function Dear, don't suggest nonportable functions unless you know that they're supported and acceptable solutions. >I AM ONLY ABLE TO ALIGN THE TRIANGLES VERTICALLY AND NOT HORIZONTALLY For each row, handle all of the triangles rather than just one: [code] #include <iostream> using namespace std; int main() { … | |
Re: >the variable is maintained and is available for future calls of the function in which it has been declared However, this isn't as useful as it appears at first. | |
Re: >I am attaching my .cpp file. Don't do this. Post the code. If the code is too long, post relevant pieces. Your attachment is very small, so the code is short enough to post. | |
Re: >How would I create a method like toString() within the SHA-1 class Try using a stringstream with the hex modifier: [code] #include <iostream> #include <string> #include <sstream> using namespace std; int main() { ostringstream oss; char ch = 'a'; cout<< ch <<" -- "<< hex << static_cast<int> ( ch ) … | |
Re: What problem are you trying to solve with this code? It appears as if you want to take a list of strings, then print out whether or not the each unique string is a palindrome. >/* Counting duplicates */ This isn't entirely truthful. It looks more like you're [b]removing[/b] duplicates … | |
Re: >i don't understand how to do this. You should have paid attention in class then. | |
Re: >Any ideas whats wrong? Too much. There's no point in trying to fix something so broken, so start over, and this time use a C++ reference. | |
Re: It sounds like a scope issue where the Calculations object whose values you're setting is being destroyed and then recreated. When you access the values, they're fresh from the constructor. | |
Re: >Does anyone know where I can find an example of the code? The following is a good description with C code. Fortunately, the differences are only in details. You can easily figure out how to translate the algorithm to Java. [url]http://www.stanford.edu/~blp/avl/libavl.html/Balancing-a-BST.html[/url] Alternatively, you could get a membership with the ACM … | |
Re: >How can we print the output of the program Print to a printer device, you mean? There are probably issues involved that you aren't aware of, so writing directly to a printer stream isn't the best idea. It would be much better to search your documentation to find a nice, … | |
Re: >according to my notes its right And your notes have to be correct? Nope, sorry. >void main() int main ( void ) >int enter_operator; char enter_operator; >scanf ("%d",&enter_operator); scanf ("%c",&enter_operator); >if (enter_operator = +); if (enter_operator == '+') >if (enter_operator = -) else if (enter_operator == '-') >} return 0; … | |
Re: >Is something wrong with my software, or something? Sure, blame the software for your misunderstanding of the language. >void main() {} should also be accepted even though it's not good practice. You should start telling people that it's WRONG. That way they may actually stop using it. The official rules … | |
Re: >how long did that take you? The real question is how long will it take him to realize that doing your homework for you was a mistake. >i owe you big time No, you don't. The code you were given would get me fired, and it'll probably get you a … | |
Re: >does that work? >also i keep gettin a compile error Hmm, if you get an error then it probably doesn't work. >polyg & polyg::operator=(polyg& pg);//5 Remove the semicolon. | |
Re: >how would i tell the program to output 5 stars instead of the number 5 [code] for ( int i = 0; i < 5; i++ ) System.out.print ( "*" ); [/code] | |
Re: >i was wondering what i did wrong Start by getting the sorting algorithm correct with simple test cases. All of the framework is only going to make debugging harder. But I can tell you right now that your algorithm is wrong. Check my sorting routines entry in the Code Snippets … | |
Re: >I am confused about where it will be getting files from? The program will be executed like this: [code] $ mycat file1 file2 file3 [/code] For the purposes of your assignment, you can assume the following for argc and argv of main: [code] argc = 4; argv[0] = "mycat"; argv[1] … | |
Re: >Does anybody know if this software is great It works fine for my purposes. >what are the best features of it It works fine for my purposes. ;) >Other recommendations are also welcome. Borland C++ 5.5 and Dev-C++ are both free and good quality. | |
Re: Multiple threads with the same question in less than a day means no answer for you. Figure it out on your own if it's that urgent. | |
Re: >Here is what i solved so far Nice, you managed to write a bit of framework, but none of the solution at all. Be more specific about what the homework entails and I might help. |
The End.