- Strength to Increase Rep
- +4
- Strength to Decrease Rep
- -1
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Re: I think you need to #include <stdlib.h> Good Luck! | |
Re: If your code has a lot of pointer stuff in it, it's often a good idea to run "valgrind" every once in a while to check for memory leaks. It's often a good idea to create some sort of "debug output" function for a class to print its state. That … | |
Re: Here's some really general advice: Do a project that builds on something you learned in one of your Software Engineering courses. Use design patterns, good programming style throughout .etc Pick something you like so you don't end up dreading the project. | |
Re: Oops, misunderstood your problem. This post can be deleted. | |
Re: Other than adding the "&" to the scanf statement . . . Why do you do the following loop? [CODE] while(x<=num) //Checks the numbers for their status { detect(num); x++; } [/CODE] If you want to check all numbers between 2 and num, then you must detect(x) rather than detect(num). … | |
Re: Look up the "bubble-sort" algorithm and/or the "selection sort" algorithm. These are the easiest to understand sorting algorithms IMO. Once you know the algorithms, implementing them will be easy. Good luck! | |
Re: You need to pass the address of "num" to scanf using the & (address of) operator. This allows scanf to actually modify the variable "num". Like this: [CODE] /* Fixed input*/ scanf("%d", &num); [/CODE] Good luck! | |
Re: First of all, for file I/O, read a good tutorial on file streams (and streams in general). Just check [URL="http://www.google.com/"]Google[/URL]. You should know how to define a function already. Here's an example just in case: [CODE] /* Sample function that adds two integers */ int add(int a, int b) { … | |
Re: You could simulate some sort of community of simple creatures (like ants or bees.) The creatures would need food to survive, and would need to reproduce .etc Interactions between the creatures could communicate location of food and shelter. For fun, you could add in some sort of fighting mechanism where … | |
Re: Yes, that is easily possible. Just use a pointer to a pointer. Basically, in the same way a pointer can "point" to a piece of memory that holds some data (like an int or a char), a pointer can "point" to another pointer. Basically, you pass a pointer to a … | |
Hello! I'm wondering how to go about packing data from an std::vector<unsigned long> into valid unicode (UTF-8) characters. So far, I've tried writing the unsigned long data directly to a text file, but that usually results in invalid characters. (I don't actually need to store the data in unsigned long … | |
Re: Try checking cin.fail(). If it is true, something went wrong with the input operation. Good Luck! |