1,358 Posted Topics

Member Avatar for Diogo Martinho

Are you sure that's your current code? The code you posted does not compile. You have undeclared identifiers on Lines 39, 57, and 58. According to your previous post, it should compile. Seriously, read the formatting guidelines that WaltP gave you a link to. You code is almost impossible to …

Member Avatar for Fbody
0
165
Member Avatar for Hey11

So do you want to put in, for example, "3 2" and have it find the second occurrence of the value "3"?

Member Avatar for myk45
0
107
Member Avatar for pharoah85

Perhaps this thread will help. [url]http://www.daniweb.com/forums/thread311226.html[/url]

Member Avatar for pharoah85
0
186
Member Avatar for Lance5057

A little word of advice: When posting code, replace your indentation tabs with spaces, or change your IDE's settings to do it for you. Otherwise, your code winds up looking really strange. Poorly formatted code is prone to errors and is hard to read. It seems that you are missing …

Member Avatar for Lance5057
0
110
Member Avatar for ahaykal

Not unless you tell us something about the errors you are getting. Otherwise, all we can do is make wild guesses. The only thing that I see right off hand is that main() doesn't have a return statement, it's bad practice, but that's not a huge deal. EDIT: Just found …

Member Avatar for ahaykal
0
246
Member Avatar for vbx_wx

Must be a compiler-specific thing. When I run this on VC++ 2008 I get:[QUOTE=VC++ 2008 Console Output]class Security * class Metal[/QUOTE]

Member Avatar for vijayan121
0
106
Member Avatar for kuchick32

[QUOTE=kuchick32;1369807]I'm trying to use a getline function in my program. I have the correct cout function but when I try and enter my input the program keeps wanting me to enter a couple of times and then that's what comes out. I'm very confused on what I'm doing wrong in …

Member Avatar for kuchick32
0
112
Member Avatar for naricpp

Because Y inherits from X. Due to the inheritance, when you have an object of Class Y, you also have an object of Class X that is embedded within the Y object. When you make a copy of the Y object, you are also making a copy of the embedded …

Member Avatar for Fbody
0
147
Member Avatar for BryantFury

The int data type is a numeric type that can only store whole numbers. You are trying to input and compare to characters. These types are not compatible. You must change "ticket" to the char data type. You will also have to "normalize" the input because 'a' and 'A' are …

Member Avatar for Tom83B
0
107
Member Avatar for fantasma

It appears your trying to create a 2-dimensional array. The problem is, a pointer for a 2-Dimensional array has 2-levels of indirection, but you are attempting to create a pointer with 3-levels of indirection. Try taking the [Square Braces] off your declaration of vecCamiao...

Member Avatar for fantasma
0
122
Member Avatar for Sohelp

Welcome. One piece of advice, [URL="http://www.daniweb.com/forums/thread78223.html"]make sure you word your questions very clearly,[/URL] we don't know what you're thinking and we can't see what your working on unless you tell/show us. On that note, I would certainly love to help you, but I don't understand your question. I think you …

Member Avatar for Fbody
0
113
Member Avatar for mrar85

You need to re-initialize fact to 1 when the loop restarts. You are getting such an unusual answer because you haven't reset your program's state. You must always reset your program's state if you are implementing a "would you like to do again?" style loop in it.

Member Avatar for mrar85
0
2K
Member Avatar for Tedius

That sounds like a very worth while assignment. [URL="http://www.daniweb.com/forums/announcement8-2.html"]What have you accomplished so far?[/URL] Is there anything in particular that you had a question about?

Member Avatar for tkud
0
103
Member Avatar for mitrious

You need to "seed" the RNG. If you don't, it will generate the same series of "random" numbers every time. [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/srand/"]Look up the function srand().[/URL]

Member Avatar for mitrious
0
170
Member Avatar for programing

