2,827 Posted Topics

Member Avatar for Clinton Portis

>> It was originally I spotted this in the debugger yesterday and what was happening it was evaluting 3 of a kind last.. which gave it preferrence as a deciding score. So as an easy fix I just did a reverse array traversal of low_weight[ ] to evalute 'yahtzee' last …

Member Avatar for Clinton Portis
0
166
Member Avatar for GrimJack

>> The researcher never actually returned He does in the video link you posted, which I guess is a modern re-make. So am I to understand that in the original version, the researcher never returns and thus the kid never gets the promised second marshmallow? Fifteen minutes is a long …

Member Avatar for GrimJack
1
158
Member Avatar for VernonDozier

I'm having some problems using PHPMailer sending to gmail. I have plain-text and HTML e-mail contents. Mail is successfully received at an e-mail address in yahoo mail and an e-mail address in gmail. The problem is that the gmail e-mail shows up in plain text(all HTML formatting removed). The Yahoo …

0
76
Member Avatar for kapilsolanki84

[QUOTE=alexchen;]It is impossible. If it is possible it will become useless.[/QUOTE] It's possible. It's not useless. The OP will need to elaborate more on his/her needs. Any output can go anywhere. It can go to the console. It can go to the serial or USB port. It can go to …

Member Avatar for VernonDozier
0
213
Member Avatar for misfit956

Use code tags. [noparse] [code] // code here [/code] [/noparse] If you are going to use dynamic memory, use the "new" and "delete" commands. [url]http://www.cplusplus.com/doc/tutorial/dynamic/[/url]

Member Avatar for misfit956
0
130
Member Avatar for Suzie999

When you "release" code and executable files, you should have a README explaining what the dependencies are and you should either include the dependencies in the relase or explain in the README what needs to be obtained in order to use your code/program. for example, if you write a DLL …

Member Avatar for Suzie999
0
116
Member Avatar for smrati.katiyar

I compiled and ran it and was surprised it compiled and ran at all. Regardless, I think you're playing with fire memory-wise. I'm not sure what this does or why you can get away with it, but I think it's just luck. There must be some default array size somewhere …

Member Avatar for VernonDozier
0
86
Member Avatar for rena0514

>> What is it that i need to do? You need to either write your own isEmpty() function or you need to use one of the functions provided by C++'s stack. There is no isEmpty() function in stack, and even if there was, you would still get the error since …

Member Avatar for thelamb
0
253
Member Avatar for jadelopez

Line 7 - a[] and n are your inputs. How do you do you calculate average, sum, and sum squared on paper? Do it the exact same way here. You need a loop and the loop parameter is going to have something to do with n. Within that loop you're …

Member Avatar for VernonDozier
0
163
Member Avatar for Suzie999

[LIST=1] [*]Why bother porting it? Go into the Properties and change it so it compiles using C. [*]No clue whether the windows.h and stdafx.h can be ported to C, but the rest of the code can be ported to C++ easily. I see a problem with the struct syntax, but …

Member Avatar for Suzie999
0
229
Member Avatar for anglwthnati2de

I don't see any "push_back" statements. The whole idea of a vector is that you don't have to specify any array indexes. If you're going to do that, might as well use an array, not a vector.

Member Avatar for DarthMustard
0
119
Member Avatar for SabinIvy

The thing is I am trying to turn my code from this: [code] *______* **____** ***__*** ******** ***__*** **____** *______* [/code] into this: [code] *________* **______** ***____*** ********** ***_**_*** **__**__** *___**___* ____** ____** ____** ____** ____** [/code] Replacing the underscores with spaces. The side being depended on the entered number …

Member Avatar for VernonDozier
0
446
Member Avatar for MatthewT

