1,358 Posted Topics

Member Avatar for baltik08

[B]>>can someone code this in C++[/B] [URL="http://www.daniweb.com/forums/announcement8-2.html"]Yeah, you.[/URL]

Member Avatar for Dhruv Gairola
0
794
Member Avatar for sairakhalid

Variations of this question have been popping up with disturbingly high frequency the last couple weeks. Did you try searching the forums at all? To dynamically allocate a 2-D array, you need to declare the array pointer as a pointer-to-pointer (i.e. dataType **ppName), not simply a single pointer (i.e. dataType …

Member Avatar for sairakhalid
0
130
Member Avatar for oggiemc

The variable "name" is an array of std::string. As such, the actual variable called "name" is a pointer to std::string. Since it's a pointer to std::string, you can't input to it directly. You need to input to an element of the name array:[CODE]std::string array[10]; for (int i = 0; i …

Member Avatar for oggiemc
0
117
Member Avatar for shasha123

Here's a start:[CODE]#include <iostream> using std::cout; using std::cin; int main() { return 0; }[/CODE] Fill it in. You can start by getting the inputs from the user...

Member Avatar for Fbody
0
82
Member Avatar for aaronmk2

Bubble Sort is dependent on performing multiple swaps to move values to their sorted locations. The idea is that if no swaps are performed, then logically everything must be in the proper location. If everything is in its proper location, the sort is finished whether all passes have been completed …

Member Avatar for Fbody
0
3K
Member Avatar for FumarMata

A couple quick questions first: How many instances of "MyClass" do you intend to have in your final program? Other than the declaration, do you intend to use this vector anywhere else outside "MyClass"? This sounds like a candidate for a static member variable, but it depends on your answers.

Member Avatar for Fbody
0
200
Member Avatar for txwooley

[QUOTE=txwooley;1377266]So the "% x" is required? I only know about rand() because of a tutorial I am reading. The author used rand() to create a numbers guessing game, but did not give it parameters. Thanks for the help guys.[/QUOTE] No. This statement: [iCODE]x = rand() % 1500 + 1;[/iCODE] is …

Member Avatar for Fbody
0
97
Member Avatar for newCoder1545

Did I miss a question buried somewhere in that wall of unreadable code? [URL="http://www.daniweb.com/forums/announcement8-3.html"]In the future, please use [B][COLOR="Red"][noparse][CODE]..code blocks...[/CODE][/noparse][/COLOR][/B] when posting code.[/URL] Also, [URL="http://www.daniweb.com/forums/thread78223.html"]please be more clear about what your issue is[/URL]. There are very few of us that can divine it.

Member Avatar for WaltP
0
142
Member Avatar for dotbat
Member Avatar for dotbat
0
311
Member Avatar for smartmedia

Hmmm.... I don't know if I can help with this particular issue (kinda rusty). But you don't have to "send" it. [URL="http://www.daniweb.com/forums/announcement8-3.html"]Just post it here.[/URL]

Member Avatar for smartmedia
0
330
Member Avatar for Sohelp

Function overloading is the process of writing multiple versions of the same function to operate differently based on the argument dataType(s) and/or argument count. Which version of the function gets called/executed depends on the arguments provided. A common example is an "area" function from geometry. You can overload area() to …

Member Avatar for gerard4143
0
118
Member Avatar for Sohelp

Generally, an inline function is [B]requested[/B] when it's a short function (as in only 4 or 5 lines) and you don't want the additional execution overhead associated with a function call. This makes for quicker execution, but that's offset by a larger program because of all the extra code expansion. …

Member Avatar for Sohelp
0
250
Member Avatar for theashman88

Where exactly are you stuck? Does it have anything to do with this function:[CODE]int calCredit(int numChildren, double income) { int totCredit = 0; totCredit = numChildren * 1000; if (income < 70,000) { if (totCredit > 4000) { totCredit = 4000; } } return totCredit; }[/CODE] Because I can tell …

Member Avatar for theashman88
0
1K
Member Avatar for keskor

We certainly can help, but I'm afraid [URL="http://www.daniweb.com/forums/thread78223.html"]you're going to have to do better than that[/URL] if you want any [B]useful[/B] help. We don't know anything about your situation or goals except that you are trying to implement an operator that works for char. [URL="http://www.daniweb.com/forums/announcement8-2.html"]Also, please don't expect us to …

Member Avatar for Fbody
0
68
Member Avatar for daviddoria

Do you have access to the definition of the itk::RescaleIntensityImageFilter template? Are you sure it takes 2 template arguments? EDIT: Oops, a little slow... Don't you hate it when you get sidetracked?

Member Avatar for Fbody
0
4K
Member Avatar for Leppie

[QUOTE=Leppie;1376908]Thanks David, I'll examine the links and try to proceed, one quick question, does the file need to be closed between inputting and outputting or can I do both operations to the file and just close it at the end? (If it's answered in the links then sorry for the …

Member Avatar for Fbody
0
211
Member Avatar for simply_viks

You'll have to post some relevant code. Without it we haven't a clue. It sounds like you attempted a declaration either that you didn't need to or incorrectly. The only way to know is to review the code.

Member Avatar for Fbody
0
99
Member Avatar for aaronmk2

If I'm reading it correctly, it's using a recursion to perform the insert operation after it finds the sorted location of the first unsorted element. It takes the place of this part of the algorithm:[CODE] if (m_DataSet[unsorted] < m_DataSet[destination]) { //if the unsorted element should be before the destination element …

Member Avatar for mrnutty
0
1K
Member Avatar for L.sha

[B]>>The build is successful but I have 2 errors while compiling here is my code[/B] Um, last I checked, if you have 2 errors while compiling, the build isn't successful... It might be useful if you shared those errors. Very few, if any, of us are psychics. We can't even …

Member Avatar for L.sha
0
189
Member Avatar for digan

[QUOTE=SgtMe;]Firstly, you have you have this line wrong: [CODE]while (quantity >50);[/CODE] Surely it should be '<' instead? ...[/QUOTE] No, that loop is an input validation loop so the OP has the condition correct. The problem is they used a do-while loop, which isn't the correct type of loop. Since it's …

Member Avatar for arkoenig
0
129
Member Avatar for ace8957

When one class inherits from another, the object of the derived class has contained within it an object of the base class. In order for the inheritance to work with templates, you have to provide a template argument for the compiler to use when generating the base object. Thus the …

Member Avatar for Fbody
0
738
Member Avatar for sharifyboy7

According to your code, the variable "x" is an object of type "ItemType". Also, according to your code, "ItemType" is a typedef for the built-in "float" type. I think that pretty much explains why it's throwing errors when you try to call x.getLength(), x.comparedTo(), x.ComparedTo(). Also, notice the capitalization differences …

Member Avatar for Fbody
0
354
Member Avatar for ggyyree

Line 24 "updatedCost = cost" is an error because you are trying to store a "CostType" to a double pointer. How is "CostType" defined? This looks like an attempt at a template, but it's not implemented correctly. The error on Line 26 is the result of attempting to modify an …

Member Avatar for Fbody
0
572
Member Avatar for frogboy77

Well, it's a couple things: First, there is no version of the new operator that can create a 2-dimensional array directly. The operator new[] can only be used for 1-dimensional arrays. You must use the operator multiple times to produce a multi-dimensional array. Second, a 2-dimensional array uses 2-levels of …

Member Avatar for frogboy77
0
123
Member Avatar for Violet_82

What you have done is correct. All those folders are is an organizational tool whose display is facilitated by an XML file called a "project file". If you look at your computer's actual file system, those folders don't exist. All 3 files are in a folder that is named after …

Member Avatar for Violet_82
0
432
Member Avatar for tehreem

For starters, please use proper written English, not TXT. [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]Have you read the member rules?[/URL] [QUOTE=Member Rules] Keep it Clear [LIST] [*]Do post in full-sentence English [*]Do wrap your programming code blocks within [noparse][code] ... [/code][/noparse] tags [*]Do use clear and relevant titles for new threads [*][B]Do not write in …

Member Avatar for stokes1900
0
147
Member Avatar for urbangeek

[QUOTE]Examples include substituting the <X> header for the <X.h> \ header for C++ includes, or <iostream> instead of the deprecated header \ <iostream.h>.[/QUOTE] Um..... I think your compiler has said it all... Try actually reading it. The way you've written your code is not per the current C++ standards. There …

Member Avatar for urbangeek
0
300
Member Avatar for Dazaa

When templatizing a class, you need to use a template statement before the class definition. Additionally, a matching template statement should preceed each function implementation that is not part of the class's definition. You only need the Template Parameter on the class name, not the function name. This:[CODE] Vector<T>::Vector<T>() :capacity(0), …

Member Avatar for Fbody
0
6K
Member Avatar for confounded

That's normal. In the STL end() returns a pointer that is 1 past the last element in your container. If it returned a pointer to the actual last element, you would not be able to use it for traversal operations. This wouldn't work if that wasn't how it behaved:[CODE] std::list<int>::iterator …

Member Avatar for confounded
0
188
Member Avatar for Ivanero

First, why is arr global? Does your assignment require it to be? You really should move arr to the local scope of main(). Second, your functions aren't defined properly. They are defined to work on a single element of the array, not the entire array. You will have to make …

Member Avatar for Ivanero
0
194
Member Avatar for rAshter

Actually, even though it really should be addressed, the warning itself isn't a serious problem. It certainly could be, that's why there's a warning generated, but the value is input a couple lines later. That variable is part of the problem though. It is declared as a pointer to char, …

Member Avatar for gerard4143
0
118
Member Avatar for getack

It is understood that you are asking about an issue in your *.h file and that there are no #includes above this class' definition. gerard is asking you about your *.cpp files. With an error like this, the cause of the problem frequently is not actually in the file that …

Member Avatar for gerard4143
0
5K
Member Avatar for vbx_wx

OOP is based on classes. This is usually a topic covered at the end of a book used for coursework. Here is a link to the first of several tutprial pages on cplusplus.com: Start on this page, then read the next 4 or 5 pages. [url]http://www.cplusplus.com/doc/tutorial/classes/[/url]

Member Avatar for Fbody
0
57
Member Avatar for EngSara

More information would be helpful. What are you trying to accomplish? Are you trying to create a single-dimension array of pointers to something or a multi-dimensional array of pointers to something else (?[B]int[/B]s?, perhaps) ? I'm having a hard time telling from the context of your code...

Member Avatar for shijobaby
0
183
Member Avatar for Sunday1290

Where are your declarations of ROWS and COLUMNS? I don't see them. I would start by deciding how you're going to identify the Columns (x-coordinate) and Rows (y-coordinate) of player moves. I think you should consider getting from the user the column (x-coord) that they want to place a "chip" …

Member Avatar for doc13p
0
2K
Member Avatar for realproskater

For starters, why are firstanswer and secondanser global? They should be local to main(). Also, the global a and b are of no value to you and should not exist, get rid of them. Your loop is not built correctly. You have an infinite loop. What's wrong with this line:[CODE]while …

Member Avatar for realproskater
0
186
Member Avatar for vbx_wx

[QUOTE=arshad115;1372090]worked fine on my pc. gave this output: X() Y() Z() f() press any key to continue. I am using Visual studio 2008,windows[/QUOTE] When Multiple inheritance isn't implemented properly, what happens is highly compiler specific. Users of VC++ are the lucky ones, it will APPEAR to work correctly. To implement …

Member Avatar for mike_2000_17
0
105
Member Avatar for Mbot

[QUOTE=Ancient Dragon;1372033]what compiler are you using? AFAIK all c++ files are named either *.cpp or *.cc, depending on the compiler. g++ on *nix normally use *.cc.[/QUOTE] This is the third thread I have seen on this same assignment, at least. [URL="http://www.daniweb.com/forums/thread321477.html"]"';' expected before class"[/URL] [URL="http://www.daniweb.com/forums/thread321452.html"]"Initializing specific objects"[/URL] The OPs classmates …

Member Avatar for Fbody
0
497
Member Avatar for indr

It's a function that is supposed to return a pointer to a list_link. As defined though, it doesn't doesn't do anything useful.

Member Avatar for arshad115
0
126
Member Avatar for Alexkid

[URL="http://www.cplusplus.com/reference/iostream/"]Look up something called a stringstream, that will help alot.[/URL]

Member Avatar for Ancient Dragon
0
198
Member Avatar for Lord_Migit

[B]>>something is either running out of memory or looping too far and trying to access a part of the vector that dosnt exist[/B] That's exactly what it means. I haven't looked at the attached files yet, but I don't see anything in the code that you posted that should be …

Member Avatar for Fbody
0
678
Member Avatar for sharifyboy7

Once you encrypt the string, what are you supposed to do with it? Right now, I'm not exactly sure what you're doing, but it's not generating an encrypted string.

Member Avatar for sharifyboy7
0
256
Member Avatar for nayefc

Your code is organized a little strange so I'm having a hard time wading through this. It looks like the problem is that you are using local variables incorrectly and not storing anything to the appropriate member variables. I don't see any instance where you access [iCODE]this->mHead[/iCODE] or [iCODE]this->mTail[/iCODE]...

Member Avatar for nayefc
0
3K
Member Avatar for jjspikejones

[URL="http://www.daniweb.com/forums/announcement8-2.html"]Nice Copy/Paste job. Why don't you show us how to do this?[/URL] You must know something about writing a program. Start by writing a program that determines if a number is prime. Then, expand its capabilities. Here's a start:[CODE]#include <iostream> using std::cout; using std::cin; using std::endl; int main() { return …

Member Avatar for Fbody
-2
160
Member Avatar for koolman123

You don't need conio.h, there is almost never an occasion to use that [B]non-standard[/B] header. [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]Also, this isn't your thread, start your own.[/URL]

Member Avatar for Fbody
0
223
Member Avatar for phfilly

[B]>>sorry that smiley is not supposed to be there![/B] Use the [noparse][noparse]...[/noparse][/noparse] tag to prevent things like that. Your error is that you are attempting to use "new" to create the objects stored in your Piece arrays. The return from new is a pointer to an object, not an actual …

Member Avatar for Fbody
0
276
Member Avatar for frogboy77

The issue is most-likely that "is_prime.cpp" is not getting compiled as part of your compilation process. What OS and IDE are you using? Is the file "is_prime.cpp" included as part of your "project" in your IDE? If not, it doesn't get compiled and the linker can't find the object code …

Member Avatar for frogboy77
0
140
Member Avatar for Jsplinter

If you only want to allocate pbuffer once, then yes, I think a std::string probably would be a good choice. It's essentially a vector of char which gives you access to many of those features and functionalities. Plus, it gives you the option to use stringstreams and other more-convenient operators/methods …

Member Avatar for Jsplinter
0
157
Member Avatar for jmcorpse

Um... I think it will make your life much simpler if you make better use of loops. A prime example:[CODE]void getMonth(string months[])// Asks user for current month. { int month = 1; cout << "\nPlease enter the current month. " << "Use 1 for January, 2 for February, " << …

Member Avatar for Fbody
0
103
Member Avatar for techie1991

[B]>>The methods you stated seem to be for arrays, but I am asking for multidimensional arrays. So, please try to stick to the area of concern..[/B] Once you figure out single-dimensional arrays, it is not a big leap to multi-dimensional, so it is "the area of concern". Each dimension of …

Member Avatar for Fbody
0
216

The End.