15,300 Posted Topics
Re: you are close [code] #include <iostream> #include <string> #include <cstring> using namespace std; class MyClass{ public: MyClass Foo(); MyClass Bar(); MyClass Pancakes(string ingredients); }; MyClass MyClass::Foo(){ cout<<"Inside foo\n"; return *this; } MyClass MyClass::Bar(){ cout<<"Inside bar\n"; return *this; } MyClass MyClass::Pancakes(string ingredients){ cout<<"To make pancakes you need: " << ingredients << … | |
Re: what version of windows is running on your computer? If you have Vista then I'm not supprised that tc won't run. Get yourself a newer free compiler, such as Microsoft VC++ 2008 Express or Code::Blocks. | |
Re: Everyone gets bad rep from time-to-time, don't worry about it. Feel lucky I didn't give that bad rep because it would have cost you 23 points instead of the 4 points Killer_Typo gave you. | |
Re: >>Anyone know why this doesn't work? Because the vector is destroyed when function testor() returns to its caller. A better way is to pass the vector by reference to testor() [code] void testor(vector<string>& v) { v.push_back("Lolzer"); } int main() { vector<string> v; testor(v); } [/code] | |
Re: why are you trying to dynamically allocate that array? Just hard-code it [icode]bool visited[11][55];[/icode] then delete lines 4 and 11. If it must be dynamically allocated, then you will have to do it like this: [code] visited = new bool*[11]; for(int i = 0; i < 11; i++) visited[i] = … | |
Re: you [URL="http://www.daniweb.com/forums/showthread.php?t=121245&highlight=icon"]mean this?[/URL] | |
Re: [QUOTE=dev565;870001] 1) What if my line is over 1024 chars????????? how should I fix my code to handle that situstion[/quote] If you want to read the entire line at one time then just declare the input character array to be large enough to hold the largest possible line. >>If there … | |
Re: >>everytime pin or checks is not a null string it throws a GPF. >>checks and pin are strings Do you mean std::string declared in <string> header file? Those are not null-terminated strings at all but c++ class. Post the function prototype for [icode]whitelist(checks, pin, wkbool, wqbool, enpassant)[/icode] | |
Re: It doesn't compile with VC++ 2008 Express either. The compiler didn't like the preprocessor directive on line 1002, chkconf.h. So I changed it to this: [code] #ifdef wxUSE_CRASHREPORT #if !wxUSE_ON_FATAL_EXCEPTION # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_CRASHREPORT requires wxUSE_ON_FATAL_EXCEPTION" # else # undef wxUSE_CRASHREPORT # define wxUSE_CRASHREPORT 0 # endif #endif … | |
Re: [QUOTE=_Nestor;869364]as you can have more than one NIC and it is more likely to be changed than your hard drive[/QUOTE] Computers can also have multiple hard drives. And I've changed hard drives more frequently than NICs. Possibly there is some unique ID in the bios that can be retrieved, I … | |
Re: lines 36 and 37: delete these lines because they are just a temp pointers and can not be deleted. | |
Re: You need two sets of loops. The first loop will only display the values of the array. [code] for (i=0;i<count;i++) { printf("%d\n",arr[i]); } [/code] Then you need another set of loops, similar to the one you already posted, but just prints [icode] printf("%d + %d\n",arr[i],arr[j]);[/icode] >>but when my array having … | |
Re: [QUOTE=power_computer;869708] How do i open the file?[/QUOTE] [icode]inFile.open(str);[/icode] Note that scanf() will not allow spaces in the text, so if the filename and/or path contains spaces then you need to use getline() instead of scanf(). | |
Re: [QUOTE=tux4life;869778]BTW, Why is there actually need for the file being opened in binary mode? Why don't you just use the text mode ?[/QUOTE] Because the file apparently contains the binary (or computer internal storage) values of the data, which are not human-readable and not text. Such files can not be … | |
Re: >>I want it to work can anyone help me Probably not. Attach it to your thread here so people can easily download it. Just hit the Go Advanced button, then the Manage Attachments button. | |
Re: use the new operator to allocate dynamic memory [icode] Holding *holdLib = new Holding[size];[/icode] | |
Re: >>But I need to know what are the best practices for code sharing, like: For every 1,000 programmers there are 1,000 coding styles! Every coder develops his/her own coding style or use the coding style standard set by the company. A good place to start is the links that siddhant … | |
Re: what operating system? More than likely someone changed the password without your knowledge. | |
Re: Is that a MS-Windows GUI program? If it is, then you need to add a message pump in the loop so that Windows has a chance to update the window. I would put it inside that wait function. | |
Re: probably the easiest way is to sort both arrays then all you have to do is check then from top to bottom, if any of the elements in array A are not the same as the corresponding element in array B then they are different. | |
Re: std::vector is not a difficult class to use [code] class Person { // blabla }; vector<Person> theList; // add a person to the list Person p; // fill out the structure is not shown here theList.push_back(p); // add to the list // after that you can use the vector just … | |
Re: Sounds like you need to post in Job Offers -- someone might help you if you want to pay $$$ for their work. | |
Re: Does the service program have permissions to do that? You might have to have the service log in with an administrator account. | |
Re: I see no reason why that compiler could not support Secure FTP -- FTP is not part of the C or C++ languages, so you would have to get the code in the form of a 3d party library. I have not done it myself, so I would be little … | |
Re: [QUOTE=Rama_Kamisetty;864829]Thanks for the reply i will be using the same thanks a lot[/QUOTE] His code isn't correct solution to your problem, but does give you a good start on it. | |
The post count on the forum's main menu is incorrect. For example the thread circled in the attached bitmap says 0, but there are three responses to the original post | |
Re: [QUOTE=smthdeedog48;865425]No i don't need help all the time! I just thought some one that has been in this predicament before knows how i feel and would like to help and not make fun of is it a crime to ask for help! I am an Electrician I bet if i … | |
Re: you mean so that the result looks like this? [quote] 0000000000 1654 </contact> </desc> </desc> </desc> </desc> </name> </name> </phonebook> </pop> </pop> </pop> </pop> </uri> </uri> </uri> </uri> <contact> <desc> <desc> <desc> <desc> <name> <name> <phonebook> <pop> <pop> <pop> <pop> <uri> <uri> <uri> <uri> Contact Example Laptop Phone a l.jl … | |
| |
Re: Oh, so all it does is strip comments from keyboard input and not from a *.c or *.cpp data file??? Why would you want to write such a program? >>I mean this program exits when "x" is inputted. Is there any other way of Exiting? Just press Ctrl+C. | |
Re: not only does [noparse][code=cplusplus][/noparse] give syntax highliting but also line numbers. So are you suggesting [noparse][code][/noparse] also provide line numbers? | |
Re: [QUOTE=jephthah;863288]i'm just wondering, "where's the love?"[/QUOTE] You must not be married -- if you had you would understand that married couples often squabble, but they still love each other. Besides, bitching is the whole purpose of this forum :) | |
Re: IPC isn't really all that difficult -- yes you can learn it on your own. *nix IPCs work differently than MS-Windows, and presumably other operating systems too. IPC could be as simple as file sharing, or as difficult as sockets, pipes and shared memory. There are a lot of different … | |
Re: [URL="http://www.youtube.com/watch?v=glNjsOHiBYs"]Happy Birthday[/URL] -- and welcome to the Old Fart's Club :) | |
Re: The problem is scoping -- object A goes out of scope before the cout statement on line 31. Delete the { and } on lines 20 and 29 and your program will work as you expect it to. | |
Just thought I'd let you know why misspelled words are not caught while you type today. | |
Re: Highest() returns the wrong value -- it should return the index value (value of i loop counter) of the student with the highest grade. You will need to add another variable to keep track of that too. There are a couple ways to implement those functions: 1) in main(), first … | |
Re: memory is allocated on line 10 but never deleted. Try this: [code] void CMFC1Dlg::OnBnClickedButton1() { char *ptr; if( m_POpened ) { CString cmd; m_EditCmd.GetWindowTextA( cmd ); ptr = va( "%s%c", cmd, 13 ); m_Port.WriteToPort( ptr); delete[] ptr; } } [/code] | |
Re: Stop your begging and read your text book. Also paying attention in class would help. | |
Re: moved -- this thread is not an Introduction, like "Howdy folks, my name is Darrel and I'm happy to be here!". Nope. This thread seems to be a bitching session. | |
Re: what is all that crap??:icon_eek: And why is it in the c++ forum? | |
Re: You have to start at the beginning of the linked list and search for the node you want -- somethng llike this: [code] struct* node = head; while(node->next) { // check if this is the node you want // // now advance to the next node node = node->next; } … | |
Re: something like this: [code] void foo( int x = 0) { switch( x ) { case 0: printf("case 0\n"); break; case 1: printf("case 1\n"); break; default: printf("default\n"); break; } } int main() { foo(); foo(1); } [/code] | |
Re: when you type the filename on the command line that name (assuming it has no spaces) is contained in argv[1] [code] int main( int argc, char* argv[]) { if( argc > 1) cout << "The file name is: " << argv[1] << "\n"; } [/code] | |
usine FF on Vista, code inside code tags without line numbers turn is not visible when I click the Toggle link. Works ok with [noparse][code=cplusplus][/noparse]. The problem only happens on random posts. [URL="http://www.daniweb.com/forums/post858782.html#post858782"]Here[/URL] is an example I extracted from another post (PM) When I edit the code tags to add … | |
Re: The requirement for CREATE TABLE indicates that the table contents should be read from a text file (aka schema), not hard-coded in your program. One common way to do that is to create a structure that contains the information for each field in the table [code] struct field { std::string … | |
Re: where did you declare array [b]item[/b]? Change the while statement to [icode]while( i < sizeof(item)/sizeof(item[0]) && fscanf(...) > 0)[/icode]. Note: if [b]item[/b] array is a paremeter to the function you posted then that sizeof() stuff will not work. | |
Re: On the client side, create a string that contains all the values separated by a space. Then send that string to the server. On server side, convert the string to individual data values, make the computations, then create a string with the result value and send back to the client. | |
Re: Welcome to DaniWeb. Be sure to [URL="http://www.daniweb.com/forums/forum52.html"]post your resume here[/URL] to get more exposure. | |
Re: Welcome to DaniWeb. >>But still I am confused for .net. What should i do? Study. Practice. Poast in the C# forum. |
The End.