- Strength to Increase Rep
- +15
- Strength to Decrease Rep
- -3
- Upvotes Received
- 399
- Posts with Upvotes
- 343
- Upvoting Members
- 225
- Downvotes Received
- 17
- Posts with Downvotes
- 16
- Downvoting Members
- 15
I'm 29 and currently learning c++. I like doing mathematical computations and working on encryption methods. Now I am currently learning how to use Whittmann Robots.
- Interests
- C++, math, football (American), music (not country), playing with my god kids
- PC Specs
- Intel i5-2500k 3.3 Ghz processor, 16 GB DDR3 1600 ram, 1 GB Video PCIx2.0 x16, 2TB HD, running Windows…
Re: @takuya17 - Please don't resurrect dead threads with something completely unrelated. If you want to contract a coding job you need to do so under the Jobs and resumes section in business exchange. | |
Re: Please don't resurrect dead threads that have already been answered. | |
Re: in your if statement when you are outputting your picture of the hanging man you are using a \. with c++ that is an escape character and is used for special purposes line \n for newline. in order to output a single \ to the screen you would need [icode] … | |
Re: Can you paste about 10 lines or so from the file into here. Does every column value have a "," after it or does each line end with a newline? Generally with a CSV file if there is an empty column it is represented as ",," but I don't see … | |
Re: Right off the bat from your code you need to put `int GetanInt();` before your main function so that the compiler knows there is a function called GetanInt() somewhere. Secondly you have a semi colon after your function name on line 17. There could be more but thats right from … | |
Re: using standard code you could do the following char choice; do { // your code goes here std::cout << "Do you want to go again (y/n): "; std::cin.get(choice); } while (::tolower(choice) == 'y'); | |
Re: You might be able to use a [`std::mutex`](http://en.cppreference.com/w/cpp/thread/mutex) for this. You might also want to rethink your data structure. You could have all of the thread writing to a [thread safe queue](https://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html) and the reader could be processing it at the same time. This might make your execution faster. | |
Re: What you have right now is a sigle letter. If you want to use a c-style string you need to define wrd like `char wrd[80]` where 80 is the number of charactures max that it can hold. You can change 80 to be what every you want but you want … | |
Re: Okay. What do you have so far? Do you know how to use for loops? Do you know how to use a char vareiable? | |
Re: Well if we use integer math then the answer would be #include <iostream> int main() { std::cout << 1; std::cin.get(); return 0; } | |
Re: http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list | |
Re: For three integers you can hardcode it fairly simply as int a, b, c; std::cin >> a >> b >> c; int positiveCounter = 0; int negativeCounter = 0; if (a < 0) negativeCounter++; else positiveCounter++; if (b < 0) negativeCounter++; else positiveCounter++; if (c < 0) negativeCounter++; else positiveCounter++; … | |
Re: Derived classes only need to construct the classes the directly derive from. If those classes derive from something else then it the responsibility of those classes to construct what classes the directly derive from. Take the follwing example class Foo {}; class Bar : public Foo { public: Bar() : … | |
Re: Memeber functions are members of a class. Because of that they are not the same as free functions when it comes to function pointers. void (*ptr)(void); Will match any function that returns void at takes no parameters that is not a memeber function. void (A::*ptr)(void) Will match any function that … | |
Re: What is your question? 26,760,055 bytes is only 26.7 MB which is not very large in todays world. | |
Re: As [Bjarne Stroustrup](https://en.wikipedia.org/wiki/Bjarne_Stroustrup) has said >**C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg.** | |
Re: The first issue is your comparison operator is not folowing the strict weak ordering that `std::set` requires. You are only comparing `L` when you need to check if the `L`'s are equal and if they are then comapre against `r`. bool operator<(const _point &a)const { if (L == a.L) return … | |
Re: Um 1, 4, 6, 12, 15, 20, 30 and 60 are not prime factors. the prime factors of 60 are 2, 2, 3, 5. You can prove that since `2*2 = 4` and `4 * 3 = 12` and `12 * 5 = 60` | |
Re: Why are you looking for spaces in a csv file? csv stands for comma seperated values. Your file should look like 1.1,1.2,1.3 2.1,2.2,2.3 ... | |
Re: You could do this fairly easily with a `stringstream` and `getline()`. The split function would look like: std::vector<std::string> split_string(const std::string & line, char delim = ' ') { std::vector<std::string> sep; std::string token; std::stringstream ss(line); while(getline(ss, token, delim)) sep.push_back(token); return sep; } And then you could use it like int main … | |
Re: I will have to agree with @Suzie999 on this. Once you get into the mindset of using `const` whenever you have a constant value then you should just keep on using it. Not only does it keep the that behavior front an center but it is someting you should always … | |
Re: More than likely one of the headers that you are including in your code is including that header. This is something you should **NOT** rely on. You should explicitly include all headers needed to compile your code and not rely on something else including it for you. A different compiler … | |
Re: You are not allowed to define a function in a function and that is what the compiler is complaining about. There are two solutions to this. You could move the function out of main and put it in the global scope or you can change the function into a [lambda](http://en.cppreference.com/w/cpp/language/lambda) … | |
Re: @nullptr you should really be using a unsigned char as any other value is UB. http://en.cppreference.com/w/cpp/string/byte/tolower | |
Re: reading the answer [here](http://stackoverflow.com/questions/696117/what-happens-when-you-close-a-c-console-application) it looks like you can register an event handler with the OS and handle the closing of the cmd window youself. in the closing routine you could cleanly close out the API so it usable the next time. | |
Re: And the reason you posted this again instead of using the wonderful advice Moschops gave you? If you need to follow up with you question please use: https://www.daniweb.com/software-development/cpp/threads/498358/game-on-c- | |
Re: As Moschops said you are moving the data from `p` so trying to use it after that results in your segfault. `std::unique_ptr` doe have an `operator bool()` that will return `true` if `get() != nullptr`. Using that we can protect against using the pointer if it no longer manages a … | |
Re: Silly question but can't you have your teacher explain what you should have done not to have points taken off? It is hard for us to know what he is thinking. | |