1,174 Posted Topics
Re: [code]if(packe[q].strinput[0] == ' ') { q++; // Because you have incremented q by one, // the fprintf() call below is guaranteed to produce // unwanted output ... } // You must change your code so that you know whether to use // packe[q].strinput or packe[q - 1].strinput ... fprintf(creafile, "%d … | |
Re: At least one semicolon seems to be missing ... [code]int threedice::getsumFaces() { return die1.getroll()+die2.getroll()+die3.getroll() [B][COLOR="Red"];[/COLOR][/B] }[/code] | |
Re: You might also make use of the strstr() function [url]http://www.cplusplus.com/reference/clibrary/cstring/strstr.html[/url] | |
Re: [QUOTE=piyush_chande;564429]Hello!! I am using Keil Compiler C166. I want to know how much ROM, RAM has been utilized by the code. Can someone help me for this?[/QUOTE] Look into the produced listing file (.LST). | |
Re: [code]if( one == 'o' && two == 'l' && three == 'l' && four == 'e' && five == 'h' ) { [COLOR="Green"] // Select only as many characters as in string 'hello' // i.e. [B]five[/B] ...[/COLOR] this->richTextBox1->Select((positionen - 5), [B][COLOR="Green"]5[/COLOR][/B]); this->richTextBox1->SelectionColor = Color::Red; MessageBox::Show(this->richTextBox1->SelectedText); } [/code] | |
Re: You are misusing fscanf() to scan the integers, you need to apply the address-of operator & [code] for(int i=0; i<max_terms;i++) { fscanf(finput,"%d", [B][COLOR="Red"]&[/COLOR][/B]timeslot1[i]); fgets(packe[q].strinput, 32, finput); if(packe[q].strinput[0]!='\n') q++; fscanf(fcommand,"%d", [B][COLOR="Red"]&[/COLOR][/B]timeslot2[i]); fgets(comm[i].strcommand, 24, fcommand); [COLOR="Green"] // Note that you may have incremented q by one, above, // whenever that is the … | |
Re: Bjarne Stroustrup's comments on the void main() -subject can be read here ... [url]http://www.research.att.com/~bs/bs_faq2.html#void-main[/url] | |
Re: [QUOTE=Jennifer84;565642] Am I on the right track or have I missed something. [/QUOTE] You have now missed something, you are trying to access the KeyCode in wrong handler (TextChanged). Instead, for e.g. the KeyUp event, use ... [code] private: System::Void textBox1_KeyUp(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) { if(Keys::C == e->KeyCode) { // … | |
Re: Use the < operator instead of <= in both of your for loops, i.e. [CODE] for(i= 0; i < Sensor.size(); i++) { for (j=0; j < Observations.size(); j++) { } [/CODE] | |
Re: Just pointing out the fact that in C/C++, array indexes are zero-based. A simple example [code]#define NUM_ELEMENTS 3 int Quantity[NUM_ELEMENTS]; // An array of three integers // Assign a value to each element Quantity[0] = 123; Quantity[1] = 456; Quantity[2] = 789; // Now, to output all elements, last valid … | |
Re: Could it be that you have not escaped backslashes in your string? I.e. in your code the string should be: [code] const char regex[] = "^\\[\\d{4}\\-\\d{2}\\-\\d{2}\\s\\d{2}\\:\\d{2}\\:\\d{2}\\.\\d{3}\\]\\s\\w*\\s*\\w*\\.+\\w*\\:\\d{4}\\sHello" [/code] | |
Re: A link that D. Sinkula earlierly posted in this thread, [url]http://www.di-mgt.com.au/cryptopad.html[/url] maybe it went unnoticed by you ... | |
Re: You can use the SelectionStart TextBox's property for that purpose. Also closely related is the SelectionLength i.e. how many characters the selection spans (if any). As an example, to place the cursor in front of the second character without selected text, you could use [code]textBox1->SelectionStart = 1; textBox1->SelectionLength = 0; … | |
Re: Get the dependency walker from [url]http://www.dependencywalker.com/[/url] and see whether your program actually needs one or more .dlls that you are not aware of. | |
Re: [QUOTE=jephthah;564354]LOL you kids, i swear how about you send me $500 to my PayPal account and I'll won't track your IP address and tell your teacher what you're up to..[/QUOTE] Hmmm ... your post could be moved to a blackmail forum, if one existed ... | |
Re: [QUOTE=CoolGamer48;564134]Um, what exactly does compiling it as release change[/QUOTE] The release version of your program requires a different set of .dlls to be present on the target system. What linker errors are you receiving? | |
Re: You need to do customized drawing for the Textbox. It can be difficult/complex to implement, depending on what you want to do. Anyhow, if you are interested, then look e.g. into [url]http://msdn2.microsoft.com/en-us/magazine/cc164019.aspx[/url] | |
Re: [QUOTE=Petrock6;563603] Well, how do I know and access the paremetters of this command? [/QUOTE] In general, look into the documentation of each of the functions that you are to use. If you installed MSDN along with VC 6, you already have a lots of documentation on your computer. On internet, … | |
Re: A short tutorial on pointers [url]http://www.cplusplus.com/doc/tutorial/pointers.html[/url] Also pointers to void (i.e. void *) are discussed there ... | |
Re: Maybe the following clarifies it [code]#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char** p = NULL; const int numStrings = 2; char string[21]; p = (char**)malloc(sizeof(char **) * numStrings); for(int nn = 0; nn < numStrings; ++ nn) { sprintf(string, "string %d\0", nn); p[nn] = (char*) malloc(strlen(string) + … | |
Re: If you are referring to the MFC's CMap, then start by looking in here [url]http://msdn2.microsoft.com/en-us/library/s897094z(VS.80).aspx[/url] and perhaps here too [url]http://www.codeproject.com/KB/architecture/cmap_howto.aspx[/url] | |
Re: I'm not sure whether I fully understood your question, but consider the following program [code] #include <iostream> using namespace std; int main(int argc, char * argv[]) { if(2 == argc) { cout << "received: (" << argv[1] << ")" << endl; } return 0; }[/code] Let's say that the program … | |
Re: [QUOTE=technogeek_42;557417] i can't run this their is plenty of errors coz using namestd; is not available in My turbo C[/QUOTE] Just grab yourself an up-to-date, free development environment, for example [url]http://www.codeblocks.org/[/url] or [url]http://www.bloodshed.net/index.html[/url] or pick one from ... [url]http://www.bloodshed.net/compilers/index.html[/url] | |
Re: [QUOTE=Jennifer84;561945] Is it not possible to find the next occurence of a character and then find("]") wich comes after the string stringToFind ?[/QUOTE] The find() function can be told where to start the search from, see below [code=cplusplus] string Line = "a4545l5l[12] 1Number2[51] 2Number[1]"; string stringToFind = "1Number2["; string::size_type startPos … | |
Re: Appears as if you were not having the corresponding .cpp included in scope of compile/link, i.e. the one in which you've implemented e.g. AppointmentBook::AppointmentBook() ... | |
Re: The bahaviour would perhaps be more understandable if written like [CODE]int main() { using namespace std; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { cout << i << " " << j << endl; } } return 0; … | |
Re: Then you could loop through the array and convert the ints one by one using something like [code]char_array[index] = int_array[index] + '0';[/code] In general, to convert any integer value to a std::string, you can use a stringstream: [code] stringstream sstream; string astring; int value = 213123; sstream << value; sstream … | |
Re: Consider also that warnings often times should really be paid attention to, rather than trying to hide them ... | |
Re: About the punchmeinthehead() function ... [code] void punchmeinthehead() { const int maxin = 16; // Here you have three uninitialized arrays of char, use a // debugger to see what they contain here ... // (Shouldn't you instead be using the variables // that you have in your main() ?) … | |
Re: This is a run-time problem rather than link-time problem (i.e. linker search path properties are of no help). Modify your computer's PATH environment variable to include the C:\glib-2.14.6\bin directory. You need to restart Eclipse in order for the change to take effect. | |
Re: You need to have, e.g. [code]#define ADDRESS_LEN_MAX 123 char searchaddress[ADDRESS_LEN_MAX] = ""; char newaddress[ADDRESS_LEN_MAX] = "";[/code] or perhaps use std::string (with appropriate changes to the code) i.e. [code] std::string searchaddress; std::string newaddress;[/code] | |
Re: You should also handle factorial of zero i.e. 0! | |
Re: Hmm .. maybe you can get some ideas from the following... [code] #include <iostream> using namespace std; int main() { int height = 3; int width = 3; unsigned char fillSymbol = 0xf0; // draw a 3x3 area using fillSymbol while(height --) { for(int col = 0; col < width; … | |
Re: This [code]if(buffer[posinstream] == [COLOR="Red"]"[/COLOR] [COLOR="Red"]"[/COLOR] || buffer[posinstream] == [COLOR="Red"]"[/COLOR]_[COLOR="Red"]"[/COLOR])[/code] should be [code]if(buffer[posinstream] == ' ' || buffer[posinstream] == '_')[/code] | |
Re: In the last if, you need to change from [code]if(valinta2 == 1){ return valinta; }[/code] to [code]if(valinta2 == [B][COLOR="Green"]2[/COLOR][/B]){ return valinta; }[/code] You can do with one variable for getting the user's choice i.e. use only valinta and toss away valinta2 altogether. And also drop the needless else if block … | |
Re: For starters, instead of [CODE] char *string1[100000], *string2[100000]; [/CODE] you'll be doing much better of with something like [code] #define MAX_STRING_LEN 123 // define some reasonable string length // 100000 really is not in that category, I think char string1[MAX_STRING_LEN] = ""; char string2[MAX_STRING_LEN] = ""; [/code] Then after you've … | |
Re: [QUOTE=sanjayk1241@yah;558730] The above command is not satisfying my requirement. I don't which options i should use to get this.[/QUOTE] Hmm .. open a command prompt and try e.g. cpp32.exe -? to see if there is an option for preserving comments in the preprocessor output. | |
Re: That will not work out-of-the-box, you should take a look at: stringize and the token-pasting operators e.g. here [url]http://www.keil.com/support/man/docs/c166/c166_pp_tokenpastingop.htm[/url] | |
Re: [QUOTE=scream2ice;558800] cin>>elem(i,j); //[B]this is the bit the compiler seems to give the error for [/B] [/QUOTE] The elem() function call is unncessary there, you can directly access the data member variable, i.e. cin >> data[the index here]. If you want to stick to using the elem() function call there, you … | |
Re: [QUOTE=langzhen;556139]our program won't compute[/QUOTE] At least two primitive problems, to fix, change: [code]scanf("%s", [COLOR="Red"]&[/COLOR]item);[/code] to [code]scanf("%s", item);[/code] and [code]scanf("%i",subtotal);[/code] to [code]scanf("%i", [B][COLOR="Green"]&[/COLOR][/B]subtotal);[/code] | |
Re: A minor note .. why are you skipping the ReadInGroup[] at index 0? In your for loop, you start at index 1 instead of 0, so that leaves the first index of ReadInGroup[] unprocessed. Is that what you want, or should you change [code]for (int Starting = 1; Starting < … | |
Re: [QUOTE=harishankarb;557800]I mistook his caption(RonaldRegan Qoutes). [/QUOTE]:icon_cheesygrin: | |
Re: You need to use the new_end iterator that the unique() produced. [code] std::sort(ReadInData.begin(), ReadInData.end()); vector<string>::iterator new_end = std::unique(ReadInData.begin(), ReadInData.end()); for (std::vector<string>::iterator it = ReadInData.begin(); it != [COLOR="Red"]new_end[/COLOR]; ++it) { outFile << *it << '\n'; } [/code] | |
Re: The following is not an assignment [code]n[count] [COLOR="Red"][B]==[/B][/COLOR] c; [/code] instead use [code]n[count] = c;[/code] Didn't your compiler complain about that line? | |
Re: [QUOTE=rahul.b123;554426]my main interest is to learn to write virus[/QUOTE] Oh well, you really are on your own with that one ... | |
Re: [QUOTE=technogeek_42;544839]how can u convert the month-date-year to a day like monday?[/QUOTE] The complete answer to that question is already given in Dave Sinkula's post in this thread (see [url]http://www.daniweb.com/forums/thread109909.html[/url]). Look at closely the output of his program: [code] /* my output [B][COLOR="Green"]Tuesday[/COLOR][/B] Tue Feb 19 00:00:00 2008 */ [/code] The … | |
Re: This should do [code]System::Diagnostics::Process::Start("c:\\test.txt");[/code] | |
Re: You need to implement something like operator >= (const photon & other) in the photon class, so that the comparison can be made. | |
Re: Have you tried .. to show the sub-form from the main form (which has to be a MDIContainer) [code]// remove the taskbar style from the main form this->ShowInTaskbar = false; SubForm.MdiParent = this; Subform.Show(); [/code] And when the sub-form closes, use ParentForm ... [code] // Restore the taskbar style of … | |
Re: [QUOTE=dkwantee;556141] i have been able to understand upto 7 line. can someone help me further?[/QUOTE] This might prove helpful ... [url]http://en.wikipedia.org/wiki/Selection_sort#Method[/url] |
The End.