Search Results

Showing results 1 to 40 of 177
Search took 0.03 seconds.
Search: Posts Made By: VernonDozier ; Forum: C++ and child forums
Forum: C++ 2 Days Ago
Replies: 5
Views: 313
Posted By VernonDozier
If you don't get any of the lines that I added as cout statements, that means that they aren't being executed even once, so it's breaking somewhere, and very early.

Whether the code is the problem...
Forum: C++ 3 Days Ago
Replies: 5
Views: 313
Posted By VernonDozier
I formatted the code to make it easier to read and added a few lines - see "Added by VD" in comments. cin.get() pauses so you have time to read. Press the "Enter" key to move on. Delete later. ...
Forum: C++ 10 Days Ago
Replies: 13
Views: 364
Posted By VernonDozier
My advice is to create both classes that I suggested:


class Merchandise
{
string product;
double price;
};

class GroupedMerchandise
Forum: C++ 11 Days Ago
Replies: 6
Views: 302
Posted By VernonDozier
Lines 15 - 24 - This loop is a black hole. Once you get to line 23 the first time, if you get to it, you'll never get out. Well, you'll get out when you go through it MAX_SIZE times, so that's a...
Forum: C++ 12 Days Ago
Replies: 8
Views: 216
Posted By VernonDozier
"Voila! Syntax-highlighting!" isn't part of the code tag. niek_e is just excited by the power of code tags and decided to spread the enthusiasm. Feel free to replace "Voila! Syntax-highlighting!"...
Forum: C++ 13 Days Ago
Replies: 14
Views: 385
Posted By VernonDozier
You need to meet more C++ programmers then. Custom namespaces are all over the place, for good reason. I just debugged my own (very short) project. The culprit? I had several functions called...
Forum: C++ 15 Days Ago
Replies: 25
Views: 1,255
Posted By VernonDozier
"Simple", "efficient", "correct", and "not tedious" are different concepts. Your "easiest", most brain-dead method is to make 120 "if" statements, not taking advantage of the results of previous...
Forum: C++ 15 Days Ago
Replies: 25
Views: 1,255
Posted By VernonDozier
Five numbers can be ordered 5! or 120 ways. The no-brainer way of writing this code would thus be writing an if statement with 119 "else if" statements, one for each possible ordering. You should...
Forum: C++ 18 Days Ago
Replies: 3
Views: 258
Posted By VernonDozier
Add this to your Header.cpp file:


List::~List()
{
}


or delete this line in Header.h:
Forum: C++ 30 Days Ago
Replies: 17
Views: 460
Posted By VernonDozier
Lines 20, 88. Arrays already are passed by reference. Get rid of the ampersand:


void medic(int & money, int & potionsize[5]);


Delete the ampersand in red above on line 20 and on line 88....
Forum: C++ 33 Days Ago
Replies: 4
Views: 211
Posted By VernonDozier
These lines are not being skipped. The Fahrenheit values are 32 larger than the Celsius values, which suggests that at least part of the equation is working. Comment the lines out and pick a...
Forum: C++ Oct 28th, 2009
Replies: 8
Views: 354
Posted By VernonDozier
Here's what I think you should do. Don't worry for now about why/how the code did what it did (obviously, you can and probably should go over it later and figure out what it does and why for your...
Forum: C++ Oct 25th, 2009
Replies: 11
Views: 561
Posted By VernonDozier
Is this a code parser? I see you are looking for "/*" and "*/", which are comment delimiters. if not, what is the significance of the tests on lines 29 through 33? Since whitespace is a delimiter...
Forum: C++ Oct 25th, 2009
Replies: 10
Views: 598
Posted By VernonDozier
Making an equilateral triangle with asterisks is probably impossible. Isosceles is more doable:


*
***
*****
*******


Look at the shape. What's the pattern? Here's a skeleton:
Forum: C++ Oct 24th, 2009
Replies: 10
Views: 598
Posted By VernonDozier
Well, what are you trying to accomplish? What shape are you trying to make? Map it out on graph paper, with coordinates. These almost all have nested loops. The outer loop draws the lines. If...
Forum: C++ Oct 23rd, 2009
Replies: 4
Views: 149
Posted By VernonDozier
// Test #02 new version
// Title : The Question ?
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

int nAnswer;
int nAnswer2;
Forum: C++ Oct 21st, 2009
Replies: 1
Views: 201
Posted By VernonDozier
This isn't a trivial problem. There are quite a few ways to do it. All are a bit advanced for the first day, but hey, this'll expose you to more code. I tried to think of the most elementary way...
Forum: C++ Oct 18th, 2009
Replies: 4
Solved: Encryption
Views: 245
Posted By VernonDozier
I can't analyze the code you attached since it's in a language I don't know. But here's an example of a very simple encoding technique that simply pads to "encrypt" (not really encryption), and...
Forum: C++ Oct 18th, 2009
Replies: 42
Views: 1,789
Posted By VernonDozier
Now you're just messing with people's heads, aren't you? You were just told flat out that that was against the rules, the guy who gave you the code and the guy you PM'd got lectured for even giving...
Forum: C++ Oct 17th, 2009
Replies: 5
Views: 376
Posted By VernonDozier
Well, it's a bit more complicated than that. It has little to do with the filename. Even if it was a short filename, you'd need an ifstream object. The filename is just the starting point. There...
Forum: C++ Oct 17th, 2009
Replies: 18
Views: 453
Posted By VernonDozier
Well, if you've already solved it, it's a moot point, but I was thinking you would display the factorial variable inside the loop and see if it was changing correctly each time through the loop. ...
Forum: C++ Oct 17th, 2009
Replies: 18
Views: 453
Posted By VernonDozier
The factorial variable as you have it does nothing. You can delete that line. I'd actually name your "s" variable "factorial". It's more descriptive. There's no summation involved.
Forum: C++ Oct 17th, 2009
Replies: 5
Views: 376
Posted By VernonDozier
I'm not very clear on how ifstreams work, so I won't attempt to explain what's going on in any kind of detail. infile is a pointer to something (I'm not entirely sure what). When you try to read...
Forum: C++ Oct 17th, 2009
Replies: 18
Views: 453
Posted By VernonDozier
Well, what results do you get? Nothing! How do you know whether anything is right or wrong if you never display anything? Display factorial, run it for a variety of N values, and see what you get.
Forum: C++ Oct 17th, 2009
Replies: 5
Views: 376
Posted By VernonDozier
infile >> value;
while (!infile.eof())
{


outfile << value;
outfile << endl;
infile >> value;
}
Forum: C++ Oct 10th, 2009
Replies: 6
Views: 484
Posted By VernonDozier
I'm not a Windows programmer, so I can't help debug, but is there anything in the program that requires you to use all of these Windows-specific headers? Will the regular C and C++ standard...
Forum: C++ Oct 10th, 2009
Replies: 3
Views: 255
Posted By VernonDozier
This isn't a code snippet. If possible, please change the thread type to a regular old thread as opposed to a code snippet.

