- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 20
- Posts with Upvotes
- 18
- Upvoting Members
- 14
- Downvotes Received
- 3
- Posts with Downvotes
- 2
- Downvoting Members
- 3
75 Posted Topics
Re: [QUOTE] yea, i ignored your help, because you did not help me with my code at all, and I did not know what I needed to take out. All I read was advice, NOT HELP. SO I did believe you, you just did not help me. [/QUOTE] He is trying … | |
Re: I'm posting from my phone and the details are a little iffy but ... If you right-click on your project folder Properties Java build-Path The 2nd tab .. There should be options to add internal and external .jar files. | |
Re: That is a lot of if-else statements. Think you can rewrite this with a more logical approach? Note: This is not to bash you! If you can think of creating this with another approach, it may help with other types of OOP. Consider using a class for each player as … | |
Re: > char name; > char family; > int age; Could it be that your name is only 1 character long. If you want a full name, consider the use of a string. Same goes for the family. | |
Re: for loop is very likely your best option. Can you show us any code that you have written? Even if you think the code is wrong, please link it. At the very least, consider writing up a pseduocode to see if we agree with the logical approach. Writing pseduocode (writing … | |
Re: > I am having trouble with this part of my program assignment. It would appear you have created and tested each of the classes to make sure they work correctly. This is evident by the comment block for the testing of each ADT class that you made. I would assume … | |
Re: If you still need help with this, please actually ask a question about it. I was left with a sense of .. huh? And attempted to find a question in the lines of code. Also, repost the snippet of code that you are having the problem with and what problem … | |
Re: You first want to fill your array. Then send that array to both min and max functions. The array may be filled in the main fucntion, then sent to each of the functions to find the maximum and minimum values in the array. You can fill an array like this. … | |
Re: ** > myIterator = find(myVector.begin(), myVector.end(), InRange(10,20)); find(); ... shoudn't it be find_if? myIterator = **find_if**(myVector.begin(), myVector.end(), InRange(10,20)); ** | |
Re: dariaveltman > please tell what am I doing wrong. First, please let us know what you are confused about. If you don't know exactly where you are confused in the code or how the code is supposed to work try telling us what you already do know and how you … | |
Re: Is there anything specific you do not understand as there is a lot of information from [CODE]the beginning[/CODE] to [CODE]the end.[/CODE] Possibly explain what you do understand and then we can help with the rest. Otherwise what we would need to do is create a response that is nothing but … | |
Re: Remember, arrays are initialized with a strict size --unless they are dynamic. To access the memory for any array, you access it be 0 through one less than the total size. [CODE] int numbers[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; // numbers[0] = 1; // … | |
Re: Please enter code in like this so it's easier for us to read. This is wrong: [CODE] int main (); // You need brackets for the block of code containing the main function. -not a semi-colon ; //like this int main(){ return 0; } [/CODE] | |
Re: [QUOTE=LevyDee;1608696]From the looks of it, next is a pointer to the object type of what ever p, q, r and t point to. "next" is not a very common name for this that people use(i think). I like to use link. quick look at a simple object that is being … | |
Re: Okay. First, please format your code correctly using the [CODE] [/CODE] blocks that are given to us. Makes things a little easier to read. I'm figuring your professor does not want want you to create 5 int variables in the main program and then add them to the list as … | |
Re: The reason why there isn't anything outputting to the outfile.txt is due to the fact that outChar is being manipulated in the for-loop a number of times but only until the end, past the end of the for-loop, is a call made to the outfile. If you check your normal … | |
Re: Sure, you can add the second part after the calculations. Prior to that, you may want to slightly edit what you currently have. I'm assuming the code below is suppose to be read as this: [CODE] else if ((choice == 'b') || (choice == 'B')) { charges = packB; cout … | |
Please tell me how bad this code segment is. I figured I would share this horrible code. If it's not as horrible as I think it is, please let me know. Thanks! [CODE] /* Purpose: Create a function to check the input from user. Only valid integer should be returned. … | |
I somewhat understand the concept of the parentheses overload when you need to use an object as a function. The question that I have is why does the max variable in the listed code below always input 2. [CODE] /* Purpose: This is the header file of randomInteger.h The class … | |
Re: [QUOTE] You missed an important point. The rectangle "knows" its internal state. When you draw the rectangle, you do not need to send it any data. It already knows its own height, width, etc. (which ave already been set in the constructor or set function). So you just tell it … | |
Re: One suggestion with your changed if/else that you were working on. If the program fails to open the file, might as well close the program with [CODE] exit(1); [/CODE] at which point you do not need to worry about an else. If it doesn't fail, the program keeps on going … | |
Re: Only thing I could possibly think of, which could easily be wrong, would be to close the solution, copy and paste your entire program into a new project. The program you are trying to run could possibly be running with an older solution/project, I don't know. Let us know when … | |
Re: You need to change your expression statements in your flow of control. if (first = length * 1.85 + 2.50) // will always be true if (response='n') // will always be true You also don't assign total to anything. At no point in your program do you have written [CODE] … | |
Re: First, I don't think Narue is a dude. Second, I had this same post about 2 days ago, you may want to check out that thread. [URL="http://www.daniweb.com/software-development/cpp/threads/363659"]here[/URL] | |
Re: Good to hear you don't want your homework done for you, it's definitely a plus on my end to see. There are a number of things wrong with the code, but overall, not a bad start. You may want to give us a reason why it may be buggy? Tends … | |
Re: You may consider setting your program up so that it first 1. Reads in the numbers through and array. 2. Checks the array against itself 3. then outputs any repeats it may have. What you are currently doing is inputting a number into an array, then checking against array values … | |
Re: [QUOTE] The Add() function is declared on line 12. It takes a constant Counter reference, which is the number to add to the current object.(which is varOne?)It returns a Counter object, which is the result to be assigned to the left side of the assignment statement, as shown on line … | |
First, my program works. I'm posting my code for my own personal benefit with the help of your guidance to know of any better way of handling this code. I was considering the use of [CODE] while(cin >> grabname) [/CODE] to possibly continue grabbing from the input stream until '\n' … | |
Re: [CODE] double& operator [](int i) //[] which can used as the left value { if(i==0) return x; else if(i==1) return y; else if(i==2) return z; else cerr<<"our of rand index of Point"; } [/CODE] The function has a return type of double which you have returned three times in your … | |
Re: You may want to list the compiler problems, if any, for us to view. Seeing as how there is no description, other than the code, to the problem it is difficult for us to figure out whether this is a 1. syntax problem, 2. logical problem. Lastly, what is this … | |
Re: [QUOTE=mwmnj;1554229]Hi, I am working on an exercise in operator overloading. I've created a matrix class and I am supposed to overload operators so I can do arithmetic on matrices efficiently. [/QUOTE] This is where the fun part comes into play :D Enjoy it and let it roll. [QUOTE] My directions … | |
Re: [QUOTE=sha11e;1529731] So one should write like std::cin and such? Seems annoying / ugly =( Should I be doing that? (std::), do experienced programmers do that? =( [/QUOTE] Yes, you can write like that. I have read a few C++ books and both have been shown. I suppose it comes down … | |
Re: Just trying to compile what you have written I immediately get 12 error. You need to change the section prior to your main(). All the variables and loops need to be placed in main, or at the least in a function. After deleting the loops and variable declarations etc as … | |
Re: Yeah, you can't do that with the while loop. [CODE]while(choice != A && choice != B && choice != C ... etc)[/CODE] OR you can write it as [CODE]while( choice < 1 || choice > 4) // basically read as, while choice is less than 1 or greater than 4, … | |
![]() | Re: To add overloading operators to a class definition, you need to add them as a FRIEND function. [CODE] friend <type_name> operator <operator>(const <type_name>& var1, const <type_name>& var2) // Example - rational is a class name not shown but defined else where friend rational operator+(const rational& var1, const rational& var2){ <some … ![]() |
Re: You can create a namespace for all of your classes and then add that global variable in that namespace. You may consider changing your constructors to your classes to add an additional parameter. As the class is created that variable will be used as a parameter that you can share … | |
Re: [QUOTE=veda&&;1523479][B]any could help me ?? thanks [/B][/QUOTE] How about... You start your own thread? | |
Re: Instead of system pause, I'd recommend something easier on the system itself. [CODE] cin.get(); [/CODE] It's basically - "Press and key and <enter> to continue..." | |
Re: I can see why you wanted to use your MAIN() in the first instance. [CODE] if(choice<0 || choice>4){ cls(); main(); } [/CODE] If the selected choice is not valid, just restart the program. Instead of restarting the program, just ask the user to "try again" with a more valid input. … | |
Re: Remember cin.ignore has two parameters. [CODE] cin.ignore(1000, '\n'); [/CODE] This is to clear the input stream useful with while mixing cin.get(param1) and cin >> variable1. Example 1 [CODE] /* Purpose: threads/354626 Name: Saith Date: 3/20/11 */ #include<iostream> using namespace std; int main(){ int var1; char var2; cout << "Input some … | |
Re: [QUOTE=mike_2000_17;1509105]The code you posted would indicate that fourvector is a class derived from the class threevector. The constructor of fourvector simply forwards the one_two_three parameter to its base class constructor. Remark: "I have seen this syntax used for the constructor of the fourvector:" Run! Just run away from this code! … | |
Re: [QUOTE=a.muqeet khan;1508506]vmanes sir one more thing did i used the constructor for the p2 correctly ?[/QUOTE] If you are asking about the declaration of your objects to your class as such [CODE] phone p1,p2(a,b,c); [/CODE] Then yes, you can give values of a, b, c with this constructor. Problem occurs … | |
Re: I'm sure you can write a function that will do that for you without needing an entire program. Please show some work. | |
Re: Neither do I, really. I don't see how a random number should be existing in this loop, and then an X value to be returned. I can understand if you want to compare X > Y and change the while expression to [CODE] while (x / 53.0 > y); [/CODE] … | |
Re: Learning takes practice, practice takes time. You need plenty of both to get far in anything you do. If this will be anything like your previous posts under the similar name, spoonlicker (not the current spoon_licker), the chances of you getting any type of positive feedback will be minimal. I … | |
Re: You may want to actively step by step debug this with your IDE. First comment out all functions so none are being called or compiled. Take the first function and debug it until it works properly, then un-comment the next function and debug it until it works properly. Do so … | |
Re: NathanOliver has a good point, just a for-loop. Just in case you haven't done for-loops just yet, you can do basically the same thing with a while loop. Ask for the number of students, create an index for the current loop count, then increment the index once the loop ends. … | |
Re: Luckily, us "smart ones" (really the ones that truly want to find the answer by digging for it) will filter through those kind of responses and will find what we are looking for. I've been a Daniweb member now for ~2 months, ~2 months longer than any other forum, and … | |
Re: First, as Crutoy as responded, you want to populate the array. Use nested for-loops. A generic one you may find would include something similar to this. [CODE] /* Purpose: thread347853 - filling a multidimensional array Name: Saith Date: 2/17/11 */ #include<iostream> using namespace std; int main() { const int vertical … | |
Re: No. You can declare variables in the main function. [CODE] int main() { int a, b; <rest of program here> return 0; } [/CODE] Switch statement is a "flow of control" like the if-else statement, while loop, for statement, etc. |
The End.