1,288 Posted Topics
Re: This looks like some kind of Microsoft C++ variant. Managed C++, or some kind of C#, or some such. You might have more luck asking in that forum. | |
Re: Get log line. Check first two letter. If first two letters match the letters you're searching for, display the line. Using threads could make this slightly more complicated, depending on how you're providing the log lines. | |
Re: Don't use an array. Use a vector. Open text file. Fetch int from text file. push_back on the end of the vector. Repeat until done. | |
Re: > Now, the question is: When does it become necessary to allocate memory for an array? As programmer, you in effect have two kinds of memory available to you. The stack, and the heap. Anything you create without using *new* goes on the stack. All these go on the stack. … | |
Re: `Checkout_Simulation.h:27: error: cannot convert 'const char*' to 'Passenger<int>*' in initialization` This is because you're trying to assign a char\* to an object of type Passenger<NODETYPE>\* in your initialisation list, here: `Checkout_Simulation() : super_express("Super Express Counter 01"),` See there? super_express is a Passenger<NODETYPE>\* object, and you're basically trying to do this: … | |
Re: I would expect that `TextBox1->Text` is a string object of some kind. You cannot assign a string object to a double. You will have to convert the string into a double first. If you have a compiler that support C++11, there is a function for doing this: http://en.cppreference.com/w/cpp/string/basic_string/stof | |
Re: Also, line 23 is wrong. The remarkably similar (i.e. identical - better hope whoever is assessing this doesn't know about the internet) code at the end of this Powerpoint gets it right. http://www.letu.edu/people/jaytevis/Operating-Systems/Robbins/robbins-ch3-processes-in-unix.ppt | |
Re: > i just wanted the logic behind the question thank you very much. The input will be five numbers. For each number, calculate a new number according to these rules: If the entered number is less than two, the new number is SOMETHING. If the entered number is more than … | |
Re: Any string you create like this: "some words" is a *string literal*. The memory that those letters occupy is read only. This is part of the C standard; the rules of C. String literals are read only and you cannot change them. So when you do this: `char *str = … | |
Re: You need to start by thinking. How would you solve this *without* a computer. How would you solve it by just drawing on a piece of paper? You can't code the solution until you know how to solve it. ![]() | |
Re: What I see here is three classes defined. One class named invalidMin, one named invalidHr and one named invalidSec. I don't see any program to actually run, though. Where is your main function? | |
Re: Your function `search_for_free` sets `head` to NULL. So on the line in question, you call `allocate`, which then calls `search_for_free`, which sets `head` to NULL, and then you try to access `head->next`, and insta-segFault. | |
Re: std::begin is simply templated to use the container's begin, so there should be no difference. On line 20 you're trying to use a const iterator to change a value. | |
Re: The default values go in the declaration, on line 32. | |
Re: Not an alternate system; a way to make it easier to use the system you have. Put simply, if you want your operating system to show graphics, you have to ask it nicely. Your operating system, or the chosen window manager of your operating system, will have provided a number … | |
Re: How do you know it's finding the text file to open it? The textfile has to be in the working directory of the program that is running. This may well not be the same directroy as the source code, and it may well not be the same directroy as the … | |
Re: Helpful standard functions might be: http://www.cplusplus.com/reference/cctype/isupper/ http://www.cplusplus.com/reference/cctype/isdigit/ http://www.cplusplus.com/reference/cctype/islower/ | |
| |
Re: > sometimes 1 million letters Are you using windows? As I recall, the windows stack size default is 1MB, so a million letters will be too much to store on the stack and you'll have no choice but to use the heap (and I see you're using `int` values in … | |
Re: `str` is an array of `int pointers`, but you treat it as if it were an array of `int`. Is it meant to be an array of `int`? What are you using to compile this? Your compiler really should have noticed that and warned you. | |
Re: You're allowed one main function per program. Just one. You seem to be trying to put one in each file. This is very bad. | |
Re: http://stackoverflow.com/questions/20736731/fill-2d-array-random-ints-same-number | |
Re: It could be almost anything. This isn't a C++ question. Give up trying to install Visual Studio and use something else. There are many, many free options; as an added bonus, many of them are much easier to use and understand and learn from than Visual Studio. | |
Re: Get a long list of letters in the input buffer. Let's say the input is "abcde" and then "/r" because you press enter. First function gets the first letter, "a", then calls the function again. Second function gets "b", calls function again. Third function gets "c", calls function again. Fourth … | |
Re: Here is how to create an array: `datatype array_name[size_of_array];` | |
Re: On line 8, what are you trying to create? This: ` int intList` suggests you're trying to create a single `int`, with the name `intList`. This: `new` suggests you're trying to create some kind of pointer. A pointer is not an int, so creating an int and then trying to … | |
Re: You count from 1 to a hundred, and if the number is even you add it to your total. | |
Re: The for loop inyour FindMaxMin function makes no sense at all, and you never call it, and it seems to be buried *inside* your main function, and you've go ta semi-colon at the end of line 34 so you don't actually even have a findMinMax function - you've just got … | |
Re: You're asking how to *tokenise* a string. Now that you know what it's called, you'll be able to find all the resources you need. | |
Re: We won't simply do your homework for you. Show us how far you've got. Ask a question about something in your code you don't understand. You're going to have to do more than simply put the question up and hope we do it for you. | |
Re: > Can you guys recommend what could be probably wrong with my computer There is nothing wrong with your computer. This is what is meant to happen. You ask it to run a program, it opens a window to run the program, when the program is finished the window closes. … | |
Re: I think one of your fellow students already asked this question somewhere else. http://www.cplusplus.com/forum/beginner/156797/ | |
Re: http://www.cplusplus.com/reference/list/list/insert/ The program you're looking for is at the bottom. It inserts new entries into various places in the list. | |
Re: A vector of what? A vector of strings? If each string contains the server name in it, you can just remove every string that doesn't contain that name. | |
Re: You can make it easier to think about by pretending the number is between one and ten. The algorithm is identical. | |
Re: http://en.wikipedia.org/wiki/Connected-component_labeling | |
Re: If you don't write a copy constructor, you get one for free anyway. A very basic and simple one. In this case, all it will do is copy the pointer, `Buffer`. Let's think about what happens when you don't provide the copy constructor. First, a MyString object is created. This … | |
Re: I can't see your code from here, and neither can I see the compile errors you're getting. Maybe you should tell us the compile errors and show the code. | |
Re: Let's imagine that you entered 0 for hour, and 5 for minutes. Which of your if statements is going to be true? The first one. This one: `if(hour<12 && minute<10)` So we'll enter that block. Let's imagine that you entered 0 for hour, and 15 for minutes. Which of your … | |
Re: Tell me, after line 26 and 27 executes, what values do `mn` and `mx` have? | |
Re: You can't. You have to create a new file. | |
Re: Read every word from the file, and write it out to a new file. When the word you read in is the one you want to replace, don't write the original word; write your replacement word. When done, delete the original file and rename the the new file to match … | |
Re: You need to work out how you would explain doing it to someone who had no idea what you were talking about. For example: You're going to output lines of numbers The first line will be just the number 1. The second line will have two numbers in it. The … ![]() | |
Re: I would not call this C++. If I had to describe it, I might use the phrase "C++" but I would explain it's some kind of primitive, old dialect. Use proper C++ strings. Don't use char arrays. Don't use `conio.h`, unless the year is 1993 and you're coding for MS … | |
Re: > why not just compile the header files along with the rest of the library files? When you compile your code, the compiler has to know about library functions you are using. It has to know what they're called, and what parameters they accept, and what kind of parameter they … |
The End.