1,171 Posted Topics
Re: [QUOTE=FaNtEcH;868758]Oh well..you asked for it.[/QUOTE] Actually there's no need for rapidshare, and if you've big code you can always attach your source to this thread :) | |
Re: If you're talking about the C++ class [I]basic_string[/I] then you can just pass a string to a function in the same way as you're doing with a normal variable :) ... e.g.: [CODE] void strFunc([B]string s[/B]) { cout << s << endl; } [/CODE] | |
Re: Go to: [ICODE]Build>Configuration Manager[/ICODE] Edit:: Sorry, I didn't read your question thoroughly :( | |
Re: You could get the computer's hard disk ID (hardware key), you can find some source code on how to do this [URL="http://www.winsim.com/diskid32/diskid32.html"]here[/URL], but as already said the user can always replace a 'dead' part in his computer, so dealing with a unique computer ID will be way more difficult than … | |
Re: Could you please post using code tags? And by the way: your code is still using the C file handling this isn't wrong but in C++ the C++ way for File I/O is preferred :) [QUOTE=jtltgl;865598] i need help in modifing code to count the number of records the '\n' … | |
Re: Are you sure that you're a software engineer (as described in your profile) ? [CODE] 10 20 30 40 [/CODE] (Just display the array) [CODE] 10+20 10+30 10+40 20+30 20+40 30+40 [/CODE] (Take the first element and display all the elements after it, take the second element and display all … | |
Re: Try to change your while loop to this: [CODE]while (in_file.read(reinterpret_cast<char*>(&i),sizeof(short))) { i_abs = abs(i); out_file.write(reinterpret_cast<char*>(&i_abs),sizeof(short)); }[/CODE] | |
Re: >>is it possible to return class A's struct in some function to class B? Yes >>do i need to overload this? and if so how would i write the overload function? No, you've to make class B a friend class of A ![]() | |
Re: [B][U]To remember for ever:[/U][/B] [COLOR="Red"][B][U]DaniWeb isn't a homework completion service[/U][/B][/COLOR], that means that we aren't writing this program for you, show us what you've already done so far, tell us where you get stuck and ask specific questions about the things you don't understand, all what you've done so far … | |
Re: [QUOTE=losh177;869592] Can i use the call cin.ignore('[B][COLOR="Red"]/[/COLOR][/B]n')? [/QUOTE] First of all it is [ICODE]cin.ignore('[COLOR="Green"][B]\[/B][/COLOR]n');[/ICODE] and secondly: read [URL="http://www.daniweb.com/forums/thread90228.html"]this[/URL] ... | |
Re: [LIST=1] [*]Is it only when you start your program in debugging mode that you're encountering this problem? [*]Is your program working correctly outside the debug-mode? [/LIST] | |
Re: Try to pass the following arguments to your compiler: [ICODE]/EHsc /link [I]YourLib[/I].lib[/ICODE] :) Edit:: Maybe [URL="http://msdn.microsoft.com/en-us/library/ms235630(VS.80).aspx"]this[/URL] is also helpful ... | |
Re: > Is the PC really shutting down (powering off) and then restarting (a cold boot up) :?: >> If this is the case then it might be defined somewhere in your computer's BIOS, but probably this is just a Windows problem :) ... | |
Re: [URL="http://www.truecrypt.org/"]TrueCrypt[/URL] is full-featured and comes with source code (but the code will be big I guess) :) | |
Re: >Is there any special method in c++ called get and which doesn't require instantiation? >When i tried to find this method, I couldn't find it. Well I could find it: [URL="http://www.cplusplus.com/reference/iostream/istream/get/"]http://www.cplusplus.com/reference/iostream/istream/get/[/URL] :P Did you actually search? You can't just look over it, it's on top: [URL="http://www.lmgtfy.com/?q=c%2B%2B+get()"]http://www.lmgtfy.com/?q=c%2B%2B+get()[/URL] | |
Re: You'll have to use [ICODE]cin.ignore()[/ICODE] to clean the input buffer, read [URL="http://www.daniweb.com/forums/thread90228.html"]this[/URL] thread :) | |
![]() | Re: [QUOTE=Dilbert137;868121]It just that i do not find the source code for Clamwin. I am new to antivirus programming and want to understand more how it works and make a small program. I know want a source code is and have already written assembly codes.[/QUOTE] >...and want to make a small … |
Re: Try [URL="http://codecutter.org/tools/koolplot/"]this[/URL] library :) | |
Re: Why do you try to pass an [ICODE]fstream[/ICODE] object? Just declare an [ICODE]fstream[/ICODE] object in the private section of your class :) | |
Re: Yeah, that's all OK, but can you post the code you have so far, and ask specific questions about what you don't understand ? Edit:: I think you're supposed to create a class hierarchy ... | |
Re: [ICODE]ofstream infile;[/ICODE] // create a new output stream [ICODE]infile.open ("[I]yourfile[/I]", fstream::app);[/ICODE] // open the file for appending | |
Re: >Apart from that . The using of new operators and not deleting them is causing a memory leak everytime you run your code. Absolutely correct! But normally today's Operating Systems clean up the memory automatically when the program exits, however, allocating memory and not releasing it back is not a … | |
Re: I would store the words in a plain text file and read them into a vector :) | |
Re: So you have to estimate/calculate pi am I right? Could you please post the whole algorithm (+an example of the series) | |
Re: [QUOTE=Sky Diploma;865973]What does CTRL+C do?[/QUOTE] [ICODE]CTRL+C[/ICODE] just breaks/stops the execution of a console program :) By the way: I had also expected your program was stripping comments from C/C++ source files, but you can easily adapt it to remove comments from files :) | |
Re: That's the most ridiculous I've ever heard: using a [ICODE]float[/ICODE] to define a [ICODE]boolean[/ICODE] LOL :P [LIST=1] [*]It's harder to accomplish (but it isn't impossible :)) [*]A [ICODE]float[/ICODE] uses much more memory than a [ICODE]char[/ICODE] (and you don't need all this memory) [/LIST] | |
Re: [QUOTE=Akis2000;865022]hello, i have a double value=0; and i want before starting the calulation to round this value in the numbers that the user add, for example 2... any ideas??? I have despered...........[/QUOTE] I don't understand that, can you give an example ? | |
Re: [QUOTE=NTxC;866022]Hello. I'm currently having a memory leak problem in my program (C++ with MFC, VS2005) and I don't know WHY it happens, as the code seems to be OK to me. Anyway, here's the code that causes memory leaks: [code=C++]char* va( char* FormatStr, ... ) { va_list ArgPtr; char *FinalString; … | |
Re: You can't declare functions within other functions/statements: [CODE]switch (menu) { case 0:{ [COLOR="Red"] void displayHigh ( int max)[/COLOR] [COLOR="Red"]{[/COLOR] double max = 0.0; for ( int numbers[i] = 1; i < 100; i++ ) if ( numbers[i] > max ) cout << "The Maximum number is: " << max; break; … | |
Re: Just some advices (after a first quick look at your code, not a solution to your problem): [LIST] [*]In your main-function I encounter this line: [ICODE]while(flag==true)[/ICODE] it's just the long way to write: [ICODE]while(flag)[/ICODE] [*]I also encounter the nasty [ICODE]system("pause");[/ICODE] line, there's actually no need to use this, you could … | |
Re: [QUOTE=Sky Diploma;865392][code] if (delim[b]=fileWord[b])[/code] Firstly Assignment "=" is not equal to Equal to "==". [/QUOTE] A little clarification: when you write [ICODE]if (delim[b]=fileWord[b])[/ICODE] then [U][B]you're assigning[/B][/U] the value at [ICODE]fileWord[b][/ICODE] to [ICODE]delim[b][/ICODE], as a result the assignment operator always returns the assigned value what means that if the assigned value … | |
Re: I think you're already on a good way: you've already the skeleton of a class which will contain a flight's details ... [LIST] [*]Continue creating your Flight class [*]If your Flight class is ready, you could create a vector of it, that's a lot easier as you don't have to … | |
Re: Try something like this: [CODE]char filename[20]; if(argc>1) { strcpy(filename, argv[1]); }[/CODE] Edit:: We have to check whether the number of arguments is greater than 1 because the program's first argument ([ICODE]argv[0][/ICODE]) is always containing the program's filename ... | |
Re: Why don't you just use the principle of reading and writing structures from/to a file? [B][U]To write to the file:[/U][/B] Let's say we want to write the following structure to a file: [CODE] struct book { char author[30]; char title[20]; char publisher[20]; int price; }; [/CODE] [CODE] const int NUM_OF_BOOKS … | |
Re: [QUOTE=kiske;865328]I've forgotten that in c++ the not operator is implemented with "~"[/QUOTE] Just a little bit extra info: In C++ you've actually two NOT-operators (this does also apply to the AND and OR operators): you've the bitwise NOT-operator [ICODE]~[/ICODE] and you also have the logical NOT-operator [ICODE]![/ICODE] :) ... You … | |
Re: Divide the problem into parts: [LIST=1] [*] Declare an array (of type [ICODE]char[/ICODE])where you want to put all those digits in [*] Get the integer from the user (get it via [ICODE]cin[/ICODE] and store it in an integer variable) [*] Use the [ICODE]itoa[/ICODE] function to convert the integer to a … | |
Re: >This may help Yeah, Alex, it will surely help him, but you don't explain him what you've changed to make his code work ... To the OP: It's because of the [ICODE]getline[/ICODE] function, so you'll have to flush the input stream each time to make your code work as expected, … | |
Re: That's the worst main function I've ever seen: [ICODE]void main()[/ICODE] ([URL="http://www.gidnetwork.com/b-66.html"]reason[/URL]) Please post using code tags, and by the way: I don't see any question, I'm not a magician, I cannot look into your mind to see what your problem is, so please just tell it :P | |
Re: [QUOTE=William Hemsworth;863484][CODE=CPLUSPLUS]#include <iostream> int bin_to_int(char *binary) { // ... } double bin_to_double(char *binary_fixed_point) { // ... } int main() { // ... }[/CODE]Hope this helps.[/QUOTE] You forgot to put the [ICODE]using namespace std; [/ICODE] instruction in your snippet :P | |
Re: [ICODE]__WXMSW__[/ICODE] ... Don't you've to build them for Unix/Linux? As you can run your applications in X :) I think you don't need the Windows Version of wxWidgets, but the wxX11-version (you can [URL="http://www.wxwidgets.org/downloads/"]grab it[/URL] from their site) ... | |
Re: [QUOTE=asweetroxxi;864156]i put my whole program in the thread[/QUOTE] I've nothing against the fact you're putting your whole program in this thread, as long as you use code tags ! | |
Re: I already wrote something like this for BigInteger addition (using C++ strings), maybe it might help you: [URL="http://www.daniweb.com/code/showsnippet.php?codeid=1154"]http://www.daniweb.com/code/showsnippet.php?codeid=1154[/URL] :) By the way, you haven't ask us a specific question, where are you having problems with in your code? | |
Re: [QUOTE=William Hemsworth;852489][ICODE]bool[/ICODE], not [ICODE]void[/ICODE] and there isn't really any need to reference the parameters either.[/QUOTE] And if you're referencing parameters and you aren't changing the parameters passed by reference it's better to pass them as a constant reference :) ... To the OP: You forgot several brackets in your code … | |
Re: >PLS REPLY You've two replies, are you happy now? Don't just copy your homework assignment :( | |
Re: [QUOTE=valtikz;862994] [code]void PhoneBookModel::sortByName( Glib::RefPtr<Gtk::TreeSelection> selection ){ /* Enter SortByName Function here */ }[/code] [/QUOTE]>Enter SortByName Function here I hope this wasn't a request to do your homework, you'll never get free code here, you've to get your grade by turning in your code, not by turning in the code we … | |
Re: The first is not good, and the second is also a bad one: [ICODE]Head = NULL;[/ICODE] Why should you set the pointer to NULL right after the declaration? It's automatically done (If you declare a pointer, it's automatically pointed to the first memory address: NULL) ... | |
[QUOTE=Ancient Dragon;862638]That is incorrect. The pointer is assigned whatever random value is at that memory location. For example [icode]char *ptr;[/icode] the address of ptr is whatever is at that memory location on the stack (assuming its not a global variable). It is never auto set to NULL by the compiler … | |
Re: [ICODE]while(!fin.eof())[/ICODE], before testing for EOF you should have performed at least one read operation (read [URL="http://www.gidnetwork.com/b-58.html"]this[/URL]), so this would be a correct way to do it: [CODE] [B]getline(fin, s);[/B] while(!fin.eof()) { getline(fin, s); cout << found << endl; } [/CODE] | |
Re: Actually there's already such a feature in the C-subset of C++: [URL="http://www.cplusplus.com/reference/clibrary/ctime/clock/"]http://www.cplusplus.com/reference/clibrary/ctime/clock/[/URL] :P | |
Re: Please be more specific in your question: [ICODE]Does anyone of you know how to protect this?[/ICODE] Do you want to add a copy protection to your program? |
The End.