1,358 Posted Topics
Re: [QUOTE=Arkrothe;1670009][CODE]while (principal = 0) { // Settings for, to show the decimal precision cout << fixed << showpoint << setprecision(2); // Calculations output cout << setw(2) << month; cout << setw(16) << principal; cout << setw(17) << interestPaid; cout << setw(18) << principalPaid; cout << setw(19) << principal << endl; … | |
Re: Please describe the problem you are having more clearly. What are you expecting it to do and how does its behavior differ from the expected? | |
Re: Any time you refer to a class that is written in a generic fashion, you need to provide a template argument(s) (the part between the "< >"). Your node pointers aren't declared properly. You need template arguments to indicate the proper type. Is is a pointer to a node conaining … | |
Re: No. You know the site rules. We're not here to do your work for you, we're here to guide you to your own success. You've been doing this long enough, you should know what the proper signature(s) for the main function is/are by now. Re-work your main() into the proper … | |
Re: Additionally, the Debug and Release versions link to different libraries. If you compile a program in Debug mode, it will only work on a computer that has Visual Studio installed. To let someone else that doesn't have Visual Studio run your program, you have to compile it as a Release … | |
Re: Based on the posted code I'm surprised it's only flagging "judge4"; it should be flagging 4/5 of your judge values every time. You may want to re-evaluate your algorithm a little. You really don't want to CalcScore until you've retrieved all 5 scores. As it stands now, you're re-calculating the … | |
Re: [QUOTE=pendo826;1672383]i dont get what you mean there has to be a way to print out an array.[/QUOTE] There is, but you have to keep track of the size of the array manually, C++ doesn't do it for you. The method you've attempted would work with a std::vector, which is essentially … | |
Re: [QUOTE=ravenous;1672337]...* C++ [i]can[/i] be portable, but you have to work at it. With an interpreted language like Python, you almost get it for free.[/QUOTE] I think you'll have to clarify your thoughts on this statement. At its core, the C++ language is by its very nature highly portable. That's why … | |
Re: It lets you iterate through multiple items multiple times. One very common use is multi-dimensional arrays:[CODE] //#include the necessary headers #include <iostream> #include <cstdlib> #include <ctime> //declare needed constants const int ROWS = 10, COLS = 20; int main() { srand((unsigned)time(0)); //seed the RNG char Array[ROWS][COLS] = {'\0'}; //declare the … | |
Re: I don't do any windows programming, so I don't know the actual API call, but I do know that there is a window property that controls that. To activate the maximize button, the "MaximizeBox" property needs to be set to "True". If you have a window style definition, you may … | |
Re: First, when posting code, please use [b][noparse][code]...code tags...[/code][/noparse][/b]. They preserve formatting and add Line Numbers making your code easier to read. Observe (with minor formatting corrections for readability and discussion):[CODE] #include<stdio.h> //Header file #include<stdlib.h> #include<time.h> #include<iostream> using namespace std; #define MAXROWS 10 //Define max rows =20 #define MAXCOLS 10 //Define … | |
Re: Well, this actually reads more like C code than C++ code, but we can still help you out. Would you elaborate on the errors you're getting? What compiler/IDE are you using? One thing I can see for sure is that your "date of birth" variable is an illegal identifier. Try … | |
Re: [QUOTE]I have not created a IPO chart since i tried doing the C++ part first to see if i was going to be write but i really don't know what I'm doing. I wouldn't even know how to start the IPO as i don't know what goes in the input … | |
Re: A bit can only hold 1 of 2 values (1) or (0). These can be interpreted as (on/off), (yes/no), (true/false), etc. One common use is to use bit shifts and the bitwise logicals to condense several of these types of values into a single variable to save space. For example, … | |
Re: [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]You write it first.[/URL] We aren't going to give you the code. You have to write it yourself. If you put forth a good-faith effort and have a problem with a particular part of your code, post a proper question; then you'll get something useful. I'll give you this though:[CODE] … | |
Re: What exactly do you mean by "weird results"? Please elaborate. | |
Re: I seriously doubt that will make your code easier to read. With the definition being split up like that it actually makes it harder to read because you have to bounce around to find all the relevant parts of the class definition. | |
Re: Is there a particular reason you put the BOOL in there? WriteFile() is a function. On Line 23, you're not calling the function, you're attempting to instantiate an object of the BOOL type called WriteFile. I suggest you remove the BOOL. | |
Re: What kind of errors do you get? Please post the first few. I suspect that they have something to do with the conversion of an int* to another data type because in easyCopy() your parameter would be a [B]int * const &[/B], which is a pretty strange data type (a … | |
Re: Why are you trying to input to a constant? You can't. The whole point of a constant is that it's value remains unchanged throughout the execution of your program. I think you're going to have to clarify your intent. | |
Re: No. By changing the type of the parameter, you've changed the syntax required to call it. Additionally, you've broken the code that is contained within it. You would have to swap the "arrow" operator '->' for the "dot" operator '.' Also, because it's now a non-const pointer to a non-const … | |
Re: One thing that you need to remember is that not every location has all eight "neighbor" locations. For example, if you have a 3x3 array called "values", and you are at values[0][0], you will only have 3 "neighbors", they will be values[0][1], values[1][0], and values[1][1]. The remaining 5 "neighbor" locations … | |
Re: Do you know how to use functions? You could replace your evaluation with a function. Then, when you need an evaluation done, all you have to do is call the function. This eliminates the repetition by allowing you to re-use one piece of code. Perhaps something like this:[CODE]bool evalDigitSum(int valToSum, … | |
Re: If you're not sure what you want, how can we even begin to be? RE: Error on Line 70: From what I can see, the function is intended to receive a 2-dimensional array. However, when you pass Community[22][80] you are attempting to pass the single char that is found at … | |
Re: Change the arguments/parameters of your useMoney() function to references. That way, the modified values within the function's scope can get back to the calling scope.[CODE] #include <iostream> void someFunc(int unChangeableValue, int &changeableValue) { unChangeableValue++; changeableValue++; } int main() { int value1 = 0, value2 = 0; std::cout << "value1 is … | |
Re: [QUOTE=s_r_k;1666550]I figured it out. Thanks.[/QUOTE] Next time, just leave your original post as is so that someone else can benefit from it if it applies to their problem. By "deleting" your original post, you've made this thread completely worthless to future readers. | |
Re: Did you read sundip's link? Towers of Hanoi is a mathematical puzzle. Read the link for more information. | |
Re: On most modern compilers, a long is a 32-bit integer value, the same as an int. If your compiler and/or system support it, I would consider a long long if you want a value that has more than 10 digits. With this type, you would now be limited to 19 … | |
Re: [QUOTE][CODE]//create vector and pointer vector<int>*pVector(); vector<int>*pVector() { vector<int>*myvector=new vector<int>; return myvector; } //printing vector on the monitor via iterator void VektorPrint(); void VektorPrint() { vector<int>*PrintV=pVector(); vector<int>::iterator it; for(it=(*PrintV).begin();it!=(*PrintV).end();++it) { cout<<*it<<endl; } delete PrintV; //Frees the memory allocated with new) PrintV=0; //pointer to zero so program will crash, if some saves … | |
Re: [QUOTE][CODE]next=+10;[/CODE][/QUOTE] Notice something wrong with this operator? | |
Re: As I understand it, the [B]explicit[/B] keyword is only useful on a single-argument constructor, because they can be either implicit or explicit, but any other constructor is explicit. There are two (2) ways to declare an object. First, you can do this:[CODE] someType anObject(someValue);[/CODE] or you can do this:[CODE] someType … | |
Re: This:[CODE] #import <iostream> #import <windows.h>[/CODE] is not correct. It should be "#[B]include[/B]"[CODE] #include <iostream> #include <windows.h>[/CODE] | |
Re: [QUOTE=Taywin;1665532]Hmm.. You are still using syntax wrong... In line 23 & 43, do you want to declare a variable or a function? [CODE] float slope1((y2 - y1) / (x2 - x1)); [/CODE] If you want it as a variable, you should do it as [CODE] float slope1 = (y2 - … | |
Re: Function overloading is based strictly on the [B]arguments of the function[/B]. The compiler does not look at the return type of the function to determine overloading, it looks only at the number of arguments and the dataTypes of the arguments. If you have more than one version that has the … | |
Re: The issue is integer division vs. floating-point division. Integer division divides an integer divisor into an integer dividend and produces an integer quotient. For example, if you have 11/3, integer division will produce a truncated integer result of 3 instead of the actual correct value of 3.6667, which is a … | |
Re: [QUOTE=MonsieurPointer;1665334]You are trying to calculate your slope [i]before[/i] the user inputs values. You need to place int slope1 = ... and int slope2 = ... [i]after[/i] the code where values are stored in formula[n]. Also, declaring slope1 and slope2 is dangerous, because a float / double can turn out as … | |
Re: [B]>>I want to use the * to display the output,[/B] Not entirely sure what you mean. Do you mean you want to use pointer arithmetic instead of array indices (not that there's really that big of a difference)? i.e. use [icode]std::cout << *(anArray + anIndex);[/icode] instead of [icode]std::cout << anArray[anIndex];[/icode] … | |
Re: Is "Queue.h" a custom header that you wrote or are you attempting to use the queue that is part of the STL? It looks custom. What O/S and IDE are you using? If you are getting a linker error, it means that the linker can't find the implementation of your … | |
Re: >>[B]But instead of showing A, 2, ..., J, Q, K, it shows 1 to 13. How can I convert 1, 11, 12, 13 back to A, J, Q, K?[/B] You'll have to use conditionals (i.e. an "if" statement) and alter the output based on the value. [B]>>Can I make it … | |
Re: [B]>>Here F has access to only fct1 and fct2.[/B] No it doesn't. Because you used [B]private[/B] inheritance, it should only have access to the [B]private[/B] function R::C::fct_for_everyone(). R doesn't even have access to C::fct1(), C::fct2(), or C::fct3() because they have "higher" access than private (which technically doesn't exist, which essentially … | |
Re: Part of your problem is that you have 6 members of the cd_detail struct (group, name, year, price, playtime, and costTotal), but you're only initializing 5 of them. [QUOTE][CODE]{"Alan","I love China",2010,53,500} //only 5 values here...[/CODE][/QUOTE] The value that you are failing to initialize is the value of costTotal. The other … | |
Re: I would check the matrix that's going into your assignment operator. What's happening is result gets returned to the calling scope as a temporary object. That temporary object then becomes the rhs argument for the assignment operator. It's possible that the temporary object is being destroyed before you are done … | |
Re: It depends on how you do the user input. Simply doing this:[CODE] int userInput; cin >> userInput;[/CODE] will not work if the user enters any sort of char input (such as 'A'). It will corrupt the stream and mess up your program. To prevent this you'll have to get the … | |
Re: Your function is defined as [CODE]int BinaryTree::getLeafCount(struct node *node) {[/CODE]Notice the [iCODE]node*[/iCODE] parameter... But your call is[CODE]b.getLeafCount();[/CODE]Notice the lack of an argument... Basically, because you didn't call it properly, you've unintentionally overloaded the function, but you don't have a definition/implementation of the overloaded version. | |
Re: I seriously doubt that those are the only "commands" you can use. The more likely scenario is that you pulled that list from memory and those are the only ones you remember using before. This is evidenced by the randomness and you listing the cin and cout objects, but not … | |
Re: [QUOTE=cscgal;74792]I've just started using [b]Folding@Home[/b], and I thought we might create a DaniWeb Folders team. For those of you who would like to be a part of our fight to cure diseases, by using your unused CPU time, please check out [url="http://folding.stanford.edu/"]http://folding.stanford.edu[/url] When setting up your client, enter [b]Team # … | |
Re: This isn't really the forum for it (not real sure which one is), but I can help you with RAPTOR. What's the issue? @evstevemd: RAPTOR is an acronym, it stands for "Rapid Algorithmic Prototyping Tool for Ordered Reasoning". It's a tool developed by the US Air Force Academy to teach … | |
Re: From what I can see, you seem to have done your headers and implementation files correctly. The big problem i see is actually Lines 8-10 of main.cpp. Change the names of those variables/objects so that they aren't hiding the names of your classes with local identifiers. When you hide identifiers … | |
Re: Iterators are essentially pointers. They are more powerful, and safer, than accessing an element directly through its index. | |
Re: If you are getting a warning from your system, there must be something seriously wrong with your code. The better approach is to find out what part of your code is causing the warning and address the issue instead of just brushing it off like it doesn't exist. |
The End.