- Upvotes Received
- 9
- Posts with Upvotes
- 7
- Upvoting Members
- 8
- Downvotes Received
- 3
- Posts with Downvotes
- 3
- Downvoting Members
- 3
62 Posted Topics
Re: step 1: learn base conversion step 2: learn c++ | |
Re: [QUOTE=tegaelam;1399200]Hi Gerard 4143, Thanks for responding, I'm still lost. It's my assumption that my line 26 that starts with for(int b=1..etc) is going to be the lets say "action line" for lack of a better word right now. I did a revision to my program from what I though you … | |
Re: Couple of things to note: 1. In your list constructor you need to link your head and tail, or the attributes are completely meaningless 2. When you add an element you need to link the head/tail node to the new node. Also code that appear in both the if and … | |
Re: Part c is asking you to make an initializer with the calss. ie. [NSString string] (which is equivalent to [[NSString alloc]init]autorelease]). It's testing your ability to create class functions. | |
Re: In didFinishLaunchingApplication you need to set your custom VC to the mainWindow's VC. You are not just not getting the tableView. You are not getting any view. | |
Re: @properties are instance variables with predefined getters and setters. When you define a property ie: `@property (nonatomic, strong)NSString *coffee;` xCode actually creates couple of things: 1. a instance variable `_coffee` 2. a getter for the instance variable - (NSString *)coffee{ return _coffee } 3. a setter for the instance variable … | |
Re: There are certain situiations where message call are perferred over dot notation. When using custom getters (same for setters) [obj getPropertyA] is more usefull than obj.propertyA because the formor is searchable. While you can search for "propertyA", you would find both getters and setters. | |
Re: Also %@ is for pointers. Which means any class that implements `- (NSString *)description` will have a meaningful output. | |
Re: Not to be overly picky but count is not a class method. `NSMutableArray *mArray = [NSMutableArray array];` `NSNumber *mArraySize = [NSNumber numberWithInt:[mArray count]]; //or mArray.count also returns the int` | |
![]() | Re: It would help to know what kind of errors you are getting and what methods actually work |
Re: Do you realize that in your main() you never actually call your A(int int)? that's why you are getting 0,0. | |
Re: Not an expert: but instead of checking for equivalence why not check for difference less than some val (1e-8)? | |
Hi gurus, this is a homework assignment on finding all closest pairs. I used a quad tree for my algorithm and its running time is compared to the naive algorithm. (I didn't use the java quad tree because I didn't know it existed...) My problem right now is that after … | |
Re: You can initialize your array to contain -1's and then just ignore them when you are reading the cards, or you can use ArrayList which is a mutable array. | |
I've been trying to code a link list in c and though it seems fairly straight forward I'm getting strange output. My link list nodes: [CODE] struct OBJECT { int Status; struct OBJECT *P_LINK; struct OBJECT *N_LINK; struct VALUE *P_VALUE; }; [/CODE] Link list [CODE] struct llist { struct OBJECT … | |
Re: This forum provide a very comprehensive intro to big-O notation: [url]http://www.daniweb.com/software-development/computer-science/threads/324685[/url] and when you analyze programs in T(n) = 4^(n-1)]/ 3 + O(n) it's called Taylor notation. Here are a list of lectures that will help you: [url]http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/video-lectures/[/url] | |
Re: In big-O notation constants doesn't matter. So is a program that makes 10 calls n times is O(n) such that if n=1 runtime =10 n=2 runtime = 10*(2) ... n=infinity runtime =10(infinity) //here 10 doesn't matter in the sense of big-O notation Also big-O notation assumes any constant multiplier so … | |
Re: Mine favorite line is: [code] for(a=1; a<=1; a++) [/code] | |
Re: In addition to csurfer's points, if the code compiles and runs but return the same un-sorted array you need to check how the quicksort() is called. Specifically the *& which is a reference/de-reference. Make sure the array is passed in as a pointer. | |
Re: why does it have to be an array? Having a size 0 array is really pointless since it'll always be size 0 since arrays are statically initiated. If you make a vector, then you can change the size dynamically and add objects later when you need. [CODE] vector <objType> arr; … | |
Re: have anyy of yyou considered that the original poster has OCD? Everyy time I tyype "yy" I have to tyype it twice. Everyytime. Mayybe the poster's got a "l" problem? | |
Re: p[c] is a memory address. What you want is the value of p at c. Try *p[c]=what you need. | |
Re: what's your problem? specifically which line is your code acting strange or crashing? | |
Re: [CODE] const int MAX_NAMES = 8; int nStudents = 0; Student student[MAX_NAMES]; [/CODE] you set MAX_NAMES to 8 and used it to make an array of size 8. Arrays are static, you can't change its size after you initialize it. If you want it to be dynamic look at david's … | |
Re: How would you like that packaged, and I can also submit it for you if it pleases you. | |
Re: Same problem except you are calling cin after getline() [url]http://www.daniweb.com/forums/thread327922.html[/url] | |
Re: The key is to read the lines from test.cpp into a vector then only write back lines that dosen't start with "//" and you need to do some thinking on "/*" and "*/". Also there is no reason to pass the 2nd parameter, you can do all the read and … | |
Re: your problem is switching between cin and getline(). Try: [CODE] int main() { int i; char * cstr; char * p; string *userInput; int sizeOfArray; getline(cin, sizeOfArray); //changed add(i,userInput,sizeOfArray); system("PAUSE"); return 0; //your main needs an int return val } void add(int i, string *userInput, int sizeOfArray) { string Input; … | |
Re: Can you give an example of your input and output? (what you expect and what you are currently getting) | |
Re: try [CODE] #include <string> [/CODE] string.c_str() is a method for a string, and has nothing to do with including the cstring | |
Re: try: [CODE] PlaySound(songLocation.c_str(),NULL,SND_FILENAME|SND_ASYNC); [/CODE] | |
Re: [QUOTE=Clinton Portis;1399210]would you like a side of fries with your order..[/QUOTE] "Please do not respond with liners" You should post the submission procedure so I can just do it for you. | |
Re: Another way to help you think about this problem. If you know calc then this will make more sense. Think about it this way. 1. you are on a number line, specifically a segment from 0 to 0.01 2. the idea is you are taking an infinite number of half … | |
Re: [QUOTE=mybluehair;1399111]I've got a chunk of code that opens up a txt file with 5 or 6 lines inside. I only need to grab the first line of the txt file and put it inside of a variable. The problem is that when I use this code, instead of grabbing the … | |
Re: >>search for data in super-fast constant time O (1) takes place. This is pretty hard to accomplish, unless you have a hash table. So if this is a requirement, then you need to implement a hash table. If you can do O(log n) you can use a sorted array, or … | |
Re: first put the list of your numbers in an array. 1. median: get array.size() [CODE] if (odd) median=array[size/2-1] //if size=3 return array[1] if even median=(array[size/2]+array[size/2-1])/2 [/CODE] 2.mean: [CODE] int mean; int sum=0; for(int i=0; i<array.size(),i++){ sum+=array[i]; } mean=sum/array.size(); [/CODE] | |
Re: if M1 has 5 titles in it your program crashes when it gets M1[5] because the 5 titles are in M1[0],M1[1],..M1[4] [CODE] for(int i=0;i<M1.size();i++){ if(M1[i].Get_Title()==T1){ M1.erase(M1.begin()+i); cout << "Movie deleted." << endl; TT++; } }[/CODE] | |
Re: it's only generating 1 column because you are using get() you need to use getline(). get() and cin are both " " delimiter. | |
Re: instead of line 39,40 why not just [CODE]return 0[/CODE] | |
Re: Please enclose your code in code-tag so it's easier to read. But have you tried; int counter=1; while{ cout>>counter++; } | |
Re: Please place your code inside (CODE). And you should have a parameter inside your Student class that keep track of it's classes, such as an array of size 5. Then you can call addcourse(Course course) inside your Student class, where you add new Course objects to the array. Hope that … | |
Re: If you have a program that's just a GUI then it shouldn't do anything. Since your program is crashing on the same "run" are you testing different things (your problem is on the 2nd thing you are testing) or are you testing the same function (mostly likely you are allocating … | |
Re: Does the problem only occur when you are running the program with the .txt file open? There might be write conflict, it's like the warning you get while trying to remove a file while it's open in a program. | |
Re: Please use code tag. And this is a problem[CODE]Int a[100], n, i, j, temp, loc, min ;[/CODE] I don't know if you can declare vectors and int's on the same line but I've never seen it done that way before. Also "Public: " should go before your parameter declaration. | |
Re: You have 450 lines of code! I suggest you try to tackle this problem step by step. 1. change your Node class so that it has a *prev of class Node 2. Implement constructor() everything is same except set start.prev to null. 3. implement add node(Node *currentNode, Node *nodeToBeInserted) here … | |
Re: Please reformat your code |
The End.