The && operator doesn't work that way. You want something like this:
...
Forum: C++ Oct 10th, 2009
Replies: 6
Solved: Urgent help #2
Views: 386
Posted By VernonDozier
Post has nothing to do with the thread.
Original poster has shown no effort, so you shouldn't be fixing the code from another poster, even if you were posting on the correct thread, which, again,...
Forum: C++ Oct 10th, 2009
Replies: 6
Views: 228
Posted By VernonDozier
It's not your computer. It's your code. I'd explain what is wrong with it, but that might mean sebassn could put absolutely no effort into this and get the complete answer. sebassn, three verbatim...
Forum: C++ Oct 8th, 2009
Replies: 2
Views: 321
Posted By VernonDozier
One, it's int main (), not void main (). Two, we need an input file. Three, what's the point of having a program with no output, either to the screen or to a file? How do you test it? If there is...
Forum: C++ Oct 7th, 2009
Replies: 1
Views: 108
Posted By VernonDozier
Ancient Dragon already explained the way it works here in your last thread. Post some code (in code tags) that shows you've made an attempt, then ask a SPECIFIC question:



// code here
Forum: C++ Oct 6th, 2009
Replies: 21
Views: 687
Posted By VernonDozier
So "head" is supposed to be in there or not? Your output ends with dots after "Elizabeth". "head" is after "Elizabeth" in the alphabet, so the dots are ambiguous. If you have 50 names in the file,...
Forum: C++ Oct 5th, 2009
Replies: 7
Views: 261
Posted By VernonDozier
Line 29 won't work. getline reads a line, so you should have this (no = sign):


getline (cin, line);


If you then want to convert line into an integer, use atoi or strtol. These work on...
Forum: C++ Oct 5th, 2009
Replies: 21
Views: 687
Posted By VernonDozier
newNode doesn't have a type, or at least if it does, it's not declared here. It's just some variable name. If its type is a pointer to nodType, you need to declare that:


nodeType* newNode = new...
Forum: C++ Oct 4th, 2009
Replies: 8
Views: 285
Posted By VernonDozier
Read Lerner's earlier post again. You want to loop through your terms[] array. For each element, print the sign, then print the coefficient, then print the variable symbol ('x'), then the '^'...
Forum: C++ Oct 4th, 2009
Replies: 8
Views: 285
Posted By VernonDozier
Post poly.h and poly::write (). We have no idea what you might be doing wrong unless you post the code.
Forum: C++ Oct 3rd, 2009
Replies: 6
Views: 422
Posted By VernonDozier
There are a few ways of calculating the standard deviation, some more efficient than others. Say you have five points:

1,2,3,4,5

Calculate the mean, which is 3. Now go through the points one...
Forum: C++ Oct 3rd, 2009
Replies: 7
Views: 406
Posted By VernonDozier
Forum: C++ Oct 3rd, 2009
Replies: 4
Views: 454
Posted By VernonDozier
There isn't too much to a boolean function. They return true or false based on whatever. Here's an example of a boolean function that returns true if both numbers passed to it are the same, false...
Forum: C++ Sep 21st, 2009
Replies: 11
Views: 732
Posted By VernonDozier
You must fix that bad index problem for this program to work. You can't use 10 as the second index. Valid indexes are 0 through 9. If you use 10, even if it compiles and runs, it almost certainly...
Showing results 1 to 40 of 177

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC