- Strength to Increase Rep
- +10
- 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
519 Posted Topics
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 | |
Re: 1 is kind of possible .... But it is messy Check out this piece of code [CODE]#include<stdio.h> #include<stdlib.h> struct student { void *subjects[15]; }; int main() { struct student s1; int numberOfSubjects; int i =0; printf("How main subject does the student have \n"); scanf("%d",&numberOfSubjects); for(i=0;i< numberOfSubjects;i++) { s1.subjects[i] = (int … | |
Re: Where is the value for no_of_msg_records being set ? Are you sure no_of_msg_records contains the correct value before the if statement ? | |
Re: Quick question ... Is you problem that you cannot read a 16 bit character or is the problem that you cannot use the toAscii function on a 16 bit character ? I think you might find [URL="http://cboard.cprogramming.com/c-programming/86250-problem-parsing-16-bit-hex-ascii.html"]this[/URL] link useful to read in 16 bit characters .... I do not think … | |
Re: @Narue How does the method described by you handle the case when the binary tree is not complete ie. Some of the intermediate nodes could have 0 (or 1) children | |
Re: Check out the sourceforge web site ... There you will see many operating systems in various partial stages of development ... Might make more sense / provide more learning to work on a partial os rather than start some thing totally new | |
Re: I second the books mentioned by yashsaxena . Both of the books are top notch | |
Re: You are repeating the same mistake on line 31 as well Avoid using similar sounding names for variables .grade/ grades .... are very similar. Invariably you will use grade when you mean grades and the program will crash | |
Re: What is the exact issue that you are facing ? Other things that may help you 1. Dont use feof . Read [URL="http://www.gidnetwork.com/b-58.html"]this[/URL] to know why . 2. Next time please use indentation when you write code / paste code. Its easier for us to read your code | |
Re: Suppose you did not have a client server program and you had to make a simple username/ password application on that, how would you go about that ? I have given you some hints in the code below. If you can fill out and complete this program then the extending … | |
Re: The for loop on line 50 can be reduced to [CODE] for(index = 0;index <i;index++){ // Your printing stuff here }[/CODE] | |
Re: Can you print the Output of the merge sort ? Also how many points are present in the input ? | |
Re: Can you explain the purpose of each argument in the movePlayer function ? Also what is the function getTitle supposed to return ? | |
Re: Can you look the C operator precendence tables for the operators *(dereference operator) and +(addition operator) ? Then look at the while loop you have written [CODE] while (!feof(p_file) && i < (size / 8)) { fgets(buffer, 8, p_file); (*p_clauses + i)->_var1[0] = buffer[0] - '0'; (*p_clauses + i)->_var1[1] = … | |
Re: What is the exact issue that you are facing ? FYI if you use google you will find lots of examples of linked list code all over internet | |
Re: Where are the printf statements in the code snippet that you have posted ? What does read Pattern data do ? | |
Re: In line 31 .... The way you are using the scanf is wrong [CODE]char arr[10] ={}; scanf("%s",arr); // This is the correct way of using scanf [/CODE] FYI scanf should be avoided as much as possible as it has many gotcha's. Its better to shift to fgets | |
Re: Dude no one is going to go through a 400 line code to find an error. I suggest you to post a smaller piece of code.... Just a random thought I think your issue could be a memory violation. | |
Re: You do not need to use the stl library to calculate the min / max . Try writing the code on your own .. Let me give you a head start For Min. 1. Create a temp variable and give it a value of 30,000 [or any such large value]. … | |
Re: The connect system call can be used to connect to a network interface ... (Assuming you know the correct IP address and port number) | |
Re: Ok .... What is the issue ? |
The End.