15,300 Posted Topics
Re: >>int memcmp_test(const char *cs, const char *ct, size_t n) I think the first two parameters should be [icode]const unsigned char[/icode] because memcmp() can work with binary blocks of data and typcasting unsigned char to char might produce undefined behavior. | |
Re: Oh what a joy Microsoft compilers are to work with. One click of the [ key and I found the problem. Mismatched { and } on line 214. There is another one, but I'm not telling where it is -- that's for you to find. :) | |
Re: So what is the problem with that code, other than the obvious syntax error of missing closing } | |
Re: <<*A = *B; *B = *A; Looks like you are trying to swap the pointer addresses? Then you need a temporary holding pointer, and that function must return a pointer since that's how you declared it. [code] PointerA operator = (const& PointerA * C, const& PointerA *D) { PointerA* A … | |
Re: >>i'm gettin a compile time error : Lvalue required. which line? >>*ptr_1=ptr1; Probably cause an immediate crash. Why? Where does ptr_1 point to? It's undefined because it was never set to point anywhere. You can't just use a double star pointer like you are trying to do -- they don't … | |
Re: [URL="http://msdn.microsoft.com/en-us/library/aa363196(VS.85).aspx"]Did you read these articles[/URL] ? And this [URL="http://msdn.microsoft.com/en-us/library/aa363424(VS.85).aspx"]example program [/URL]? | |
Re: That for loop is incorrect. What you want is to read until either Max_Size has been read or until end-of-file [code] int i = 0; while(i < Max_Size && inFile>>array[i] ) ++i; [/code] | |
Re: use references [code] class MyClass { public: typedef vector<int> Vector; MyClass(); ~MyClass() {;} [color=red] Vector& [/color] getVector() { return m_vector; }; private: Vector m_vector; }; MyClass::MyClass() { m_vector.push_back(1); m_vector.push_back(2); m_vector.push_back(3); m_vector.push_back(4); } int main() { MyClass t; // This works... [color=red] MyClass::Vector& [/color]myVector = t.getVector(); for(MyClass::Vector::iterator itr = myVector.begin(); itr … | |
Re: To increment [icode](*ptr)++;[/icode] Compile and run this little test program and you will see what it does. [code] #include <stdio.h> void foo(int* n) { (*n)++; } int main() { int n = 0; int i; for(i = 0; i < 5; i++) { foo(&n); printf("%d\n", n); } } [/code] | |
Re: AFAIK the Express edition of that compiler doesn't support what you are attempting to do. I have never seen a menu option to add a data source. A couple years ago I used 2005 Pro version and it had that option. But I don't think the Express version has it. | |
Re: [URL="http://msdn.microsoft.com/en-us/library/ms646927.aspx"]This is what you are looking for[/URL] | |
Re: GetOpenFileName will put that information in your szFile buffer. And it should be declared and initializedlike this: [inlinecode] char szFile[_MAX_PATH] = {0}; [/inlinecode] | |
Re: what is that <> ? This compiled ok for me. all I did was removed the <> [icode]friend ostream & operator << (ostream &, const Nested &);[/icode] | |
Re: [URL="http://www.programmingforums.org/thread21843.html"]See here[/URL] | |
Re: >>It's urgent for me pls sir But it's not urgent for any of us. I could care less whether you pass or fail -- its your grade not mine. And we are not all men, so "sir" is inappropriate. Post what you have tried, or have you even tried to … | |
Re: >>pow(+1.0, n+1)/pow(n*n,2.0); How does (1/9) translate to the above equation? When [b]n[/b] = 1, the above will be [icode]pow(1,2) / pow(1,2)[/icode] which is 1^2/1^2 = 1. When [b]n[/b] = 2, we get [icode]pow(1,3)/pow(4,2)[/icode] which is 1/16 It looks to me your formula is completely wrong. How you get from (1/9) … | |
Re: [QUOTE=jephthah;857580]that's dumb. what if he wants to add 9999 as one of his numbers[/QUOTE] That's a common way to terminate user input, another is to type Ctrl+Z. If he needs to let the user enter 9999 then his program should choose a different number to terminate input. | |
Re: [QUOTE=serkan sendur;852365] Do you also think that unix and programming on unix sucks?[/QUOTE] Absolutely yes. I hate *nix because its just too damn complicated to get anything done. There are, however, a few features I like, such as shell programming, awk and sed. MS-Windows batch files aren't in the same … | |
Re: If you can its best to post the code that caused the error. | |
Re: Index would be similar [code] if(highTemp >= YrTemp[x][0]) { highTemp = YrTemp[x][0]; highIndex = x; // set index to be returned } [/code] | |
Re: what is [b]dnode[/b]? Where is it declared ? | |
A nuclear attack is perhaps the most real and immediate end of the world scenario. No monsters need to be thought up, no fiction created to make this apocalypse possible. [URL="http://apocaluck.com/"]Go here [/URL]to find out how you would fair in a nuclear attack. For me: Shockware: Shaken Head Blast: Roasted … | |
Re: The countNodes() returns one too many nodes -- Initialize [b]count[/b] to 0, not 1. | |
Re: I used Raima databases 20 years ago when I was writing MS-DOS 6.X programs. At that time Raima was a hierarchical database (non-SQL) and quite easy to use. Several years ago Raima expanded its product to an SQL database, but I have not used it. AFAIK its language is pretty … | |
Re: line 23: oops! that just lost the location of the memory that was allocated on line 13. You need to use a different pointer for incrementing and leave the original pointer unchanged. | |
Re: nice assignment, now what do you think we should do for you? | |
Re: you can use the macro toupper() to convert a character to upper case. If you have a whole string to convert then create a loop and convert each charcter [code] string str = "hello world"; for(int i = 0; i < str.length(); i++) str[i] = toupper(str[i]); [/code] In c++, an … | |
Re: You are almost done! :) All you have to do now is calculate the total points earned by the team and keep track of who earned to most points. | |
Re: I never knew music files could generate random numbers :icon_eek: | |
Re: [QUOTE=dailyearner;853857]what is it social bookmarking website?[/QUOTE] [URL="http://lmgtfy.com/?q=what+is+social+bookmarking+sites"]Read this[/URL] [URL="http://www.youtube.com/watch?v=x66lV7GOcNU"]Here [/URL]is one of the links that I though was really informative. | |
Re: use ifstream class for file input. Add it in your code then repost. | |
Re: its done like this: [code] class Camera { public: [color=red] Camera(Array2D& a): worldRef(a) {} [/color] ~Camera() {} private: Array2D& worldRef; }; [/code] | |
Re: That was over 2 years ago. Instead of complaining in the thread you should have reported it. The Dude did not have any rep altering power so the bad rep he gave you only put a yellow dot on your profile. | |
Re: Are not all the forums in the Web Development and Internet Marketing menus enough?? What more do you want that doesn't already exist ? | |
![]() | Re: you can not typecase char* to wchar_t* because wchar_t is a different data type, under MS-Windows its a short, but under *nix its a long integer. For string literals there is a macro in tchar.h [icode]address.streetAddress = _TEXT("Albareda 23");[/icode] |
Re: Swap the entire structure, not just the time [code] struct players temp; int a, b; for (a=0; a < 32;a++) { for (b=0; b<32-a-1; b++) if (world[b].best_time < world[b+1].best_time) { temp = world[b]; world[b] = world[b+1]; world[b+1] = temp; } [/code] | |
For some reason there is a line through the text "Game Development" menu -- see attached. I only find that when currently browsing the C++ forum. I'm using FF on Vista Home. Dani I suppose you could tuck this away for later when you aren't busy doing anything else :) | |
Re: >>Please do justify it with a small sample code Why? You already said you had written the class, so why should I bother? | |
Re: The program needs some way to keep track of the values and the number of times the values appear in the array. Then its a simple matter to find the value that appears the largest number of times [code] struct item { int value; int count; }; [/code] now build … | |
Re: seems to have been fixed because I don't see that behavior. I see that you are only in the rough just once. So you must have gotten out of the rough a couple times :) | |
Re: >>so I have no fear about using priate copies anymore\\ Oh I understand now. You can't stand killing an animal for food, but you don't have a problem from stealing the food out of someone else's mouth. Software piracy is theft. | |
Re: Have you studied your text book? Have you paid attention in class (or even attended them) ? That assignment is not for beginners, but more likely mid-term or later. If you do not know what a pointer is then you will not be able to complete the assignment. Same with … | |
Re: Seemed to work for me, after fixing a few things. I just hard-coded the strings because I didn't want to type them every time I ran the program :) [code] XXXXXXXXXXX X X XLX XJXXXXXXX X XXX X X XXX X SXXXXX X XAXXX X XXX XXX XXX X X … | |
Re: line 18: use the boolean operator == instead of the assignment operator =. | |
Re: [QUOTE=kbmmartin;854873] 1. I'm not demanding. I'm asking a history question By the way, I've programmed for over 30 years at HP and TI. I'm a part-time prof at a local university and I couldn't answer this question asked by a student.[/QUOTE] If that is true that you have programmed for … | |
Re: You need to fix all the errors before attempting to execute the program. Compile it with a C compiler instead of C++ -- most c++ compilers will compile files with *.c extension as C code, not C++. There were about 90 errors when I tried to compile it with VC++ … | |
| |
Re: No one gets rep points good or bad here in Community Center Forum. Only get the colored dot on the post; does not affect overall rep points. | |
Re: There is no such concept as "dereferencing and operator". Operators are like <, >, <=, /, +, etc. You probably mean dereferencing a pointer. [code] int n = 123; int* p = &n; *p = 0; // dereferencing a pointer [/code] |
The End.