My (quite limited) history with using serial ports is that I've always used them for data, not pin high/pin low. I've used the "Java Comm" package and a similar class with Visual C++ (can't for the life of me remember which, but it was not part of Visual Studio. Someone …

Member Avatar for VernonDozier
0
100
Member Avatar for Philosophy

I'll throw in some debugging hints rather than analyze the code itself. You need to find out WHERE and HOW these files are considered different. To that end, for each itereation through the loop, display wehn the test PASSES, not just when it fails. It may fail immediately after reading …

Member Avatar for Philosophy
0
496
Member Avatar for daviddoria

>> YES opens a complete description of how to use them. The problem is there [B]IS[/B] no complete description/pinned post saying "How to post correctly using code tags" explaining what code tags are, how to use them correctly, why it's important, etc. There has been endless debate on how to …

Member Avatar for jon.kiparsky
0
430
Member Avatar for skorm909

What happened to Narue's old pinned thread on clearing the buffer? It was great. I won't recreate it here. The issue is that >> and get and getline act differently, so when you mix them, you often end up with whitespace remaining in what you thought was a clean buffer. …

Member Avatar for skorm909
0
3K
Member Avatar for brycematheson

There's more than one way to do it. Myself, I would set up a boolean array of size 9. Set all elements to true. Now go through the column. Set the array for each element in the column to false. Then do the same for the row. Set the flag …

Member Avatar for VernonDozier
0
443
Member Avatar for Philosophy

You'll want to take a look at your encrypted file. Seems to me it will end up being a long line of digits with no spaces, tabs, commas, etc. dividing them: [code] 345423562352345423512341234234534253455432454325 [/code] or whatever, representing a bunch of integers. Here's the problem. When you open the file again …

Member Avatar for Philosophy
0
279
Member Avatar for JeremyJ

There should be a file called libcurl.so and/or a file called libcurl.a in the /usr/lib directory. You need to link one of them. I use the .so file, but I imagine it doesn't matter. Here's a decent tutorial on linking shared objects. [url]http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html[/url]

Member Avatar for JeremyJ
0
746
Member Avatar for notmasteryet

Lines 14 and 15 need types. Line 15 needs an array size. The question is too vague. How to read from the file depends entirely on the makeup of the file. You also need to specify whether you need to write your own << and >> operators.

Member Avatar for muze
0
148
Member Avatar for pgr_DW808

Your setw values in displayStockInfo() don't match your setw values in lines 81 -85, 97 - 101, so I'm not surprised things don't line up. Try using the same numbers?

Member Avatar for pgr_DW808
0
131
Member Avatar for svatstika

One of your lines of code calls a function that somewhere in the line of stack calls calls a function that has requirements for valid parameters passed to it and uses an "assert" function to validate those parameters. In your case a parameter flunked the test and the program aborted. …

Member Avatar for VernonDozier
0
262
Member Avatar for bookmark

The indentation is off and therefore hard to read/debug. Here's the program with better indentation on the loops: [code] #include <iostream> using namespace std; void alternatingSquare(unsigned n); void square(unsigned a); void hollowSquare(unsigned a); int main(){ for (unsigned size = 3; size <= 6; ++size) alternatingSquare(size); cout << endl; system("pause"); return …

Member Avatar for VernonDozier
0
129
Member Avatar for majood

For debugging purposes I would set up a char buffer the size of CharOrderTuple and read the file into it. Then take the strlen of it and see if it is the correct length. If it is, copy it over to CharOrderTuple with memcpy. If it's too short, I'm guessing …

Member Avatar for VernonDozier
0
1K
Member Avatar for jengah27

>>however I still need to make it convert whole numbers instead of just integers. Ex: 0.22 or 13.587 etc. Whole numbers are integers. 0.22 and 13.587 are decimals. You may need to develop a more complex algorithm mathematically for this. I'm not sure that just using the % operator will …

Member Avatar for VernonDozier
0
794
Member Avatar for The Dude

I got over 100. That's as specific as I'm getting. It doesn't tell you how many or which ones you got wrong.

Member Avatar for The Dude
-1
127
Member Avatar for peachslasher

[QUOTE=peachslasher;625042]Hi guys, I am trying to write C++ method to return a pointer to the parent of a particular node in binary tree, and for the root that doesn't have a parent should return NULL. Here is my program so far: [CODE]#include <iostream> using namespace std; class Tree { private: …

Member Avatar for che-burator
0
3K
Member Avatar for maverick405

This is what I've been harping on since the major change-over at Daniweb. Java code is now flagged as C++ code instead of plain-old code if you don't specify Java-specific code tags. It automatically assumes the C++ language. It really bugs the hell out of me. I don't know about …

Member Avatar for yasy
0
5K
Member Avatar for Glapsides

>> By the way, there is an error in this code which will not be directly visible except to an experienced programmer. So now you've spotted an error, but won't say what it is? Anyone completing the code has to fix the error too? To say nothing else, I admire …

Member Avatar for Glapsides
-4
117
Member Avatar for dnambembe

It runs for me and calls the GetNext function three times, as expected. What is your output and does it run to completion?

Member Avatar for dnambembe
0
128
Member Avatar for format_c

"Crashing" how? What line number? Lines 21, 27, 33, 39 are indented, yet not part of any if statement. Are they supposed to be? If so, you need some brackets.

Member Avatar for VernonDozier
0
101
Member Avatar for salamjamal10

>>After I remove the first item from the array, everything will be affected and the program wont execute. Is this correct? The program should always execute. If it doesn't, there's a bug Arrays are always consecutive. No holes are allowed, so things need to be adjusted. Adjusting involves moving memory …

Member Avatar for VernonDozier
0
205
Member Avatar for Nandomo

You need to take the struct definition on lines 1 to 28 out of main and stick it above the first function declaration that uses it on line 16. If you change the struct to an array, it might also be easier: [code] struct comboNums { int numbers[5]; }; [/code] …

Member Avatar for Nandomo
0
796
Member Avatar for kelechi96

Lines 40 and 46 - These lines won't compile at all with many compilers since dicerolls isn't constant. Where exactly does it crash? What line number and what's the error message?

Member Avatar for kelechi96
0
132
Member Avatar for ladylove

Here's the code you posted. Does it compile? What's the question? You apparently have created the GUI, but I don't see the calculation code. As a design note, I don't know if I would have "car" extend JFrame. Consider naming your JFrame "InterestCalculationGUI" or something. When I see "Car", I …

Member Avatar for javaAddict
0
863
Member Avatar for jemes bond

It's a common assignment. How in depth are you getting here? It can be fairly trivial or a huge multi-city, multi-day, multi-airline project. You haven't given us the detail we would need to help too much. As far as tools go, depends on the operating system and again, what you …

Member Avatar for geojia
0
373
Member Avatar for imprezal2345

The devil is in the details. Is there a GUI involved somewhere? What's the operating system? When and whether to use threads versus processes and how and whether to share memory and how one process communicates with another is all on a case-by-case basis. It's hard to offer an opinion …

Member Avatar for imprezal2345
0
1K
Member Avatar for borogirl09

What exactly is the problem? It compiles fine. Right off the bat, though, I ran it without the input file and it doesn't exit, so you need to change it so it checks for a bad stream before attempting to retrieve data.

Member Avatar for VernonDozier
0
155
Member Avatar for TSims11

Then you need to have a file in the root directory and use the fstream library to read from it and write to it. When the user clicks one of the buttons or whatever, you'll have a function that is called and figures out what to read/write based on whatever …

Member Avatar for Ancient Dragon
0
111
Member Avatar for justinbailey

You tackle it by keeping a tally of the number of times you go through the loop for a given n, then finding a pattern and making a math program from it. So assign n to equal 1 and figure out how many times the cout statement displays. The do …

Member Avatar for justinbailey
0
170
Member Avatar for awais1a

Please repost using code tags. [noparse] [code] // code here [/code] [/noparse] [LIST=1] [*]Use iostream, not iostream.h [*]conio.h is not needed. All it does is complicate things for the rest of us. [*]Ditto clrscr(). It adds nothing to the program, plus we can't compile it. [*]Change "void main" to "int …

Member Avatar for VernonDozier
0
182
Member Avatar for nikki33

[code] int songNumber = 1 2 3 4 5 6 7; [/code] This is illegal. Try this: [code] int songNumber[] = {1, 2, 3, 4, 5, 6, 7}; [/code]

Member Avatar for SgtMe
-2
221
Member Avatar for Alkaline8214

Here's your code, formatted. [code] #include <iostream> #include <queue> #include <time.h> using namespace std; class Customer { private: int arrivalTime; int serviceTime; public: Customer() { arrivalTime = 0; serviceTime = 0; } Customer(int arrival) { arrivalTime = arrival; serviceTime = rand()%9 + 2; } bool done() { return (serviceTime-- <= …

Member Avatar for VernonDozier
0
4K
Member Avatar for serkan sendur

If you are looking for wisdom, inspiration, characters as role models who toil with the big moral issues about how to live life, here's a few... Mississippi Burning A Time To Kill Angels With Dirty Faces State Of Grace The Grey Zone

Member Avatar for ronnieaka
0
1K
Member Avatar for hondros

[LIST=1] [*]Why did you write your own strlen function? [*]Should your strlen function return the same value as cstring's strlen function? [*]If so, you need to rewrite strlen because it gives bad results (i.e. "a" will return 2, not 1). [/LIST]

Member Avatar for VernonDozier
0
207
Member Avatar for MasterGberry

>> I have a feeling my logic is off here.....crashes randomly depending on input Seems to me it should crash EVERYWHERE, REGARDLESS of input. Nowhere do you have the following: [code] new double[...] [/code] Yet you fill in the array with doubles. That's a seg fault. There's no memory for …

Member Avatar for MasterGberry
0
92
Member Avatar for nickx522

Your program flow is a little off. You want to have an outer loop that you go through once per game and an inner loop that you go through once per guess. You get out of the inner loop by guessing correctly or deciding you don't want to guess anymore. …

Member Avatar for Nandomo
0
98
Member Avatar for Nandomo

Lots of different ways to do all of this. Some require using one dimensional arrays, some require using two dimensional arrays, some requiring no arrays at all. I don't know why you'd want a 2-D array here unless you are using C-Style strings. Use C++ style strings and you only …

Member Avatar for Nandomo
0
179
Member Avatar for xfreebornx

One, mark your old threads dealing with this question solved so people don't waste time commenting on them there instead of here. Two, what's the question?

Member Avatar for A.Ali
0
285
Member Avatar for globberbob

Not sure if you intend this, but you have you open and close your file within your do... while loop. That means that you're going to continuously overwriting it. Beyond that, assuming that the above isn't the problem, as far as debugging, stick some pauses in there after it opens, …

Member Avatar for globberbob
0
137

The End.