- Strength to Increase Rep
- +9
- Strength to Decrease Rep
- -2
- Upvotes Received
- 73
- Posts with Upvotes
- 67
- Upvoting Members
- 36
- Downvotes Received
- 52
- Posts with Downvotes
- 51
- Downvoting Members
- 13
Re: Learn this basic rule of putting brackets .... This will make coding less of a night mare Each time you introduce a new if/ for in a function press tab... For example [CODE] void func1() { for(;;) { if() { } } }[/CODE] | |
Re: Logically Incorrect void main as opposed to int main Unnecessary use of goto | |
Re: [QUOTE=Narue;1553385] Though it would be a good idea to support a generic mount point in your C code, because the mount point could change with USB devices: [code] # mkdir /mnt/usbj # mount /dev/sda1 /mnt/usbj [/code] [code] file = fopen("/mnt/usbj/file.txt", "a+"); [/code][/QUOTE] Can you please explain the effect of this … | |
Re: For those starting out to develop apps for iPhone check out the Stanford University Lectures on the same. The lectures are pretty descriptive and contain lots of examples. This the [URL="http://www.youtube.com/watch?v=xQzLHgls63E&feature=channel"]link[/URL] for the 1st lecture. You can find out the remaining lectures from the related videos tab | |
Hi Guys, I am trying to teach myself templates and I keep getting lost in all these compilation errors. Here is the latest // This is the interface for the base class template<class V, class I =int> class Array{ private: vector<V> myStore; public: Array(); Array(I size); Array(I size, V value); … | |
Hi Guys, I am trying to teach myself templates in C++. My current assignment is to create a matrix class by using vector of vectors. I have got most of it done but my code is crashing when I try to overload the random access operator in my matrix class. … | |
Re: Why dont you try coding one function at a time, compile it.. see if it works then go on to the the next function. It will make life a whole lot simpler for you.... Also learn to format your code.It will be much easier for you to read it | |
Re: Put a while loop in the calculate function.... Loop till left over amount has become 0. | |
| Re: Maybe you want to add the total points that the student has scored. Maybe you dont want to keep resetting the variable which is supposed to keep track of how many grades the student has got |
Hi everybody, Please excuse the noob question as I am new to STL in C++. I am trying to write a very basic program which uses iota. However my compiler is complaining that iota does not exist in algorithm. Some other forums suggested including <backward/algo.h> as iota could have been … | |
Hi Folks, Here is another noob question. I am trying to write a simple predicate for the find_if function in STL. Here is my code #include<iostream> #include<vector> #include<algorithm> #include<iterator> using namespace std; class InRange{ const int& low; const int& high; public: InRange(const int& l, const int& h): low(l), high(h){} bool … | |
Hello everybody, I am trying to teach my stl and after writing some basic programs I have hit a road block. I have an iterator which I am trying to pass to a function template Here is my function template template <class T> void display(typename vector<T>::iterator start, typename vector<T>::iterator end){ … | |
Re: I dont know if this is a stupid question, but if the language is not English then how do you expect to take user input ? Well I got the answer for my question.. Apparently key boards/ emulation software for non english languages are a common thing | |
Re: What part of file handling is confusing ? There are 4 basic operations 1. Read --> Read the contents of a file . Use fread for this 2. Write --> Write to a file . Open the file is write mode and then use fwrite for this. 3. Append --> … | |
Re: Why do you need the function swap big ? You do the usual if else thingy in the function reorder. Anyway you have pointers to the variables a,b,c as function parameter. You do the if else thingy and put the values in correct order in the variables if else. Some … | |
Re: I see that this thread has been marked as solved but I had a quick question for the OP. Did you handle the case when the Directory contained sub directories as well ? | |
Re: Can you add some log statements to the code to narrow down the location where the seg fault appears? | |
Re: I [B]prefer[/B] to pass arrays like this [CODE] void name(char *game, int length) { //your void function here } int main() { char game[4] = {'S', 'R', 'D'}; name(game,4) return 0; }[/CODE] | |
Re: Put a start time and end time before the start and end of the function. You should start seeing differences in speed of execution after the number of nodes in the tree cross a certain threshold. | |
Re: Even after you use fgets you will still have to use some if elses to check if the input violates the range restrictions | |
Re: What if the text file contains more than 8 characters before a \n is present? The program will try to store the 9 char at cmd[8] . This will lead to a crash | |
Re: Also your array contains 4 chars (A,B,C,D). Why are you running the loop from 0 to 6 ? | |
Re: I am not a 100% sure on this but I believe pointers work with logical memory. When a C program is compiled, the compiler works in such a manner that the program can be placed any where in the physical memory. I dont think that you can access a physical … | |
Re: I am sorry but I could not follow your problem statement. Can you please re word your problem statement in a more simpler manner | |
Re: Please post the complete problem statement .... I have no clue what was written in the "other guys" post and have no desire to go hunting for it | |
Re: Basically this problem is identifying "strings of interest" log / sin / cos / (x) You use the strtok function to identify the start and end of these kind of strings | |
Re: On line 44 I think both the operands have to be of data type int. I think num4 is of type float | |
Re: How about a small description of the problem for the people who do not have the K & R text book ???? From the code you have written I guess you are trying to count the number of spaces / tabs / new line characters in a sentence ? If … | |
Re: You are incrementing the x value only inside the if block ... I think you need to increment the x irrespective of the fact if the person is a smoker or a non smoker |