- Strength to Increase Rep
- +9
- Strength to Decrease Rep
- -2
- Upvotes Received
- 30
- Posts with Upvotes
- 28
- Upvoting Members
- 24
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
279 Posted Topics
Re: You put a backslash in front of the special character (the double-quote or the other backslash) in order to remove its specialness and simply display it as is. Try this: [icode]cout << "\"\\n\"" << '\n';[/icode] | |
Re: You do not have enough disk space to save the pre-compiled headers (PCH file). Delete some files and try again. It is beside the point that your other files compiled nicely. This problem has nothing to do with your code. ![]() | |
Re: Or do it in one step: [code] For each char in str: If it's a space: * Remember that you saw a space, but don't copy it to the output string. Else (if it's not a space): * If it's not leading space: * Copy a space to the output … | |
Re: Narue: "Posers should know their limits." You say it's rude to resurrect old threads but you're rude whenever you feel like it. One of the rules of this forum is "keep it pleasant". You are not following that rule. It's sad how a relatively simple skill like programming can go … | |
Re: You only need to loop through less-than-half of the matrix since in each execution of the inner loop you're swapping two elements (and the main diagonal stays put). If you iterated through the whole matrix, you'd just put it back the way it started. Starting j at i+1 loops through … | |
Re: wherex, wherey, gotoxy are all Borland extensions. (Do Borland compilers still support them?) You can learn how to do it using the OS functions directly yourself. | |
Re: [QUOTE=moshe12007;807837]I read 3 c++ books on dos[/QUOTE] Now that you're a DOS expert, the world is your oyster! | |
Re: They are all "floating point" types. "double" is basically short for "double float" (but you can't say that). A float is usually 32 bits long whereas a double is 64 bits. A long double can be anywhere from 64 (same as double) to 128 bits. I hear "C++ from the … | |
Re: Programmers do not use "word wrap". Try hitting "Enter" once in a while. | |
Re: Here's one way to find the PID from the exe filename. [code] #include <windows.h> #include <tlhelp32.h> DWORD PID_from_EXE (char *exe_name) { DWORD ret = 0; PROCESSENTRY32 pe32 = {sizeof (PROCESSENTRY32)}; HANDLE hProcSnap = CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0); if (hProcSnap == INVALID_HANDLE_VALUE) return 0; if (Process32First (hProcSnap, &pe32)) do if (!strcmp (pe32.szExeFile, … | |
Re: There would seem to be method in such madness. But, as Narue said, you cannot entirely solve the tree without an inorder traversal as well. The problem should be solved recursively, as you might expect. [code] pre: C B A E D F H post: A B D H F … | |
Re: Do you just mean something like this? [code] test: [i]dependencies[/i] gcc prog1.c -o prog1 gcc prog2.c -o prog2 [/code] | |
Re: Someone might actually look at your code if you post it as a single zip file. Edit your previous post if possible. | |
Re: The code looks reasonable, except that "and"ing with 0x0fff and 0xffff does nothing in this situation (assuming 16-bit shorts). Removing those will change nothing, however. I would check the "answer" you've been given before going any further. Your code may be just fine. As for test_crc, there is no reason … | |
Re: Can you install a newer version of the TurboC compiler? Or can you switch to a better IDE/compiler like MSVC++ or Codeblocks? | |
Re: When Knuth talks about random numbers he mentions a CD of random numbers called "Black and White Noise" which is a mixture of deterministically sampled rap music combined with white noise. | |
Re: sid> Just check what would happened if delete would reset the pointer to zero: Nothing would happen! Are you a mindless idiot? Did your brain fall out? Did you replace it with a turd you found on the ground? delete does nothing if it's passed a zero pointer! Moron! I … | |
Re: The whole point of prefix notation is to represent the formula in such a way as to eliminate the complications of precedence and association. To reinstate these complications is sidiotic. I feel the most likely case here is that you are misunderstanding the assignment. It makes perfect sense to process … | |
Re: I don't understand the question. Perhaps if you describe what you are trying to do. In general, people seem to be overusing strtok. Often it's not the way to go. Your's looks like a job for sscanf or fscanf, but it is hard to tell without more info. | |
Re: main must return int (not void). You are missing a closing brace. "five" is a strange name. datum is spelled with a u. See comments in program. [code] #include <iostream> #include <fstream> #include <vector> using namespace std; struct five { float column1, column2; }; // Does not need to be … | |
Re: ThreadTime does not have access to hWndDlg. You need to either make it global (DlgProc would set the global var in WM_INITDIALOG)or pass it as a parameter to ThreadTime. | |
Re: This: [icode]void FindcarVin(int , string , string, int , int );[/icode] is not the same as this: [icode]void FindcarVin ( int vinnums[], string brandnames[], string modelnames[], int yearnums[], int specnum )[/icode] See the difference? It's always best to copy the definition's signature, both to ensure the prototype is the same … | |
Re: Instead of a bunch of parallel arrays like this: [code] int vin[SIZE]; string brand[SIZE]; string model[SIZE]; int year[SIZE]; int mileage[SIZE]; double mpg[SIZE]; [/code] try a single array of structs like this: [code] struct Car { int vin; string brand; //etc. }; Car car[SIZE]; [/code] And all your function signatures become: … | |
Re: > the lack of any apparent connection makes me think i'm initiating > something else (one of the libraries or something from the OS) > that has a run-time error Although possible, you should consider this as a last resort. Otherwise it will dull your mind to the more likely … | |
Re: Minimally you must handle single quotes, double quotes, single-line comments, and multi-line comments, since, as ArkM has pointed out, these constructs may contain parens (etc.) which you will want to ignore. | |
Re: The best solution is always the simplest one that does the trick. So, since you're only instantiating it with one type (i.e., a Comparable and it's derivatives), you don't need a template. That's what JohnA was saying. [code] class Comparable { public: virtual int compare( const Comparable& c ) const … | |
Re: So you're saying that if you take the exact same exe and config file that works on your machine and transfer it to your friend's machine, it doesn't work? Does he have the exact same OS as you? Has he installed your program in the same way as you have? | |
Re: Such flat, lifeless code. Why? No code tags! ;) You're reading over and over to the same part of the buffer (and zeroing it before every read). Move the zeroing (if necessary) outside the loop, and either move along the buffer (read into buffer+size) or do the file operations on … | |
Re: You need to declare your object array like this: [code] typedef struct Object3D { int** facets; float** vertices; int nFacets; int nVertices; } Object3D; Object3D *object; // Object array int numObjects; // Number of objects in object array [/code] And the object array is accessed like this: [icode]object[nObj].nFacets[/icode] At this … | |
Re: We need [url=http://www.daniweb.com/forums/misc-explaincode.html]code tags[/url] and more explanation. | |
Re: You haven't associated the menu with the dialog. Add this line after the FONT line in the dialog definition: [icode]MENU IDR_MAIN_MENU[/icode] | |
Re: Write it to a string with sprintf (or wsprintf): [code] sprintf( buf, "Random Number: %d", random_integer ); MessageBox( 0, buf, ... ) [/code] | |
Re: It's quite a challenge decoding a binary file with an unkown format! In general, it's not possible. How do you know if the first two bytes are the characters AB or the 16-bit integer with decimal value 1106 (assuming an ascii representation)? You might want to view the file in … | |
Re: Can we see the function? Remember to use code tags. | |
Re: You could try a different IDE/compiler. MSVC++ defaults to unicode. | |
Re: WH: You're saying that the code below does not crash on your system? [code] #include <iostream> int main() { int matrix[512][512][512]; matrix[0][0][0] = 1; std::cout << matrix[0][0][0] << '\n'; } [/code] Assuming 32-bit ints, that's half a gigabyte! Removing the 3rd dimension works for me, but that's only a megabyte. | |
Re: The obvious thing wrong with your program is this line: [icode]pid = (int)getpid(); int ppid = (int)getppid();[/icode] You are defining another variable called ppid, shadowing the other one. You want to remove "int" before ppid. | |
Re: You want to look at [url=http://www.cplusplus.com/reference/algorithm/lower_bound/]lower_bound[/url]. It has the same complexity as binary_search (and also needs a sorted list). But it returns an iterator. | |
Re: > I am seeing 2:00 pm listed as "2:00 pm", '\0' <repeats 17 times> Is the size of the buffer 25? Those zeros are normal. But in general, you can't use strncpy like that. It will not null-terminate the strings. To use it as a substring operator, you must do … | |
Re: I don't know if the following image will show up, but you could maybe write something to guesstimate the number of galaxies in this little picture, but certainly not the number of start in a galaxy. You should check the assignment specs. [img]http://img147.imageshack.us/img147/1565/galaxies.jpg[/img] | |
Re: Your structure is wrong. Your main should be something like this: [code] int main (void) { /* Init count of words and count of palindromes to zero */ /* Open files */ /* While reading next word does not give EOF */ /* Increment count of words */ /* If … | |
Re: [code] struct WordCatch words[256]; unsigned char S[256]; unsigned char K[256]; unsigned char A[256]; // Alice's generated keystream char buffer1[100]; char buffer2[10]; char passwd[] = "5ne10nemo"; char temp[2]; int c, i, j, k, t, N, x, y, n; int wordCount = 0; int lineCount = 1; int beginning, ending, current; FILE … | |
Re: ddanbe> I would reserve more bit space for the mantissa. Maybe it's a "special purpose" trade off: massive range at the expense of precision. Purpose unspecified. ;) But the OP may be confusing mantissa and exponent. In the usual types, the mantissa always has more bits than the exponent. Here's … | |
Re: IDC_EASTERN_TIME is (presumably) an integer control id. You need an HWND to pass to SetWindowText. If you have an hwnd to your dialog (or whatever) window, try this: [icode]SetWindowText ( GetDlgItem ( hwndDialog, IDC_EASTERN_TIME ), cETime );[/icode] Also, cETime has too-little space allocated to it. It should be at least … | |
Re: This compiles, but there's got to be a better way. It's probably not generally worth it in this case. [code] #include <fstream> #include <string> #include <map> namespace sss { using namespace std; class node { public: multimap<string, string> values; multimap<string, node> children; }; typedef pair<string, string> value; typedef pair<string, node> … | |
Re: You do not need multi-threading for this task. Your program proceeds in lockstep because your I/O calls are of the "blocking" type and you are calling them without knowing that they are "ready". If they are not ready, they'll wait until something is ready to return. This includes fgets, which … | |
Re: You just want one call to [icode]srand((unsigned)time(0));[/icode]. Put it as the first statement in main and remove it from everywhere else (it's in two functions now). | |
Re: You may not actually want to wait in real time. You would normally do that only for a realtime animation of the process. It depends on what output you want. You seem to just want a line by line output of what happens after each input event. Each input event … | |
Re: You need to use [b]typename[/b]. [icode] for ([color=red]typename[/color] vector<T>::iterator it = x.begin(); it != x.end(); it++) {[/icode] |
The End.