Search Results

Showing results 1 to 40 of 449
Search took 0.04 seconds.
Search: Posts Made By: Lerner
Forum: C++ 3 Days Ago
Replies: 19
Views: 395
Posted By Lerner
in function prototypes you don't need to name the variables acting as arguments/parameters. In function definitions you have to name the argument/parameter being passed in addition to it's type.
Forum: C++ 3 Days Ago
Replies: 2
Views: 139
Posted By Lerner
Delete lines 16, 17 and 18.

Delete everything to to the right = signs in the equations in lines 20, 21, 22 and put the = sign in the string identifying the operation that is being done.
...
Forum: C++ 3 Days Ago
Replies: 19
Views: 395
Posted By Lerner
What happens if you flip right and left of the = operator in line 57 around?
Forum: C++ 5 Days Ago
Replies: 7
Views: 254
Posted By Lerner
There is no routine way to print a variables name. You could create a user defined type and include the name of the type as one of the data members. However, the name of the variable itself, not...
Forum: C++ 5 Days Ago
Replies: 7
Views: 254
Posted By Lerner
Some information on both is available at cppreference.com, but having your own reliable hard copy reference book would be strongly recommended, too.
Forum: C++ 5 Days Ago
Replies: 7
Views: 254
Posted By Lerner
you should be able to use the substr() method to isolate the last two char of the string and you should be able to use a stringstream to convert the string isolated by substr() to an int. Both...
Forum: C++ 5 Days Ago
Replies: 5
Views: 234
Posted By Lerner
What is sizeof(e) anyway given that name can have any size up to 79? If you wanted to use write() I would recommend using two separate calls, one using strlen(eArray[counter].name) as the second...
Forum: C++ 5 Days Ago
Replies: 7
Views: 254
Posted By Lerner
Isolate (using whatever method you like) the last two char of each string as a substring and then convert the substring to an int (using whichever method you prefer). There are at least two ways to...
Forum: C++ 6 Days Ago
Replies: 13
Views: 357
Posted By Lerner
guccitan88: Using code in post #11:
1) Move line 9 to line 18. Reason: don't use global variables unless you have to. If you feel you must use array a as a global variable then don't pass it to...
Forum: C++ 7 Days Ago
Replies: 4
Views: 157
Posted By Lerner
comment out lines 26 through 53, recompile and rerun. The } on line 18 ends main().

My post was an effort to use your code as the basis for an example of writing and calling functions. I...
Forum: C++ 7 Days Ago
Replies: 6
Views: 310
Posted By Lerner
As jonsca said, any newline char in the file opened by the stream called plainText will be eliminated from the stream by getline() as it is the default delimiting char for getline() and getline()...
Forum: C++ 7 Days Ago
Replies: 13
Views: 357
Posted By Lerner
Where did you declare a before passing it to populateArray(a) in line 18? a should be declared as an array of 50 ints before you try to use it.

The first argument in line 19 should be the same...
Forum: C++ 7 Days Ago
Replies: 4
Views: 157
Posted By Lerner
Functions must have a declaration and a definition. If the fucntion is defined before main() then the declaration and the definition are the same. If the function is declared before main() it is...
Forum: C++ 7 Days Ago
Replies: 13
Views: 357
Posted By Lerner
intNumberOfElementsToStore should be an int, not an array of ints. It should be generated in main(), line 17 looks like a good spot to do it. Declare the array with a name like...
Forum: C++ 8 Days Ago
Replies: 6
Views: 214
Posted By Lerner
int * ptr;
This is a pointer to an int. It isn't an array. It can be used like an array when you assign memory to it using the new[] operator.

int num = 6;
int * ptr = NULL; //null ptr

ptr...
Forum: C++ 9 Days Ago
Replies: 3
Views: 183
Posted By Lerner
I still don't understand the question. Please be more specific.