I'm afraid we're going to need more information. It's not real clear what you're trying to accomplish. A nested for loop is nothing more than a for loop inside another statement block of some sort, such as another for loop.[CODE]for (int i = 0; i < limitingValue1; ++i) { //outer …

Member Avatar for Fbody
0
255
Member Avatar for douglaspr

I think you need to check the name of your FILE pointer. It seems to change from "arq" to "arch" then back to "arq"...

Member Avatar for douglaspr
0
112
Member Avatar for OPTIMUS999

When debugging, always start with the first error generated and fix that. Fixing that could potentially fix others. Conversely, it could also reveal others that weren't detectable at the time. There should be error messages that follow those error codes. Can you post the first couple error messages you are …

Member Avatar for NathanOliver
0
2K
Member Avatar for lasl0w

When you use the stream injection operator ('<<') it automatically reads through the array and outputs characters until it reaches a NULL-terminator. The extraneous/garbage characters are any characters that exist between the last char of "your" string and the first NULL that it can find. Properly initializing and/or terminating comp1 …

Member Avatar for lasl0w
0
9K
Member Avatar for bejfake

I can see a couple things here: 1. Have another look at Line 70:[CODE]Square*** tbl = new Square**[xMax];[/CODE] This declares a new tbl variable that is local to your board constructor and is destroyed when your constructor terminates. Because it has the same name as your private variable Board::tbl, it …

Member Avatar for bejfake
0
177
Member Avatar for debasishgang7

The output function printf() is valid C++, it's just a function that's inherited from C. If you in fact want to do this in purely C++, you'll have to use [URL="http://www.cplusplus.com/reference/iostream/manipulators/"]manipulators[/URL].

Member Avatar for Fbody
0
258
Member Avatar for odlanzednanref

Is this project supposed to be OOP? If so, do you know how to find and declare your classes? Have you done so? [URL="http://www.daniweb.com/forums/announcement8-2.html"]We aren't rent-a-coders, I think you need to show us some effort before we can help much more.[/URL]

Member Avatar for Fbody
0
607
Member Avatar for baconswife

I would consider defining Pi as a global constant instead of using the "magic number" 3.1416. That way, you only have to define it once and you can't accidentally enter an incorrect value manually.[CODE]#include <iostream> #include <iomanip> #include <cmath> const double PI = 3.1416; using namespace std; int main () …

Member Avatar for Fbody
0
2K
Member Avatar for Annettest

Before I answer, I have a couple questions. What are the dimensions of the arrays? Are they dynamically allocated or static? Basically, you really need to post some more relevant code, there's not enough here to work with (for me anyway).

Member Avatar for chief427
0
769
Member Avatar for OneRunner

[B]>>First off, Ancient, it surprises me that you've managed to get to 19,000 posts and your standing in here while still remaining such an ass. Amicability shouldn't be countered with such bitchiness. Please feel free to just completely ignore ANY of my posts you ever see.[/B] After a comment like …

Member Avatar for doolali
0
121
Member Avatar for BarnacleBoy

How big are the values we're talking about? [URL="http://www.cplusplus.com/doc/tutorial/variables/"]Many doubles can go out to something like +/- 1.7 E +/- 308.[/URL] You could try a long double, but many compilers implement them the same as a regular double. Without going to an external library specifically designed for extremely large (or …

Member Avatar for vijayan121
0
216
Member Avatar for rramyaasmi

[URL="http://www.daniweb.com/forums/thread78223.html"]You really need to be more specific.[/URL] Making such generic statements makes it very difficult for us to help you. A linker error is returned when the implementation for a function you're calling can't be found. This typicallly happens because you either didn't include the proper object file in your …

Member Avatar for rramyaasmi
0
243
Member Avatar for garu525

I thought you had to read from a file... Either way, that's not correct. You need to input to some input variable then store the value to max and min, not input directly to max or min:[CODE]inFile >> someVar; min = someVar; max = someVar; while (inFile >> someVar) { …

Member Avatar for garu525
0
312
Member Avatar for doolali

I'm not sure exactly what to tell you about your 4 5 issue, but your second question is a pretty common one. What you are experiencing is called "stream corruption". It happens when the data type of the input is not compatible with the data type of the variable expecting …

Member Avatar for doolali
0
558
Member Avatar for bmos31

Do you know how an insertion operation works? What the assignment requires is that you verify there is sufficient space in the stack, then perform an insertion at element 0 rather than storing it to the first available legal space within the array. Something like this:[CODE] //assume the following variables: …

Member Avatar for Fbody
0
153
Member Avatar for miturian

It looks like Intrade has already covered it, but what you need/he suggested is called a "forward declaration". It's the same concept as a function prototype.

Member Avatar for Fbody
0
125
Member Avatar for mrinal.s2008

[QUOTE=Johnny 5]Need input![/QUOTE] Yes, that's correct Johnny, we know nothing. :P @OP: Do you mind posting the code in question?

Member Avatar for Fbody
0
221
Member Avatar for vbgrad

@OP: The algorithm for insertion sort works by scanning through an array from 0 to (ARRAY_SIZE-1). As it does so it re-arranges the elements in the array so that the elements closer to Element 0 (the beginning) than the current position are "sorted" and those elements closer to the end …

Member Avatar for stevanity
0
172
Member Avatar for Fbody

This ad for "Parallels Desktop 6 for Mac": [url]http://i.proadsdirect.com/952912e30c5945a32933d9cfd9b773a2.swf*[/url] Needs to be reigned in. There is something in it that will not allow the site's menu-bar drop downs to display properly. It insists on being the top display layer and blocks access to the menu items. I have been forced …

Member Avatar for Fbody
0
414
Member Avatar for ekailan

Generally a linker error is caused by calling a function that you don't have an implementation for. The linker throws and error saying "you've called this function, and I know it's supposed to exist, but I can't find it." I don't get involved in Win32 programs, but I do know …

Member Avatar for ekailan
0
130
Member Avatar for mybluehair

What you are trying to create is called a function. [URL="http://www.cplusplus.com/doc/tutorial/functions/"] Here is some information.[/URL]

Member Avatar for Master Rattley
0
137
Member Avatar for Fbody

I am trying to sort a vector that is a [B]protected[/B] member of a templated class into a Descending order based on the [I]second[/I] member of the contained std::pair objects. The vector has the following declaration:[CODE]vector< pair <const T, int> > mode; //holds pairs to define the mode(s) of the …

Member Avatar for Fbody
0
3K
Member Avatar for n0de

You're going to have to post some code so that we can see what you are doing. Otherwise, all we can do is take a shot in the dark.

Member Avatar for n0de
0
203
Member Avatar for Jsplinter

You can't initialize values inside a class' definition. You have to do it within the class' constructor(s). For a vector, you would simply declare the vector, then in the constructor you would call either vector::resize or vector::reserve. Which you use depends on how you plan to use the vector later. …

Member Avatar for Jsplinter
0
175
Member Avatar for rashid85

[QUOTE=rashid85;1359390]Dear gerard4143, Yes it is a home work for my sister. and I'm trying to help her with the right code. Thank you.[/QUOTE] Make her do her own homework. How does either of you expect to learn if you don't even try to do it?

Member Avatar for Fbody
-1
167
Member Avatar for RobBobSmith

Try taking out the "splats"... [CODE]template <typename T> void showMatrix(T someMatrix);[/CODE] With them, you are effectively creating a pointer with 4-levels of indirection. A 2-d array (matrix) only has 2-levels of indirection and those should come over to the template with the array/matrix.

Member Avatar for Fbody
0
186
Member Avatar for LevyDee

[QUOTE=LevyDee;1358623]DOH! wow guys, I apologize to who ever looked at this thread. Dont judge me =([/QUOTE] just remember, you can create instances of the std::string class without the header. But, in order to do anything with them, you need it because that's where all the functions/operators are defined.

Member Avatar for Fbody
0
115
Member Avatar for Alexkid

You will get a similar effect with any numeric value that is uninitialized. What the reported value represented is depends on the data type. The thing you need to remember is that this isn't actually a valid value. You didn't specify exactly which compiler you're using, but you alluded to …

Member Avatar for Alexkid
0
2K
Member Avatar for banks2140
Re: HELP

Does the assignment tell you to use 2-arrays? Using an array to store every letter in the file is a little difficult to do unless you know how many letters there are to begin with. You don't have to store them to output them. You can just use a temp, …

Member Avatar for Fbody
0
106
Member Avatar for a-hall

I notice that you are using a lot of "magic numbers" for your array sizes, set sizes, etc... If you are familiar with constants, you may want to consider adding a few to minimize your chances of having issues. This:[CODE]const int SET_SIZE = 15; const int RAND_RANGE = 10; int …

Member Avatar for Fbody
0
144
Member Avatar for sanjuanair

[QUOTE=Unimportant;1357709][CODE] switch( var ) { case 1: // ; break; default: std::cout << "Default." << std::endl; break; } [/CODE] Any case except the integer 1 will output "Default.", as it is the default statement. I cannot think of a different context for this question, if it's something else you'll need …

Member Avatar for Narue
0
125
Member Avatar for subkin13

[URL="http://www.cplusplus.com/reference/std/typeinfo/type_info/"]There is information about a data type known as type_info here.[/URL] If you do something like this:[CODE]#include <iostream> #include <typeinfo> using namespace std; int intFunc(); int main () { cout << "Type of intFunc is: " << typeid(intFunc).name(); return 0; }[/CODE] You will get this:[QUOTE]Type of intFunc is: int __cdecl(void)[/QUOTE] …

Member Avatar for subkin13
0
196
Member Avatar for stevanity

Start by finding the center of the matrix, then expand your algorithm from there. If you have an N x N matrix, where is the center?

Member Avatar for stevanity
0
400
Member Avatar for Fbody

I have a couple of template classes "Stats<T>" and "Numerical<T>" within a "Statistics" namespace. The Numerical<T> class inherits publicly from Stats<T>. They are defined as below.[CODE] namespace Statistics { //declare Statistics namespace template <typename T> class Stats { protected: vector<T> dataSet; //contains the actual data set to be analyzed /* …

Member Avatar for Fbody
0
93
Member Avatar for LloydFarrell

Looks like you have the basic idea, real_escape_string() is good for preventing SQL injection because it escapes special characters. It helps to screen out malicious input from a user. If you want to be sure the actual format of the input is acceptable for the field or database element it …

Member Avatar for Borzoi
0
161
Member Avatar for Hatem Faheem

A "String Literal" is a null-terminated array of char (a C-Style string), it is not a C++-Style string object. This is an important distinction when declaring C++ std::string objects because there are several different overloads of the std::string constructor: The declaration of s0 calls [iCODE]string ( const char * s …

Member Avatar for Hatem Faheem
0
110

The End.