104 Posted Topics
Re: You are kicking off December! :P Check [ICODE]if(m<=0 || m>=12)[/ICODE]. It should be [ICODE]if(m<=0 || m>12)[/ICODE]. Also check your leap years handling. | |
Re: I don't know if it's old, but it makes me laugh every time I even [b]remember[/b] it... [URL="http://media.funlol.com/content/img/lemon-suicide.jpg"]Lemon Suicide[/URL] | |
Re: The amount of people that'll help you is somehow proportional to the effort you'll show, not to the number of [URL="http://www.daniweb.com/forums/thread160149.html"]threads[/URL] you'll open. I'm less than a novice with this area of programming, but I found [URL="http://www.linuxhowtos.org/C_C++/socket.htm"]this[/URL] to be interesting and helpful - you may as well start there. | |
Re: Check your variable typing (i.e. Max_Lines instead of Max_Line in line 66 but I also read countAlpha instead of alphacount elsewhere). Also, you should pass lines as argument to the function displayTable. You have an out-of-boundaries access for your lines array - be careful how you play with [ICODE]size <= … | |
Re: [QUOTE=khatib009;747547]can someone please be willing to help me with this code..i am willing to pay thank you[/QUOTE] LOL, what code?!? well, if you're not lazy beyond hope of recovery... :P Some people (me included) could feel offended by posts like yours - being offered money for what? homework? Try to … | |
Re: [QUOTE]I will remember you forever![/QUOTE] Seriously, how much do you think we care? Moreover, I hardly think so. I'm pretty sure that you won't hold gratitude or appreciation soon after you'll hand that assignment. Not that I'd pay a penny for you being eternally grateful to me. Ancient Dragon already … | |
Re: You have extra parentheses: write this [CODE=C++]if(strcmp(a,b) > 0) && (strcmp(a,c) > 0)[/CODE] like this[CODE=C++]if(strcmp(a,b) > 0 && strcmp(a,c) > 0)[/CODE] | |
Hi all there. I was given the task to implement a Subset class with a few function. It should be structured so to contain the original set and make it possible to generate all subsets. Right now I'm focusing on the "generate all subsets" part. I've done a little searching … | |
Re: I think that in line 89 you should put [ICODE][i][/ICODE] after your usagekwh array in the cout statement. Just had a first glance at your code though. | |
Re: a is not a char, is an array of char. you have to print its component one at a time. | |
Re: You are missing semicolon [ICODE];[/ICODE] after your class' closing bracket and the assignment [ICODE]name = "Player";[/ICODE] should be [ICODE]strcpy(name, "Player");[/ICODE] | |
Re: As a start: [CODE=C++]struct student { std::string name; char gender; int CGPA; };[/CODE] and then access the members like this: [CODE=C++]int main(void) { student myStudent; myStudent.name = "Sarah"; myStudent.gender = 'F'; myStudent.CGPA = 1; // or whathever }[/CODE] | |
Re: [QUOTE]Open the file "raw_points.txt" as an input filestream. Open the file "normalized_points.txt" as an output filestream. Read in the count of how many points there are from the input file. Write the count out to the output file (with an endl) and then repeat the following that many times[/QUOTE] 1) … | |
Re: You should write your B class like this: [CODE=C++]class B { A *ob; };[/CODE]and then in B constructor add [ICODE]ob = new A(5);[/ICODE] I think you can't call constructors from within a class declaration. | |
Re: Sorry, I read only the last 3 posts - but shouldn't it be [ICODE]d.rope();[/ICODE] as well as [ICODE]d.head();[/ICODE] ? And you don't want [ICODE]draw::draw()[/ICODE], as VernonDozier already said. Just [ICODE]draw d;[/ICODE] | |
Re: I think the question is: "are you able to read [b]this[/b]?!?". I'm sorry, I'm not :( ... | |
Re: If you are making a complex class you should return a complex object, and it should not be the first operand. I mean given z and w two complex number, the instruction z + w should not modify z! Instead, it should be used in an expression like c = … | |
Re: If you set something to 0 you can double it for a lifetime - it will never become something different than 0. Think on using a loop to add the dailySalary to the total earntMoney for each day of work. Then you can adjust the value of dailySalary to be … | |
Re: Apart from useless variables (numDays array and m) I think your main problem is that the events array just contains garbage data: it is not initialised anywhere. If you intended to use another events array initialised somewhere else in your code you should pass it to the function, or it'll … | |
Re: If both array1 and array2 contain 25 elements then you should write your for loops [CODE=C++] for (count = 0; count < 25; count++)[/CODE] as arrays of n elements are indexed from 0 to n-1. Moreover, the second cout will print the sum of all the elements of the second … | |
Re: That's not where the problem lies. [CODE=C++]{ if input == 1 return recursiveGCD; if input == 2 return iterativeGCD; } [/CODE] is wrong both from the syntax point of view and logically. You miss some parentheses and you try to call iterativeGCD and recursiveGCD (that are functions) without passing them … | |
Re: Your D class does not inherit from class A. You should write [CODE=C++]class D : A { // your code here };[/CODE] to inherit from class A. | |
Re: I haven't tried something like this yet and I'm pretty new to classes on my own, however I think that the typeid operator would be the right man for the job. Look at [URL="http://www.cplusplus.com/doc/tutorial/typecasting.html"]this[/URL] and give it a try :) | |
Re: strange, [CODE=C++]#include <iostream> using std::cout; using std::endl; int main(void) { char * word = new char [20]; char temporal[ ] = "hola"; strcpy(word, temporal); cout << word << endl; return 0; } [/CODE] works perfectly for me :S | |
Re: a one-dimension array is defined by [ICODE] type name[dimension];[/ICODE] or explicitly [ICODE] type name[] = { element1, element2, ... , elementn }[/ICODE] where n = dimension. It has exactly n elements, indexed from 0 to n-1. For example, an array of five int would be defined either by [ICODE]int myarray[5];[/ICODE] … | |
Re: I think you can start here: [CODE=C++]class Employee { string FirstName; string LastName; int MonthlySalary; public: Employee(); // if you like, you can also add 'Employee(string firstname, string lastname, int salary);' void SetFirstName(string firstname); void SetLastName(string lastname); void SetSalary(int salary); string GetFirstName(void); string GetLastName(void); int GetSalary(void); };[/CODE] | |
Re: Use code tags, please... I see arrays accessed out of their boundaries (check your two for loops), a [ICODE]p=o[/ICODE] that I assume you mistyped for [ICODE]p=0[/ICODE], a semicolon which shouldn't be there and [ICODE]void sort(usagekwh[], customer[])[/ICODE] missing [b]int[/b] before each argument - and that's only after a quick look through … | |
Re: Read [URL="http://www.daniweb.com/forums/post9554.html"]this[/URL]. | |
Re: [QUOTE=mjfall01;729513]My name's makhtar new member. i was looking at the website and really like it. talking about that i have a huge problem and i need help. Can somebody help me urgently. You are to develop a program for an auto dealership. This program will keep track of the auto … | |
Hi all there. I was given the task to write a simple Complex Number class as an exercise for a class I'm taking. I already met my professor and all went well (:)) but I'm left with a question which I forgot to ask her: how should I handle any … | |
Re: I'm fairly new to C++ in general and inheritance in particular so please someone correct me if I'm wrong: it seems to me like your methods definitions are conflicting with base class definitions of the same methods. It's just a guess, I'm waiting for someone else (with more knowledge on … | |
Re: [QUOTE=amerninja2;731641]how can i create a c++ program that can somehow connect to a phone and let you talk to them through a computer mic? also how do i create an email program?[/QUOTE] You have to study a lot... or to pay some pros to do the job for you. [QUOTE=amerninja2;731641] … | |
Re: I'd suggest you to take a look at the Euclidean Algorithm - I don't post links because there's often an example of implementation which could offer some copy-paste temptation... ... not that you couldn't find'em if you wanted to, it's such a common topic... I guess it's your responsability to … | |
Re: [ICODE]cin>>m2>>m2>m3[/ICODE] missing one '>' before m3. You shouldn't put ';' at the end of #includes, also. Apart from that, you should be more specific when asking for help... EDIT: Again you precede me, VernonDozier! :) My fault, I'm slow in replying 'cause I get distracted :P, btw yor answer is … | |
![]() | Re: [ICODE]return ceil(sqft/115.)*cpg;[/ICODE] here's your total paint cost. Divide by cost per gallon and you will obtain the number of gallons used Oo (read: do not multiply for cpg). It's the same for the number of hours required: [ICODE]sqft/115.*(18.00*8)[/ICODE] gives you the cost of the whole labor. Divide it by the … ![]() |
Re: something like [CODE]int number = some_odd_number; for( ;number_is_odd; ) { asks input; store input in number; } returns number; [/CODE] ? | |
Re: This: [QUOTE=aksshe10;728843]please do write the source code[/QUOTE] And This: [QUOTE=aksshe10;728843]hey i need this for my exams[/QUOTE] Don't really fit well togheter, don't you think? Also, you have another recent, perfectly healty topic on that... | |
Re: read this [URL="http://www.daniweb.com/forums/thread90228.html"]http://www.daniweb.com/forums/thread90228.html[/URL]. Hope it helps :) EDIT: Ops sorry Yiuca, you were faster :P | |
Re: After taking nothing more than a glance at your program I assume these answers will solve your problem: 1) "Insert" one of two players' colour in the board would be, for example, putting Board[i][j] = 1 for player 1 or = 2 for player 2. 2) Hold a variable Turn … | |
| |
Re: [ICODE]val = true[/ICODE] sets the content of val to [b]true[/b]. [ICODE]val==true[/ICODE] checks the content of value. They are two very different things! In your while loop and in the two if statements you need the second, so just fix it and your loop will work as expected :) | |
| |
Re: [QUOTE=newbie5150;727067]im not sure how the program tells the difference between odd,even, or zero? from the random number generator thats 1-36. hope you guys can help me out on this.[/QUOTE] [CODE=C++] if(Number%2==0) { cout << Number << " is even" << endl; } else { cout << Number << " is … | |
Re: You have to allocate dynamically the array if you want its dimension to be chosen by the user. You can't do that the way you tried to. Use something like this for allocation: [CODE=C++]int *myarray; int mydimension; cout << "Insert dimension:" << endl; cin >> mydimension; myarray = new int[mydimension];[/CODE] … | |
Re: Ok, there are plenty of errors. This is not going even to compile. I'd suggest you to rewrite it, adding a single function at a time. I think it would be meaningless to point out all the errors at once, so let's just say for now that: 1) you don't … | |
Re: [CODE=C++]int main(void) { TryYourself(); if(ProblemArise()) { while(NotWorking()) { PostYourCode(); AskForHelp(); TrySuggestion(); } } cout << "Wow, not it works!"; return EXIT_SUCCESS; }[/CODE] Or, if desperate, start here:[CODE=C++] #include <iostream> using std::cout; using std::endl; void InputArray(int *myarray); int GetMax(int *myarray); int GetAverage(int *myarray); int main(void) { int myarray[10]; InputArray(myarray); cout << … | |
Re: I think your problem lies here: [ICODE]AGE_GROUP[age] = row;[/ICODE]. Maybe you wanted to write [ICODE]row = AGE_GROUP[AGE];[/ICODE]. Also, [CODE=C++]for ( i = 0; i < 9; i++) { cout << "Enter a score: "; } for (i = 0; i < 9; i++) { cout << scores[i] << " "; … | |
Hi all. I am playing around with [URL="http://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html#Reading_002fClosing-Directory"]this[/URL] and [URL="http://www.daniweb.com/code/snippet579.html"]this[/URL] code snippet by Ancient Dragon. I didn't want to copy-paste so I came out with various simple attempts, the last of which looks like this: [CODE=C++]#include <iostream> #include <unistd.h> #include <dirent.h> #include <vector> #include <algorithm> using namespace std; int main(int … | |
Hi all. I am trying to overload the operator+ for a SLinkedList class I created. I would like to write [ICODE]list1 = list1 + list2;[/ICODE] and obtaining that list2 is merged into list1. I thought it was simple but it didn't worked properly. I tried to simplify the problem as … | |
Ok, sorry to bother but it seems I don't understand this properly ^^" I have a simple class, SLListNode, as follows [CODE=C++]template <class D> class SLListNode { public: static int Count; D Data; SLListNode *Next; SLListNode(void); ~SLListNode(void); }; template <class D> int SLListNode<D>::Count = 0; template <class D> SLListNode<D>::SLListNode(void) { … |
The End.