1,358 Posted Topics
Re: In the example you posted in your OP, it makes sense to put it all in one file because there is so little there. But what if you are defining a class that has a substantial number of members. Let's say this class has 150 member methods and takes 250 … | |
Re: Are you using the correct namespace? Can you post your #include and using statements? | |
Re: [QUOTE][CODE]static map<string, ProductLine*, less<string> > productMap;[/CODE][/QUOTE] [URL="http://www.cplusplus.com/reference/stl/map/map/"]Have a look at this page.[/URL] I think you're trying to combine 2 of the 3 versions of the std::map constructor into 1 unrecognized version. I suggest you try it without the [ICODE]less<string>[/ICODE] and see if it works properly. This should call the first … | |
Re: [QUOTE]Which I don't get since strcpy is supposed to change a string to a char array.[/QUOTE] It does, if you use it properly. [QUOTE]...I get "error C2664: 'strcpy' : cannot convert parameter 2 from 'std::string' to 'const char *'[/QUOTE] Look up the function std::string::c_str(). | |
Re: Did you bother to read pages 2-4 of the article you linked? They explain fairly well... | |
Re: [URL="http://www.daniweb.com/forums/thread78223.html"]Hunh?.... Make some sense, then maybe we can help you.[/URL] | |
Re: I hope there are some improvements coming down the pipe, I don't really care for the new style, it's too ... flat. There really isn't any style to it at all. The threads and posts in the listings take up way too much vertical space, it makes the pages too … | |
Re: Stacks work in reverse order, first in last out. If you want to pop the filename from the full stack, then empty the stack into a file with that name, the filename has to be the last element pushed on to the stack so that it's the first information popped … | |
Re: If you want to open a file multiple times and add new information to it each time, you have to use append mode. If you don't (you only use output mode) you overwrite the existing file data every time. Try changing Line 30 to [iCODE]ofstream myfile("test2.txt", ios::app);[/iCODE] instead. [edit] oops.... … | |
Re: [QUOTE][CODE] theBidlist(BidList); BidList[i].show();[/CODE][/QUOTE] What sort of issue are you having? Will it compile? If not, what are the errors reported? Also, what is "theBidList" and where did it come from? | |
Re: You need to put your sum statements either inside your loop or inside another loop as mimis demonstrates. However, your use of the array is not good. What happens if you enter a range of, for example, 10? Here's a hint, it's not good. You really should find a better … | |
Re: Start with NathanOliver's example, but change the condition of the if statement on Line 12 to look at the current contents of the cell. If the cell is occupied, continue, otherwise, populate it. | |
Re: You need to tell the compiler and the function that an array is being passed. For a 1-D array: [CODE] returnType functionName(dataType [optionalDimension1Size]); //general form of prototype void someFunc(double []); //example prototype void someFunc(double [10]); //example prototype returnType functionName(dataType [optionalDimension1Size]) {/*...*/} //general form of definition void someFunc(double anArray[]) {/*...*/} //example … | |
Re: [QUOTE]...but it has alot of error.[/QUOTE] [URL="http://www.daniweb.com/forums/thread78223.html"]That's not much to go on. Care to elaborate a little?[/URL] | |
Re: Are you sure these are all the errors? I notice the first one appears to be labeled # 49. When you have compilation errors, it is best to start with the first error and work your way down. That way, as you fix your errors and retry the compilation, the … | |
Re: [URL="http://www.daniweb.com/forums/announcement8-3.html"]You still have time to edit, add [code] tags, and I'll consider helping.[/URL] | |
Re: Line 10 of your Implementation file. You have an extraneous semi-colon in there. I don't think it would affect your issue, but remove it and see if it helps. I don't see anything wrong with the declarations of name or Bible::getName(). I suspect the issue may be with your call. … | |
Re: Hmmmm..... I have not done this before, so this will be a learning experience for both of us. I know you'll want to create a "shape" class, as you have done. I also know you will then want to create shape-specific classes that inherit from "shape" for each shape you … | |
Re: [QUOTE=Paul Thompson]If you go the community forum category you can see forum threads that you are not meant to see. I have a screen shot attached.[/QUOTE] I saw it too. I saw the same one in the C++ forum, plus several others. ATM, I'm counting 11 of them on just … | |
Re: Add some accumulators between Lines 52 and 53. i.e. [CODE] accumulatedTotal += currentRecord.valueToAccumulate; /* ...etc...*/ [/CODE] | |
Re: Make a loop and iterate over the array. While looping, use comparison statements to compare the elements to each other. | |
Re: Take the [B][][8][/B] of your calls. When you are passing a whole array, you only use the array name, you don't use any index(es). | |
Re: [URL="http://www.daniweb.com/forums/announcement8-2.html"]>>please ilove you... I'm not inclined to help, you're creepy...[/URL] | |
Re: First code (reformatted for clarity): [CODE]int x; for(x =1; x < 5; x++) x = x + 2; cout << x;[/CODE] I'll give you this one since you tried. The output is 7. The variable x starts at 1, then 2 is added. The value of x is now 3. … | |
Re: Add header guards... [CODE] #ifndef HEADER_FILE_H #define HEADER_FILE_H /* ... your header statements here ... */ #endif //HEADER_FILE_H [/CODE] [EDIT] [QUOTE=NathanOliver;1213087]Take out the #include "UTevent.cpp" in main[/QUOTE] That too... I thought he #included "UTAevent.h"... | |
Re: A flag is nothing more than a variable that tells the program when an event has occurred or a condition has been met. There really isn't anything special about them. Have a look at this for more info: [url]http://www.sorting-algorithms.com/bubble-sort[/url] | |
Re: [QUOTE=caut_baia;1212780]First of all argc should be initialized.[/QUOTE] Wrong.... The variable argc is an integer initialized by the o/s before being sent to main() that's why it's a [B]parameter[/B] of the function. All you have to do is use it... P.S. You're lucky I messed up on the like-dislike. @OP: Try … | |
Re: 1. main() is a function, you must specify a return type. The ISO standard requires that the type be int. 2. Both of your parameters in answer() are called "num" change the name of one of them. 3. Line 24, you are trying to use the operator "+=", you can't … | |
Re: If you need help, you need to show us the RELEVANT code. Your problem sounds like you are trying to access invalid elements. I believe that [iCODE]int bin_array[80]={};[/iCODE] doesn't actually initialize, it still only declares. Try [iCODE]int bin_array[80]={0};[/iCODE] instead. Also, post back with the rest of your relevant code. Your … | |
Re: I think you'll have to share your Vec class and your display code to get the proper help. Maybe someone else can figure something out from this, but I can't. The call to the centroid constructor on Line 26 concerns me. It probably has something to do with that, but … | |
Re: b is not actually AT address 0012ff60 it is at a different address, but the compiler treats it like it is at the same address. You might call it an "automatic" pointer, similar to if you pass a variable to a reference parameter in a function (instead of as an … | |
Re: @OP: Look at your declarations, the variable inv is not a pointer, it is an int. You can not dereference an int. Move the '*' from inv to token. | |
Re: [QUOTE=tkud;1210715]You can only use public methods to access [B]public[/B] member variables. So remove all the privates and put them to public. You only use private when you dont wanna access them from public methods. Please if this solved your problems, mark this thread as solved.[/QUOTE] Incorrect... The whole point of … | |
Re: Wow..... I would suggest you start by deciding where you want your inputs to occur. You have the [I]password[/I] input occurring in 2 conflicting locations. You also have multiple occurrences of input for [I]username[/I]. However, this is okay, the locations you have them in are complementary rather than conflicting. Depending … | |
Re: No idea whatsoever. You didn't post any code. Look at Line 16 of the file [I]prjct3.cpp[/I]. You have a statement written incorrectly on that line. Are you trying to do a left bitshift, inject data into an output stream, or something else that's completely off the wall? | |
Re: A using statement is not a header include. In this case, they are used in place of [iCODE]using namespace std;[/iCODE] to only make certain parts of the std namespace visible instead of the whole thing. | |
Re: @OP: I think that either you don't understand how arrays are arranged or you're confusing the terms row and column and causing additional confusion. A 2-dimensional array is arranged thus in memory: [CODE] int anArray [9][3]; //declares a 3x9 "matrix" column: 0 1 2 row 0: { 0, 0, 0 … | |
Re: Why don't you read through it yourself? It will do you more good than us wading through 240+ lines reverse-engineering something. I'll get you started, I see 7 functions (including an improperly-declared main()) and 2 custom data types. If there's something you can't figure out, ask a specifically-directed question and … | |
Re: Have you tried the method without the setfill() and setw() stream manipulators? Since your method is const, they may not be allowed because you are changing the stream. | |
Re: It's because your variable/iterator "i" doesn't change until after your third loop completes everything it does. You need to find a way to change "i" more often. Hint: It is possible to have more than 1 iterator and/or exit condition in a particular for loop. Have a look at the … | |
![]() | Re: Without a better description of the issue, all we can do is guess. I'm [B]guessing[/B] the second loop, starting on Line 103 and controlled by $i, isn't running because of the exit condition you've specified. It only runs if $i == 1. Is this the correct condition? Based on the … ![]() |
Re: For starters, your main() is declared with a [B]void[/B] return. It should ALWAYS be declared with an [B]int[/B] return. Beyond that, we can't really help you without specific error information. | |
Re: If you don't know how to do operator overloads yet, you'll want a char-type variable that you read into. After you read in the char, use a switch or an if/else to set the actual value of your employee::pt member. | |
Re: Are they in your include path? On some platforms, the file names are case-sensitive. Do you have the capitalization and/or spelling correct? Are the #includes in a conditional compilation block that isn't compiling under your current configuration? Are they #included by a header that you have forgotten to #include in … | |
Re: It looks like scoping rules and function calling are your big hangups. [URL="http://www.cplusplus.com/doc/tutorial/functions/"]Here's a link to a function tutorial (Part 1).[/URL] [URL="http://www.cplusplus.com/doc/tutorial/functions2/"]Part 2[/URL] Don't bother with Part 2 until you are comfortable with Part 1. | |
Re: Where do [I]temp[/I] and [I]array[/I] come from? I don't see any declarations. Based on usage, I suspect that [I]array[/I] is a member of Set<T>, but where did [I]temp[/I] come from? Make sure you declare it properly before you try to do anything with it. Also, I don't think you're using … | |
Re: On the site you visited, look up [I]vector::push_back[/I] and [I]vector::clear[/I] | |
Re: [QUOTE=decoy684;1203852]ok i managed to get rid of the value 19 from the array and only use it to assign the size of the array, but it still wont read in the last value in the file. Any advice?[/QUOTE] Not without seeing your current code... Best guess, the conditional controlling your … |
The End.