- Strength to Increase Rep
- +15
- Strength to Decrease Rep
- -3
- Upvotes Received
- 490
- Posts with Upvotes
- 396
- Upvoting Members
- 230
- Downvotes Received
- 12
- Posts with Downvotes
- 11
- Downvoting Members
- 9
1,288 Posted Topics
Re: nodeType *head = NULL; ... p=head; p->link=newNode; head is NULL, so p is NULL, so p->link does not exist. | |
Re: I don't see any code in the function readData that reads from the file edata.dat Start by writing a function that opens and reads data from edata.dat | |
Re: Rotate the mouse on your desk through 180 degrees. | |
Re: libcurl is a popular library for fetching web pages. Alternatively, just use the wget programme as part of a script to fetch the data, and then your C++ programme to operate on it. | |
Re: Wat is a card? It's an object that has a suit and a value from one to thirteen. So make a class named card that has two member variables; a value from one to thirteen (an int type springs to mind) and something to hold the suit value. Could be … | |
Re: If you're waiting for threads to finish, `join` comes to mind. http://en.cppreference.com/w/cpp/thread/thread/join | |
Re: &*raiz means "give me the address of the contents of the thing the pointer raiz is pointing to"; '&' is an operator. It's a bit silly, as by definition raiz itself equals the address of the thing it is pointing to. Saying "give me the address of the contents of … | |
Re: Where is the closing brace for the function `get_time_end`? Nowhere. That's where. | |
Re: https://www.daniweb.com/software-development/cpp/threads/499448/artificial-inteligence-system | |
Re: `char q1[0]` This makes no sense. Why is it this? it should be `char q1` Same for the others. `char a[0]={"b"}` This makes no sense. Why is it this? It should be`char a='b'`. Same for the others. `int k+1 ;` This is just completely wrong. It doesn't make any sense … | |
Re: If you want to store some kind of string, use a `string`. So those arrays of char arrays shouldn't exist. Just use an array of string. Or even better, a vector of string. `printf`? `scanf`? This is C++. Use `cout` and `cin`. What's going on with your headers? Are you … | |
Re: If those shared libraries aren't build with debugging symbols and you don't have the source code, there is no way to see the source code. Are they built with debugging symbols and do you have the source code? | |
Re: You're asking about a templated factory in C++. They start simple and go from there. Here's something to read: http://blog.fourthwoods.com/2011/06/04/factory-design-pattern-in-c/ If the only way you know what kind of object you want to create, though, is by reading a string, there's going to be no way around having to read … | |
![]() | Re: Your function `bruteforce`. I see that you set decrypt to be an empty string, so a string of size zero. You then start reading and writing to `decrypt[j]`. But decrypt is a string of length zero. Writing to the jth element of a string of length zero means you're writing … |
Re: By "binary" I assume you mean a string in which each character is a one or a zero. Read in a char. Output four chars depending on what that input is, according to this table: http://www.learn44.com/wp-content/uploads/2011/08/Binary-to-Decimal-and-Hexadecimal-Conversion-Memorization-Chart.jpg So AA would be 10101010 | |
Re: `if((int)strings_line_tokens[l][m] != 10 || (int)strings_line_tokens[l][m] != 0)` This says: `if (true)` There is no number in the universe for which this statement doesn't come out `true`. The first part comes out as true for everything that isn't 10. For the one case where the value you're testing *is* 10, the … | |
Re: `return naa, aL, S, aLot;` You can only return ONE value. Just ONE. As it happens, you're not even using the returned value. You need to learn about the following: returning values from functions passing by reference | |
Re: Neither of these are anything to do with "reading file error messages". `return` ends the function, and goes back to whatever called that function. The program continues running. `exit` finishes the program. Everything stops running, the program ends. They do different things. Neither is *better* that the other. They do … | |
Re: In C++, protection is at the class level. A member function of a class can access the private variables of *any* instance of that class. | |
Re: Is line 62 to 76 meant to be a function defintion? There's no opening `{` What's all that from line 81 supposed to be? Is that meant to be a function definition? | |
Re: `second = (P - int) * 60;` This makes no sense. What are you trying to subtract from the value `P`? | |
Re: `buffer` is a char pointer, so `sizeof(buffer)` is the size of a `char*`, which is typically 4 or 8. If you passed in the number 8, then we would expect to see eight bytes written. One char takes up one byte, so we'd expect to see eight characters. How many … | |
Re: #include <iostream> int main() { std::cout << "RESULT: Good"; } | |
Re: When you call free, you must use a pointer with the same value as the one that was given to you by the corresponding malloc. Here is how to copy a pointer so that you can keep one with the same value. In this sample code, `pointer` is the pointer … | |
Re: > Does this mean C++ is inferior to other languages in its ability to truly implement data-hiding?? There's no such thing as a superior or inferior programming language; only the right tool for the job, given all the circumstances, and if you go around using words like that you'll annoy … | |
Re: What does it do that you think it shouldn't do, or what does it not do that you think it should do? You have to say more than "here is a problem". As an aside, you're including C headers for which there are modern C++ replacement version, and some of … | |
Re: Read a pair on integers? int a, b; scanf("%i %i", &a, &b); Easiest homework question ever. This thread can now be closed :) | |
![]() | Re: Your number guess is wrong. You should be guessing a number from randRangeX to randRangeY. Instead, you're guessing from randRangeX to (randRangeX+randRangeY). |
Re: You have just reached the point where you are about to begin reinventing one of the standard tools of programmers; a Make tool. This, of course, is a good sign. I advise you very strongly at this point to take nobody's recommendation, including mine. Make tools are something that nobody … | |
Re: How much programming experience do you have, and with what languages? C++ is a low-level language; there are various definitions of what this means, but for the purposes of this conversation, it means that you have the flexibility and control to do an enormous amount with very few restrictions, but … | |
Re: > What if I write only cout instead of std::cout and all other streams? You already know the answer to this. Seriously, it's time to start thinking for yourself. | |
Re: This is not actually a programming question (or rather, to solve this by simulating the behaviour of the robot is a bad way to solve this). This is a simple maths question. Solve it on paper first. | |
Re: `intPtr.reset(ptr);` http://www.cplusplus.com/reference/memory/unique_ptr/reset/ | |
Re: Surely this is exactly what's expected. You create a unique pointer. You then construct another unique_ptr from that one, using the move constructor. So the original gets set to null. That's what happens when you move a unique_ptr. It's the whole point of a unique_ptr. Then you try to use … | |
Re: On line 23 you create a pointer. It is pointing at some random memory somewhere. On line 25, you pass a COPY of that pointer to the function initList ("pass by value" is the name for this - the function initList gets a copy of the parameter). This function uses … | |
Re: Do you have the libraries? They are files. They should be named libgd.so and libgd2.so If you do have the libraries, have you told Code::Blocks where those libraries are? http://www.learncpp.com/cpp-tutorial/a3-using-libraries-with-codeblocks/ | |
Re: str and end are pointers. while (str is pointing at memory somewhere before what end is pointing at) { make a temporary copy of whatever str is pointing at copy whatever end is pointing at into what str is pointing at move the pointer str along one copy that temporary … | |
Re: Also this: num1 is a pointer-to-an-int, so `*num1` is an int. num2 is a pointer-to-an-int. So `*num1 = num2;` has an int on the left, and a pointer-to-an-int on the right. It makes no sense. You're trying to assign a pointer (on the right) to an int (on the left). | |
Re: `if(a.arr==a)` This appears to be an attempt to compare an array of five ints with a custom made class named array. This makes no sense. As an aside, do not name your custom class "array". That's a terrible name, because it will make people (including you) think of it as … | |
Re: Every thread has a thread id. http://www.cplusplus.com/reference/thread/thread/id/ You could have a manager that keeps track of thread-singleton objects created for each thread; if a thread asks for one, and that thread_id already has one, give back the one already made. | |
Re: You have written too much code that doesn't do what's needed working. Bin it. Start again, and take each requirement in turn. I can see that some parts of it you have no idea about; you're just guessing at code to write ( `int choice1, choice2, choice` is completely useless … | |
Re: C++ comes with a sort function. http://www.cplusplus.com/reference/algorithm/sort/ | |
Re: I haven't double-checked what I'm writing here, but it seems very familiar. In C++ implementations, class functions are shared. Every instance of a class uses the same functions. When you call the function, you're not going *through* any particular instance. You're calling the function, and the function is given a … | |
Re: You're missing some braces. Each pair gets wrapped in braces. map<string, string> THE_SMS_CODES = {{".02", "Your (or my) two cents worth"}, {"10X", "Thanks"}}; Make sure your compiler is expecting C++11. | |
Re: This converts a string named input (which should be all ones and zeros) to a decimal integer. Remember to set your compiler to C++11 or later. `std::stoi` lives in <string> `int x = std::stoi(input, nullptr, 2);` | |
Re: You say it will remove the even numbers and zero fill, but it doesn't. At the start the array looks like this: `{1,2,3,4,5,6}` and at the end it looks like this: `{1,-1,3,-1,5,-1}` Even numbers not removed (but instead replaced with -1), array not zero-filled. The program does not do what … | |
Re: The C++ FAQ (new style) talks about this. https://isocpp.org/wiki/faq/exceptions#ctors-can-throw | |
Re: As an aside, when C++17 turns up, the filesystem library will allow something like this: `copy_file(source_path,destination_path);` Currently, you can make use of it through Boost. | |
Re: As a first draft brute force instrument, perhaps you're looking for the `usleep` function, to be found in the `unistd.h` header? http://unixhelp.ed.ac.uk/CGI/man-cgi?usleep+3 | |
Re: This function, `main`, is called by a different function. A function you don't know about, and you don't need to know about. That function, calling `main`, is expecting an `int` to be returned. So you return an `int`. When you understand how to code in C, and you understand what … |
The End.