1,288 Posted Topics
Re: Not quite. `CMyAxUICtrl` is the name of a class. To use this function, you would have to create an object of the class type first: `CMyAxUICtrl beansOnToast;` and then use the function in that object `beansOnToast.OnDraw(param1, param2, param3);` If I had to guess, I'd say that OnDraw is probably called … | |
Re: First you create an `int`, named `v`, and give it the value of 10. Then, you create an unnamed pointer to v, like this: `&v`. You pass that unnamed pointer to the function named `afunction`, which gets a copy of that unnamed pointer. Inside `afunction`, you give that copy of … | |
Re: Compiles fine over on IDEone; http://ideone.com/v4rWio | |
Re: `a = new int [i][j];` What's the value of `i`? What's the value of `j`? | |
Re: `len=strlen(input);` `input` is a char. A single char. The function `strlen` takes a char\* parameter. You cannot use a char instead of a char pointer. Did you really mean to read just a single character from the input file? | |
Re: There doesn't seem to be a `main` function in this program. I'll guess that you do actually have `int main()` before line one, above. When I run it, it does this: 0.00 16.96 23.78 9.85 18.34 Do you not get anything out? Your code has one problem; when you start … ![]() | |
Re: ` class PString :: public string` ONE colon here for inheritance. `void bool isPalandrome();` Does it return void, or bool? Pick one, and also fix the spelling; later, you name this function isPal**i**ndrome. ` lower++` Missing semi-colon `class PString::isPalindrome(bool)` The first word here should be what kind of object this … | |
Re: Some of this makes no sense. You've got a queue of strings, so what's that array for? When you delete a name from the queue, you're showing the user somethig from the array? Why? Get rid of the array and just work with the queue. | |
Re: http://en.wikibooks.org/wiki/C_Programming/Simple_input_and_output | |
Re: Look at each char in the input string. If any of them are digits (`isdigit`), disallow. | |
Re: Are you trying to use iostream or iostream.h? Show us the code that doesn't work. | |
Re: What do you mean by "matrix", what do you mean by "remove"? | |
Re: I expect it can't find the file. Is the file in the same directory that your program is running in? This is often not the same thing as the directory your source code is in. Test that the file is found correctly. ifstream filestr; filestr.open ("test.txt"); if (filestr.is_open()) { filestr … | |
Re: When you do this `Dynque<string> queue;` your constructor calls this `clear();` which then calls this `dequeue(value);` which then tries to do this `val = front ->value;` but front is pointing at some random memory somewhere that doesn't belong to you, so you get a segFault (the OS won't let you … | |
Re: template <typename DATA> struct node{ node <DATA> * left; node <DATA> * right; DATA data; }; That makes no sense. A node needs to point to another node, not to a DATA. | |
Re: You've only got one list. You need to have TWO lists, and copy the data from one to the other. | |
Re: The file named `QApplication`. Your compiler can't find it. First check that you did install the QT libraries, and check where that header file was installed to. When you find it, ensure it's on your standard g++ include path. If it isn't, you'll need to add it to the g++ … | |
Re: Which lines again? We see the line numbers HERE, on the forum. Do yourself a favour by doing US a favour and make sure the line numbers you quote are the line numbers we see. Have you investigated this? Perhaps your function calculate could output the value of each variable … | |
Re: > they are different things? They are different things. | |
Re: C++ programs begin at the function called `main`. You don't have a function called `main`, so you can't make this into a program. Are you trying to make a program or a library? | |
Re: This being C++, we prefer cstdio. #include <cstdio> int main() { char c; std::scanf("%c", &c); std::printf("You typed %c", c); } As I recall, the C++ standard promises the functions will be in the std namespace, and they may also be in the global namespace. | |
Re: Give the *complete* path in the parameter `filename`. | |
Re: You can only use `delete` on a pointer if the memory it points to was allocated by `new`. | |
Re: This is a terrible use for a static data member. That said, someone gave you code already in the other thread. | |
Re: > I can't get the code to display in an ordered list. In that screenshot, at the bottom, it is sorted. What don't you like about it? | |
Re: How far have you got? Are you having trouble with the thinking (ie. coming up with the solution in a series of programmable steps) or are you having trouble with writing the code for your solution? | |
Re: ` other=&List;` This line makes no sense. `system("pause");` system lives in the cstdlib header. `void ListIterator<T>::setData(const T value){list.setdata(current,value); current++;}` setdata does not exist, but setData does. `ListIterator(const List<T> &l): list(l), current(0) { }` Drop the const. | |
Re: In this case, when you do this: `if(str=="hello") ` on the left you have a `pointer`, and on the right you have a `pointer`. The value of a pointer is the number it holds; a single memory address. So the value on the left would be something like 0x0324FEED (a … | |
Re: You're trying to pass the function an int (i) and a pointer-to-extPersonType. It doesn't want a pointer. It wants the actual object. Don't give it a pointer-to-extPersonType. Give it an actual extPersonType (or change the function so it takes a pointer). | |
Re: > Ideas? As Rubberman says, if you want it to output something, you'll have to write some code for that. It won't do it by magic. I see you already know how to use `cout`; that'll do fine. | |
Re: > How do I show spelling mistakes on the console? Should I highlight the text that has the spelling mistake? Up to you. If you want to manipulate the console in that way, you're going to have to read up on how your console works (which is heavily system dependent … | |
Re: This is almost trivial. You wasted more time asking than just doing it. http://www.cplusplus.com/doc/tutorial/basic_io/ | |
Re: C++11 comes with a `shared_pointer` template that could be used here, I think. You'd need to create the `shared_pointer` with a custom deleter parameter so that `delete[]` is called rather than `delete`. You return the shared_pointer, and when it falls out of scope at the caller, the array is deleted. | |
Re: Line numbers for the errors, please. | |
Re: You're trying to use the `+` operator with objects of type `RomanType`, here: `Rom3 = Rom1 + Rom2;` but the code for that operator is commented out. For starters, uncomment it. You've got code for that operator on the `extRomanType`, but your code doesn't ever use objects of that type. … | |
Re: I got turned down for a job once for giving that as a way to swap two values without using a temp value. Too much of a liking for "elegant cleverness", apparently. | |
Re: Two pigs in a barn: [CODE]#include <iostream> int main() { using std::cout; cout << "Eggs eat stonks" int a = 65; int b = a/3; }[/CODE] Wait, what are the rules of this game again? | |
Re: What makes you think the second array isn't one bigger? Maybe if you displayed all six elements in the second array, instead of just five, you'd be able to tell if it worked. | |
Re: Definitely when the target system has a C++ compiler but no Java support. | |
Re: The short answer is no. If you need to examine all elements of the container without removing them, a queue is not what you need. Consider a deque instead. | |
Re: `BST*binary_search_tree;` This is an attempt to multiply BST by binary_search_tree. Did you mean that? | |
Re: Do it one piece at a time. Start with this: Write a C++ program that would display the menu of a restaurant | |
Re: What's a manufacturing problem? QT presents a broad range of examples: http://qt-project.org/doc/qt-5/qtexamplesandtutorials.html | |
Re: I saw something similar once; a value was being cached locally, and then the memory storing it was being trashed. Because the value had been cached, it didn't matter that the memory had been trashed - the cached version was used. Inserting another variable meant that the cache was being … | |
Re: When you `#include iostream`, you get the object `std::cout` That is, you get the object `cout`, which is in the std namespace. You can use an object in the std namespace either directly: `std::cout << "Something";` or by stating that you want to use that particular object like this: using … | |
Re: "QT" is just the name given to a set of libraries and related. The OP is not coding in "QT"; they are coding in C++. I suspect that the OP has downloaded QT Creator and thinks that QT is some kind of separate programming language. It is not. You're coding … | |
Re: When you store each character in the file, change in first. When you read each character back from the file, do the reverse change. | |
Re: Off the top of my head, create a vector<string> object, store every line as a string in the vector, add the strings A, B, C ... Z, use the standard algorithm sort function on the vector, and you've got a sorted vector<string> with A, B, C ... Z as you … |
The End.