1,608 Posted Topics
Re: Command line arguments are used when you run a program from the command line, typically when you see a C:\ and enter something like HeloWorld hello world to get C:\HelloWorld hello world That would mean you wat run a program called HelloWorld which is located on the C drive and … | |
Re: It takes more than that to provide any shock value. Nice try though. Hope you had fun. | |
Re: you don't have to use complex numbers if you don't want to. Define the equation using variables of type double and check if 4*a*c is less than b*b before running solving the full equation. If that relationship doesn't hold, then notify user that the equation can not be solved using … | |
Re: add a default constructor to class childB that initializes balance to -99 and see what line 51 shows. Place a line in the class bal default constructor like cout << "default constructor class bal called;" to see if it is called by line 48. Experiment to see what happens. | |
Re: alright, type this in your code and see what happens: int charEquivalent = 'a'; cout << charEquivalent; Bottom line, you don't need an array of pointers to type int. You just need an array of ints. To get the output you want you can use an index int: for(int index … | |
Re: 1) stack<double> valStack; declares valStack to be a stack that holds objects of type double, so why do you need a offset? 2) Numerical offsets can be cute/convenient to convert an individual digit to an int value but, unless you are working with indivual single digit numbers with values 0-9, … | |
![]() | Re: There is no one way to create lists. Some are implemnted using arrays, and they will have the underlying attributes of arrays. Many lists are created using user defined types generically called structs/classes, which by your post, you know at least something about. These types are frequently called nodes. A … |
Re: Your declaration and function call for add() are wrong. To make add a method of class fraction define it something like this: fraction add(fraction rhs); and call it something like this: total = fraction1.add(fraction2); I suspect that this: total = add(fraction1, fraction2, total); ignores everything to the right of = … | |
Re: To answer your specific question, as a start, it would be helpful to indicate what the warnings are and what code you think the warning refers to. In a more general sense, I think you need to think about the relationship between what you refer to as phonebook, record, and … | |
Re: Say you have two lists with nodes at addresses a, b, c, d with a pointing to b and c pointing to d: a->b and c->d. To addend c->d to a->b point b to c using b->next == c and d comes along for free. To add the values in … | |
Re: >>-when i add a space or if i put my second name it immediately goes to last name Provide sample input, expected output, actual output. You may need to use a different input method, say getline() instead of >>. | |
Re: The third argument for getline() is the termination character, that is a variable of type char. Variables of type char can be indicated by using single quotes, ''. Double quotes indicate a variable of type string. The default termination char is the newline char, '\n', so you don't need to … | |
Re: In general assignement should not be done if you are trying to assign something to itself. If you aren't then you want copy data from the rhs to the lhs in the same order in rhs. One way to do that is to copy the data in the rhs list … | |
Re: while(low <= high)/2; This line has multiple errors. Redo it and recompile. | |
Re: Here's one I'm trying out: http://introcs.cs.princeton.edu/java/home/ Seems well thought out, a ton of information on both beginning Java and computer science in general. There's lots of pre written code to look at/copy to your software and plenty of exercises to do. There's a companion Algorhithms option when you get done … | |
Re: getData() needs to collect 4 pieces of data, two for each Point in the line, m_Left.m_Xcoord, m_Left.M_Ycoord and similarly for m_Right. In order to do this: cout << aLine.m_Left; you need to overload the << operator for the Pointer class. | |
Re: Parsing strings is a powerful tool. Using strtok() is one option to help, but often isn't the best option. When you don't know the number of inputs ahead of time you can use an array that is big enough you never expect to fill it to capacity or you can … | |
Re: Since you want to use Student objects in Course, you need to tell Course about them by including the header file for the Student class in the Course class. It's similare to what you did for the vector class. | |
Re: for each card with index zero to 4 //control card A for each card starting at the above index + 1 going to index 6 //control card B if card A equals card B increment counter after the inner loop is finished if counter equals 3 you have 3 of … | |
Re: Why the call to erase()? Everything else looks okay to me on first run through. | |
Re: add another variable (or two or three or however many it takes) to keep track of the lowest value of corr and the values of i and j that were used to calculate that value of cor. Use a control statement to help yourself out. if current corr less the … | |
Re: Do you want to know the mechanics of how to use a recursive function or under what conditions is it useful to use recursive functions? | |
![]() | Re: To edit files you either have to write the file to memory, edit, and rewrite the whole file back to HD or, if the file contents are entirely predictable and the information replacing the original consumes exactly the same amount of information as the original, then you can access the … |
Re: BB = A + B; + is overloaded as a member method instead of a friend method. + returns a Matrix called temp. > Once temp returns...it calls the copy constructor...passing temp as 'rhs' and 'this' would refer to 'BB'? (Am I right in thinking this?) To my thinking, in … | |
Re: declare temp as a char array of size 30, just like each name[i]. You can't use <,>, or = on C style strings (you can on STL string objects). Use strcmp() and strcpy() as needed. They should be in the cstring header file, if I remember correctly. | |
Re: I'd take vector<int> list out of the Sphere class. I'd declare a vector of Spheres in main() instead and then I'd maker variable a stand alone function and use the loop to the user enter as many radius as they want and use each entry to create aother Sphere that … | |
Re: An abstract class is a concept, not a real thing. It's a verhicle or art, or beauty. The technical definition you should look up, 'cause this sounds like a homework question. | |
Re: What's the purpose of line 18? Take it out and see what happens. | |
Re: IIf you are going to use sort() then you need to overload the less than operator for the Records class or create some other function to compare two Record objects----say compareNames() or something. If you are going to do some othe sort routine, say a bubble sort or whatever, to … | |
Re: Remove zero from One and make One[0] "" Put "ten" in Teen[0] instead of in Tens; Declare an array of three ints called digits to hold the digits in result (will work for value of result 0-999 Declare a string to hold the string version of result If result is … | |
Re: Start commenting out functions and/or declarations until you find it. When writing code compile at least every time you write a new function (if not more often). | |
Re: I'd use another set of variables to keep track of the total value of the ints in both stacks and use those result to determine where to push the next input. | |
Re: the compiler will call the destructor when appropriate. You (almost) never have to do it. The compiler will provide a default constructor for a user defined type. However, if you declare a destructor for the user defined type, as you do on line 14 of smurfvillage.h, then you should define … | |
Re: Beware when you mix input methods. >> doesn't remove the terminating newline char from the input buffer leaving them around for gets() or fgets() or getline() to see. gets() terminates input into the desired variable when a newline char or EOF is found. That means if >> is called before … | |
Re: Create a container (probably a large array, to hold the largest number of marks that you could reasonably expect to read in) to hold all the marks as they are read in so you can search the data as desired, or create variables to hold each of the desired and … | |
Re: The only thing I see wrong is absence of the # sign before the 2 of the three includes. | |
Re: i dont know how to loop it so the user will be asked to choose from the selection menu above after completing each selection task the answer(s) is/are here: • Loop your program so that the user will be asked to choose from the selection menu above after completing each … | |
Re: fMat indexes equals cMat indexes each line gMat indexes increment by one 4 times a line gMat indexes remain same for 4 lines, then increase by 4 for the next four lines fMat is incremented by the product cMat * gMat 4 times each line for(int i = 0; i … | |
Re: When I look up 102 syntax error it relates to improper syntax after last legal syntax in command line arguments. If you are using the command line to open the program instead of the IDE then post the exact syntax you use on the command line. Please post the exact … | |
Re: Welcome to Daniweb. Many of the routine people who respond won't download code from the web so it's best to post it here. Use your debugger or toss in output statements to keep track of variable values as you go through the program to try to track down where the … | |
Re: So, other than row 4 (aa) it looks as though you exchange columns based on the results of sorting the first row. Is that the effect you're after? If so, then the swap during the sort needs to be for each row all at the same time. swapColumns(matrix, c1, c2) … | |
Re: Another option would be to create a location class which has an identifier, and maybe other useful information, as well as a vector of employees as member variables. Then use a container of locations, search the location by some identifier and use just a single accessor function. | |
Re: Here's another "experimental" approach, in pseuocode: declare an array of type bool, size 1000---say boolArray. declare an int called numSelectiions 1) set boolArray to all false 2) set numSelections to 0 3) pick a random number, i, between 0 and 999 4) increment numSelections by one 5) if boolArray[i] is … | |
Re: Double posts are discouraged,particularly when done intentionally. What don't you understand about part 7? | |
Re: Avoid use of global variables whenever possible. start() is declared/defined with return type int, but the return value in main() is ignored. | |
Re: Aside from the obvious disconnect between the stated goal of having a students name and grades as member variables for the class rather than name, model, price as member variables, the answer is classes default member variables and methods to private access whereas structs default member variables and methods to … | |
Re: welcome to daniweb. We try not to give full solutions to homework problems. So post what you've tried or indicate what specific concept/task you don't understand and any error message you may be getting and someone will probably step in to help. | |
Re: Please explain your goal more precisely. I understand it as follows: STEP 1: 00 1 Assignment of numerical identifiers for each 2 x 1 matrix to be combined 11 2 into a 4 x 4 matrix. Note this could also be an 8 x 2 matrix. 01 3 01 4 … | |
Re: I've never used GLSL but a simple search using Google came up with the 3 websites I use when using plain old OpenGL. Seems as good a place as any. | |
Re: I agree with both of the other responder and would add, if this isn't a homework assignment, ask yourself if an array is the best container for you to use. |
The End.