I do see that you don't null terminate can->name in putCandy() so technically can->name is a simple char array not a string. Try...
Forum: C++ 10 Days Ago
Replies: 4
Views: 188
Posted By Lerner
domain is declared with capacity of 3 but you are trying to read 4 non null chars into it. This will cause an error that may be called several different things, including possibly a stack error. ...
Forum: C++ 10 Days Ago
Replies: 7
Solved: turkey
Views: 228
Posted By Lerner
You calculator probably doesn't use integer math. Try changing datatypes of cooktime to double or float, rounding where appropriate, and see what happens.
Forum: C++ 10 Days Ago
Replies: 4
Views: 188
Posted By Lerner
The domain name can't be moc gro or ude all at the same time. So at least two of the three conditions must be true and given the OR operator that means the whole condition is true. How about using...
Forum: C++ 10 Days Ago
Replies: 7
Solved: turkey
Views: 228
Posted By Lerner
you have some "rounding problems" because C++ uses integer math, not regular math, when dividing an int into an int and then assigning that value to an int (see calculatin of cooktime which is...
Forum: C++ 10 Days Ago
Replies: 4
Views: 220
Posted By Lerner
Since you have access to the internet I would suggest you do a search on Google or you favorite search engine if you don't have adequate information in your course reference material or class notes. ...
Forum: C++ 10 Days Ago
Replies: 2
Solved: Arrary help 2
Views: 248
Posted By Lerner
I assume food and calories are parallel arrays meaning that food[x] has calories[x] calories and you want to keep the food matched with the correct calories and you are trying to alphabetize the food...
Forum: C++ 12 Days Ago
Replies: 29
Views: 644
Posted By Lerner
Throw in the output statements after each file read, after each conversion to lower case, after each removal punctuation/spaces (if you go that route) and output each letter before it is compared. ...
Forum: C++ 12 Days Ago
Replies: 5
Views: 199
Posted By Lerner
is din typo for did or slang for did not?
Forum: C++ 12 Days Ago
Replies: 29
Views: 644
Posted By Lerner
Between line 42 and 43 put a check statement to confirm appropriate read from file. Maybe something like:
cout << "file read is: " << sentence << endl;

In isPalindrome() strip the punctuation and...
Forum: C++ 12 Days Ago
Replies: 5
Views: 199
Posted By Lerner
Here's one version you can try:

void pop(int** s, int n)
Forum: C++ 14 Days Ago
Replies: 2
Views: 252
Posted By Lerner
use separate loops to calculate the numerator and denominator.
Forum: C++ 15 Days Ago
Replies: 3
Views: 208
Posted By Lerner
Um, have you had practice dealing with user defined types such as classes or structs. If so, I suspect he wants to de declare a type called Fractions and do whatever you have to do be able to add...
Forum: C++ 18 Days Ago
Replies: 12
Views: 566
Posted By Lerner
Build on what you know. For example here's a progression you might be able to use.

Write code to read the whole file one line at a time and display the line to the screen.

Modify the above...
Forum: C++ 18 Days Ago
Replies: 6
Views: 288
Posted By Lerner
You need to be as precise as possible in explaining what you are trying to do. For example, DOG and GOD have the same letters in each word, but are not the same word and DOG and SUN don't have any...
Forum: C++ 22 Days Ago
Replies: 2
Views: 502
Posted By Lerner
When mixing getline() and >> in the same program you have to account for the fact that >> leaves the terminating whitespace (new line char usually) in the input buffer. Then when getline() comes...
Forum: C++ 22 Days Ago
Replies: 9
Views: 519
Posted By Lerner
The most obvious possibility, but maybe the least likely, is that the prototype withdraw() post #3 line 1 and function call to withdraw, post #4 line 54 do not match with regard to number of...
Forum: C++ 23 Days Ago
Replies: 9
Views: 359
Posted By Lerner
Definition of template member funtions needs to be in the header file, not in the cpp file.

Where is Bank.h? From what is posted I can only guess at what's in Bank.

I hope Bank.h includes...
Forum: C++ 24 Days Ago
Replies: 9
Views: 359
Posted By Lerner
You might want to look into Run-Time Type Identification (RTTI). I got some pretty good hits searching RTTI on Google. A good reference book is hard to beat though.

You might be able to get by...
Forum: C++ Oct 23rd, 2009
Replies: 5
Views: 342
Posted By Lerner
Notice the different placements of the curly brackets betweenn the code written by Clinton Portis and your code. He checks the value of counter within the while loop to start a new line if needed,...
Forum: C++ Oct 18th, 2009
Replies: 4
Views: 280
Posted By Lerner
No need for AssignValue to be a friend function unless it is a requirement of the assignment.

How will AssignValue know how many digits to place before and after the decimal point? 123.456 ...
Forum: C++ Oct 18th, 2009
Replies: 4
Solved: Encryption
Views: 262
Posted By Lerner
If you know the first key then maybe something like this will work.

Encrypt:
while there are letters to encrypt
generate random letters until current key is generated
place a letter of message...
Forum: C++ Oct 13th, 2009
Replies: 3
Views: 317
Posted By Lerner
First, I'm surprised the code compiles given that you declare StoArrayXYZ using a non-const int.

You should probably have the class methods defined in a file of the same name as the header file...
Forum: C++ Oct 12th, 2009
Replies: 3
Views: 299
Posted By Lerner
Focus your code posting to just the pertinent part. sometimes it's hard to know where that is, but in your case it shouldn't be.

Sounds like a do/while loop using something like isdigit() might...
Forum: C++ Oct 9th, 2009
Replies: 6
Views: 311
Posted By Lerner
How about including public functions read() and write(). Both should take an int parameter. Then you can call MyObject.read(n) and MyObject.write(n). I don't see how you can overload [] to both...
Showing results 1 to 40 of 449

 


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

©2003 - 2009 DaniWeb® LLC