1,358 Posted Topics

Member Avatar for jwelsh

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 …

Member Avatar for corby
0
621
Member Avatar for maryam ahmad
Re: pow

Are you using the correct namespace? Can you post your #include and using statements?

Member Avatar for Fbody
0
155
Member Avatar for daniel88

[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 …

Member Avatar for daniel88
0
163
Member Avatar for riotburn

[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().

Member Avatar for riotburn
0
328
Member Avatar for vivosmith

Did you bother to read pages 2-4 of the article you linked? They explain fairly well...

Member Avatar for Fbody
0
105
Member Avatar for Piyush07

[URL="http://www.daniweb.com/forums/thread78223.html"]Hunh?.... Make some sense, then maybe we can help you.[/URL]

Member Avatar for Fbody
-1
39
Member Avatar for jephthah

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 …

Member Avatar for Dani
8
2K
Member Avatar for kourt32

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 …

Member Avatar for mitrmkar
0
104
Member Avatar for gregarion

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.... …

Member Avatar for gregarion
0
115
Member Avatar for Roses89

[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?

Member Avatar for NathanOliver
0
129
Member Avatar for KBL

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 …

Member Avatar for KBL
0
11K
Member Avatar for Leppie

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.

Member Avatar for Leppie
0
115
Member Avatar for babydol

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 …

Member Avatar for WaltP
0
106
Member Avatar for boiishuvo

[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]

Member Avatar for boiishuvo
0
150
Member Avatar for Scu

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 …

Member Avatar for Scu
0
324
Member Avatar for TheCur3

[URL="http://www.daniweb.com/forums/announcement8-3.html"]You still have time to edit, add [code] tags, and I'll consider helping.[/URL]

Member Avatar for ccw87
0
274
Member Avatar for yongj

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. …

Member Avatar for Fbody
0
193
Member Avatar for pash101

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 …

Member Avatar for pash101
0
249
Member Avatar for lllllIllIlllI

[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 …

Member Avatar for NathanOliver
0
177
Member Avatar for close_encounter

Add some accumulators between Lines 52 and 53. i.e. [CODE] accumulatedTotal += currentRecord.valueToAccumulate; /* ...etc...*/ [/CODE]

Member Avatar for Fbody
0
133
Member Avatar for iammfa

Make a loop and iterate over the array. While looping, use comparison statements to compare the elements to each other.

Member Avatar for chiwawa10
0
165
Member Avatar for Chris_Giarla

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).

Member Avatar for Fbody
0
203
Member Avatar for Roo0ond

[URL="http://www.daniweb.com/forums/announcement8-2.html"]>>please ilove you... I'm not inclined to help, you're creepy...[/URL]

Member Avatar for Fbody
-2
81
Member Avatar for empror9

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. …

Member Avatar for empror9
0
69
Member Avatar for Atlanticspace

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"...

Member Avatar for umairch
0
278
Member Avatar for Violet_82

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]

Member Avatar for Violet_82
0
253
Member Avatar for passionatecoder

[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 …

Member Avatar for Fbody
0
654
Member Avatar for naseerhaider

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 …

Member Avatar for naseerhaider
0
120
Member Avatar for CrazeBoY

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 …

Member Avatar for Fbody
0
132
Member Avatar for ollie60

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 …

Member Avatar for caut_baia
0
89
Member Avatar for etisermars

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 …

Member Avatar for Fbody
0
3K
Member Avatar for HoboConductor

@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.

Member Avatar for Fbody
0
114
Member Avatar for LeoC++
Member Avatar for casjackkwok2001

[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 …

Member Avatar for Fbody
0
123
Member Avatar for close_encounter

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 …

Member Avatar for close_encounter
0
94
Member Avatar for Tonyd71

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?

Member Avatar for JohnKSmith
0
84
Member Avatar for Teethous

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.

Member Avatar for Fbody
0
165
Member Avatar for Annettest

@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 …

Member Avatar for Annettest
0
192
Member Avatar for Ianonfire

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 …

Member Avatar for Fbody
0
118
Member Avatar for nomorewords
Member Avatar for NickMalone85

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.

Member Avatar for NickMalone85
0
86
Member Avatar for Annettest

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 …

Member Avatar for Annettest
0
106
Member Avatar for kingben

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 …

Member Avatar for kingben
0
244
Member Avatar for HoboConductor

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.

Member Avatar for caut_baia
0
2K
Member Avatar for fugnut

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.

Member Avatar for Fbody
0
131
Member Avatar for Duki

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 …

Member Avatar for Fbody
0
560
Member Avatar for Justin9825

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.

Member Avatar for Justin9825
0
208
Member Avatar for illway

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 …

Member Avatar for Fbody
0
111
Member Avatar for SacredFootball

On the site you visited, look up [I]vector::push_back[/I] and [I]vector::clear[/I]

Member Avatar for VernonDozier
0
134
Member Avatar for decoy684

[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 …

Member Avatar for rurouni
0
318

The End.