1,288 Posted Topics
Re: Do you mean it won't compile, or it won't link, or the IDE doesn't give you a nice tooltip? | |
Re: You will get a much better response if you improve your questions. Here is how you can improve your questions: 1) Show us the code. You already do this. Good. 2) Tell us exactly what input you type in. 3) Tell us what you saw happen, and what you think … | |
Re: `j = min(A,i);` At this point, the compiler is not aware of any function named min that takes an int-pointer and an int. cout <<"A.) Insert NEW Student Record."<<endl <<"B.) print all Student Record."<<endl; <<"C.) Sorting."<<endl; Take a good look at the end of that second line. | |
Re: You are using the same function, loadDog, to put data into all the four dog objects, so you are loading the Smokey data into all four. Perahps you meant to use each loading function once (loadDog, loadDog2, loadDog3, loadDog4). | |
Re: `head` is a pointer to a pointer to a store. So `*head` is a pointer to a store. So `*(*head)` is a store. So `(*(*head)).next` is the member variable next of the `store`. | |
Re: > but qstn is that why string is rejecting NULL at the end ? What does that mean? What do you think the string object g should contain after this: `g=s;`? What do you mean by saying it is rejecting NULL? I will explain what happens, and you can tell … | |
Re: Do NOT #include a cpp file. Do NOT. The problem here is that you don't understand what the compiler does, what the linker does, and how they work together. Every cpp file should get compiled, and then all of them get linked together. If you're using some kind of IDE, … | |
Re: Is there supposed to be something between that `-1` and `(exp(double (n)))`? While I'm here, why is it `(double(n))` and not just `n`? Given that `n` is already a double. Likewise line 11. | |
Re: If your code relies on the size of pointers, you're almost certainly doing it wrong. The whole purpose of pointer arithmetic is that it removes from you the need to know how big an object is, and to let the compiler handle it. Additionally, if you're using a void pointer, … | |
Re: This `c:\users\pauline medwinter\documents\visual studio 2012\projects\testerproj\testerproj\blank.c(33):` tells you that the problem is on line 33 of the file named blank.c (or just before it). We are not psychic. If you show us the code, we can tell you what's wrong with it. I'd *guess* you've got a semi-colon where you shouldn't … | |
Re: Open the file in the mode that appends new data on the end instead of overwriting the existing data. `outfile.open("database.txt", ios::app);` | |
Re: In the function `combination` buffer is of size zero. It is a string object that contains no characters. You then try to change the first character like this: `buffer.at(i)=input.at(i);` The first character does not exist so an exception is thrown. Does VS2010 let you get away with compiling this code? … | |
Re: Your errors are not due to problems with headers being recognised. If the header file was not recognised the error would be something like "cannot find header file". These errors are linker errors. That means your code compiled fine, which means the header files were found without any problem. What … | |
Re: > Should I manually release them as well? You *can't* manually release those. If you didn't create it using new (or malloc), you can't release it using delete (or free). | |
Re: `Shoe` is an array of 50 `shoe` objects. Is an array of 50 objects of type `shoe` the same thing as a single object of type shoe? No. Can you call a class function of the `shoe` class on an object that is not an object of type `shoe`? No. | |
Re: Are you sure you're fseeking to the right place to start reading the data? If you're missing the data at the start, perhaps you're going too far with the fseek. | |
Re: while(stillguessing == true); There is nothing in that while loop, so it loops forever. I expect you meant while(stillguessing == true) without the semi-colon | |
Re: The code will read in three numbers: `cin>>x>>y>>z;` If you type in four numbers, the code doesn't change. It works the same. If you want to be able to enter four numbers, change the code to accept four numbers. | |
Re: Here's something I wrote a long time ago: http://www.daniweb.com/software-development/cpp/threads/396591/c-pointers#post1701304 What you want begins around the comment `// need bigger array` That said, our pony-loving chum Deceptikon is right; you should use a proper C++ container, and if you want a proper C++ class specially made for char, look no further … | |
Re: Did you declare both of the function prototypes? | |
Re: This is some hideous code. You need to put a lot more thought into things *before* you touch the keyboard. Anyway, looks like you calculate the total cost of the order using the array `int takenorder [8];` That looks like a global array. Global values are, as a general rule, … | |
Re: `if (k == temp*)` This is testing that the object k, which is an int object, is the same as a temp-pointer. It makes no sense. Are you trying to test that the int k is the same value as what the pointer temp is pointing at? That would be … | |
Re: You're not changing D, E or F. They are zero when you create them, they are zero when you do this: `y = ((D * C) - (A * F))/((A * E) - (D * B));` so you ARE dividing by zero. You need to learn about "pass by value", … | |
Re: > If c = a * b, first test for a or b equalling 0 or 1. No overflow if either do. Now test that c > a and c > b? If not, overflow has occurred when using unsigned multiplication. If c is bigger than a and b, overflow … | |
Re: > When we want to access a column element i.e s[i][j] in pointer notation this becomes ((s+i)+j) Not quite. Multiply i by the size of the first array dimension. s[i][j] = s[(i*original length of first dimension) + j] | |
Re: Inside any function, anything you create on the stack (which is effectively anything you don't make with **new** or **malloc**) ceases to exist when the function ends. So the array you make like this `int upperLetters[26] = {0};` ceases to exist when the function ends. If you try to return … | |
Re: You've made it far harder than it needs to be. Essentially, you need to change the value of current balance 12 times. Something like this: `current_balance = current_balance+(current_balance * INT_RATE);` If you remove starting_balance and ending_balance completely you'll be making it a lot simpler to keep track of. | |
![]() | Re: Any text editor than makes just plain text files. Here are some things that would work: Notepad Notepad++ vim emacs |
Re: string someString("1234"); someString.insert(0,"0"); | |
Re: A char array is just that. Some char objects all next to each other in memory, typically with a zero value on the end. It is up to you to allocate it, keep track of how big it is, make sure you don't write or read off the end of … | |
Re: `memset(a,1,sizeof(a));` What were you expecting this to do and what did it do? If an int has 4 bytes (or 8 bytes), and you set the value of each byte to 1, what value will the int have? (The answer is not 1) | |
Re: What exactly is it that you don't know how to do? Looks like each pSrc points to the image to change, with each pixel taking 4 bytes (I'd guess RGBA), and you have to read those four numbers and turn them into one new number in the greyscale image. Looks … | |
Re: It's a bug in the compiler you're using. It has incomplete to_string support. There should be an update available from Microsoft. | |
Re: Is there a question, or would you like us to just point out everything that is wrong with this program? | |
Re: > However one of the functions doesn't have a length passed with the other parameters! > > `char arrayX(char a[], char v)` > > Where you are asked to find amount of times value (v) is in the array. What (almost) everyone said above is very true; if there is … | |
Re: > also will the answer be same even i declare the array dynamically?? That just means you don't know at compile time what size it will be, so the memory for it gets allocated during running. Once it's allocated, it's just an array like any other. There's no magic that … | |
Re: Has a class somewhere suddenly set a number of OpenMP assignments? | |
Re: > I want to know how it works?! This code: `someCondition ? someThingToReturn: someThingElseToReturn` works as follows - someCondition is evaluated. If it's true, then `someThingToReturn` is returned. If it's false, `someThingElseToReturn` is returned. So now that you know that, let's look at the condition. `x>='A'&&x<='Z'` So, this will be … | |
Re: getopt is a good idea. If it doesn't suit you, what you're trying to do isn't difficult; it just requires you to think carefully about how to actually parse the input. If the structure is to be something like: executableFile -a -b -c someFile -d etc. etc. the solution is … | |
Re: Do you mean in this line? `printf("Your current weight is %d pounds. You lost %d pounds. \n", weight, weightLostEasyWO);` That line will never be reached because the function returns before that point. Some of your other functions don't return anything at all, you've got int values trying to store what … | |
Re: In C++ they're called maps. A C++ map is one of the standard containers. The C++ FAQ contains this about objects of different types in a container: http://www.parashift.com/c++-faq/heterogeneous-list.html A common approach is to use the boost any library. That said, your example code above doesn't actually store different types. It … | |
Re: A better question to ask google is "what's the difference between code and data?" | |
Re: It is interesting to note the relationship between log(base 10) of an integer and the number of digits in that integer. | |
![]() | Re: Do you have a question? ![]() |
Re: When you need more than one of some object, and when you need to do something more than once. | |
Re: I'm with Ancient Dragon on this, but I go further; I generally recommend that beginners use a relatively simple text editor and they compile/link their code manually at the command line. The number of people who turn up, having been programming for a year, trying to fix an "undefined reference" … |
The End.