279 Posted Topics
| |
Re: You haven't posted the manifest file. Did you [icode]InitCommonControlsEx()[/icode]? | |
Re: Here's the list of [url=http://msdn.microsoft.com/en-us/library/ms645540(VS.85).aspx]virtual key codes[/url]. jencas makes a good point that I was wondering about myself. Still, give it a try and let us know what happens. | |
Re: You're going to have to give more info, and preferably less code. What (non-standard) libaries are you using? For example, is FGS_GetCurrentKeyCode() a library function? Also, what does this mean exactly: "once game is over then it is taking the values from keys". | |
Re: Check out post number 11 (by StuXYZ) in this [url=http://www.daniweb.com/forums/thread179430.html]thread[/url] (from earlier today). | |
Re: If "inlining the spezialized member functions" works, what's wrong with that solution? The only other thing I can think of (if I understand the problem) would be to put those functions in an object file of their own. | |
Re: [QUOTE=Bladtman242;803425]Why does that not work? :/[/QUOTE] It works for me. Did you put test.bat in C's root dir? Here's a rewrite that starts it from the desktop. [code] #include <windows.h> int main() { char path[MAX_PATH]; GetEnvironmentVariable ("HOMEPATH", path, MAX_PATH); strcat (path, "\\Desktop"); ShellExecute (0, "open", "test.bat", 0, path, SW_NORMAL); return … | |
Re: Alternatively to cin.ignore(...) and such tactics for consuming a leftover newline, you could use getline to read choice, thus not leaving any newlines in the input buffer. | |
Re: In essence your char array already has "hex" values in it, or decimal numbers or characters or however you wish to imagine them. Transferring them to another (unsigned char) array will not really change anything. You should post what code you have to clarify your question. (BTW, 0x03 is not … | |
Re: I'm not sure if this is what the errors indicate, but have you properly wrapped your C declarations like so: [code] #ifdef __cplusplus extern "C" { #endif int cfunc1( int n ); int cfunc2( int n ); #ifdef __cplusplus } #endif [/code] | |
Re: Prototypes go at the top of the program (usually). You have an extraneous semicolon at the end of this line which causes it to not control the next line as you expect it to: [icode]if(CompareStrings(text[i], text[i+1]) == -1)[color=red];[/color][/icode] Also, the indices you are using in the above line are entirely … | |
Re: You have to fill in the template to instantiate it: [icode]std::vector< foo< int, double > > bar;[/icode] | |
Re: Try [url=http://msdn.microsoft.com/en-us/library/ms683190(VS.85).aspx]GetExitCodeThread[/url]. | |
Re: The problem is that the OP has not yet written any code. This looks like code handed out with the assignment. BTW, shouldn't the tab size for displaying code on this site be 4, not 8? | |
Re: Open the file in binary mode: [icode]fp = fopen( filename, "rb" );[/icode] Read known structures and arrays with fread. Read bytes with fgetc. | |
Re: If you have done your program like above, but not run & edit program, then run & edit program, then ask specific question. And use code tags. | |
Re: You have a mismatch of the two declarations of add. Change: [icode] friend AltMoney add(AltMoney m1, AltMoney m2, AltMoney& sum);[/icode] to [icode] friend AltMoney add(AltMoney m1, AltMoney m2);[/icode] And change: [icode]add(m1,m2, sum);[/icode] to [icode]sum = add(m1,m2);[/icode] | |
Re: Your code is spaced all over the place. Mixed spaces and tabs? If your basic question is how to initialize reference members of a class, you do it like this: [code] class Class { /*...*/ }; class Class2 { Class& m_class_ref; //... public: Class2(Class& class_ref); //... }; Class2::Class2(Class& class_ref) : … | |
Re: The problem with your menu is that you're reading into a char but testing against an integer. Change gmOption to an int. I'd finish the rest of the program first before worrying about how you will integrate cheats into it. BTW, I'd make some consts for the colors, make the … | |
Re: So the prime number file is correct at school as well as on ubuntu? Only outputing to standard output (reading from the perfectly correct file) is not working??? I would've imagined that the numbers from the different children would get mixed up in the file if you don't use file-locking. … | |
Re: I don't see why it's a segfault, but you are using compare incorrectly. Remember that it returns 0 if the strings are equal, so you want to keep looping while it is not 0. You are doing the opposite, looping as long as the string IS "cls". You could just … | |
Re: Remember to always look for punctuation errors near the error line. Here you forgot the semicolon after [b]enum cmp_t[/b] (after the closing brace). | |
Re: Two obvious problems in countNeighbors: [list=1] [*] You are not bounds-checking (row or col plus or minus one may be out-of-bounds). [*] You are testing against true when you've loaded your "array" with '0' and '1' (i.e., change true to '1') [/list] Other than that you need to post all … | |
Re: Try g++ (c++ compiler) instead of gcc (c compiler). | |
Re: Think about it for awhile, then check out [url=http://en.wikipedia.org/wiki/Binary_search]wikipedia[/url]. | |
Re: Binary trees have 2 branches (max) at each node. To store an arbitrary number of links you need an expandable data structure, like a vector. | |
Re: > it takes so much of time to find a number greater > than searching number That's the heart of the problem. How do you decrease that time? You definitely don't want to do a linear search! I guess I understand the "infinity" stuff. It means that you can access … | |
Re: First of all, this is an excellent effort and an interesting program. Here are some suggestions. [list] [*]Give the user the option to go again. [*]Use C++ style includes: cstdio, cstdlib, etc. [*]Never let a line go over, say, 78 columns. (Definintely not over 80.) [*]Splitting string constants across lines … | |
Re: Try making [b]hWndCurrentTime[/b] global. Then change [b]strCurrentTime[/b] (in ThreadTime) temporarily to "xyz" and see if it displays. If not, then you'll need to do what AD suggests. | |
Re: Depends on the format of the matrix in the file. Is it text or binary. If it's text, can you cut and paste it? | |
Re: I think it's just the X in your input file (should be a 1 maybe?). Your expected output is unexpectedly short, having only nine members. | |
Re: [icode]err = execve ("./server.c", param, 0);[/icode] You are trying to run the C file! You have to run the executable. | |
Re: You do not want to free temp there. Remember that you do not free pointer variables, but the memory that they point to. In this case, you do not want to free the memory that temp points to because you still have a pointer (*head) pointing to it and the … | |
Re: IVR: "Interactive Voice Response" But what is a "car dial"? How much C do you know? | |
Re: You need to clear the flags before the seek. [code] file.clear(); file.seekg (0, ios::beg); [/code] | |
Re: There does not seem to be anything wrong with your code. In particular, I see nothing that can cause an exception in what you've posted. | |
Re: Splitting hairs somewhat further, a better formatting for the printf with the long string is: [code=C++] printf("\nYou have entered an invalid integer.\n" "Please enter a number smaller or equal to 20:\n"); [/code] String literals separated only by whitespace are concatenated by the compiler. A useful fact. | |
Re: Inside the class, "a" is really just a pointer variable, which is usually the same size as an int, so that's why you get one. Outside the class, "a" is a 3-element int array, so that's why you get 3. Remember that C++ does not automatically know the size of … | |
Re: [code] char buffer[100]; ifstream f; f.open ("pic.bmp", ios::binary); // skip header f.read (buffer, 54); // read 8 bytes into buffer f.read (buffer, 8); [/code] | |
Re: Thr program still has a bug, though. You are not zero-terminating the c-string "rev". The best way is perhaps: [code] int i, j; for(i = 0, j = strlen(word) - 1; j >= 0; i++, j--) rev[i] = word[j]; rev[i] = 0; // zero-terminate rev [/code] Note that I changed … ![]() | |
Re: Since key_c_xor is an array, it needs an index: [icode]key_c_xor[color=red][j][/color] = userKeyArray[t]^C[i];[/icode] | |
Re: You would just do this: [code] void CharArray(unsigned char* arr) { ... } int main() { unsigned char arr[3]; CharArray(arr); } [/code] [quote]Which is the most modern (ie c++) way to do this?[/quote] C++ is over 20 years old. | |
Re: This is looking more and more like homework. Where did you get the main from? | |
Re: It's saying that you can't delete the original "b" anymore because you've lost it's address by assigning a to b, which overwrites the previous address that b was holding. So the last line frees the original a, since b now points to a. | |
Re: I see you TRIED to use code tags. Good effort. I'm not sure why they didn't work. Here's your code with the undeclared identifier errors fixed. It probably doesn't work correctly (I didn't bother to check that) but at least it will run for you. [code] #include <stdio.h> int askflight(int[]); … | |
Re: Presumably it's something under the Project Options: Compiler tab. Perhaps try setting Linker: Strip Executable to yes. | |
Re: You are missing a quote (in red): [icode]cout<<"VectorA ^ VectorB = " (VectorA^VectorB)[color=red]"[/color]<<" = "<<(VectorA^VectorB).Magnitude()<<endl;[/icode] | |
Re: LTIME must be either 12 (for hours) or 720 (for minutes), it cannot be 12:00 since that is not a proper C constant. Since you are implying that Tcorr is minutes, make LTIME 720. Then if you need the time in hours and minutes: [code] hours = stime % 60; … | |
Re: Also note that you have to use radians (not degrees) for your angles, so [icode]pass = 2 * M_PI / vertex[/icode] (M_PI is in math.h) . |
The End.