Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
3
Posts with Upvotes
3
Upvoting Members
2
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
0 Endorsements
Ranked #1K
~34.7K People Reached
About Me

Programmer a long time ago, getting back into it now.

PC Specs
Platform: Mac mini running OS X, using Qt as my IDE and C++ as my primary programming language.
Favorite Forums
Favorite Tags

39 Posted Topics

Member Avatar for mzimmers

Hi, all - I'm relatively new to iterators, and to template functions, so I suppose it was inevitable that the first time I tried to combine them, I'd run into a problem. Here's the function: [CODE]template <class T> int getVectort(ifstream & s, long nbrCells, typename vector<T>::iterator iter) { int rc …

Member Avatar for mzimmers
0
622
Member Avatar for Vasthor

Where is grade() defined? It's referenced in grade.h, but I don't see a definition. Same goes for some of your other functions.

Member Avatar for gusano79
0
237
Member Avatar for Taino

Please put your code in code tags in the future. The variable message is building just fine. The problem is, you're only writing out the current decrypted letter: [CODE] cout <<"Current message: " << decryptedLetter(num)<< endl; [/CODE] Change your code to first append the new letter, and then print the …

Member Avatar for mzimmers
0
130
Member Avatar for pingpongplaya

Operator overloadings are often tricky. You'd do an addition operator like this: [CODE]Poly Poly::operator+(const Poly &rhs) { Poly temp; temp.size = size + rhs.size; return temp; } [/CODE] Note that this isn't going to solve all your problems in this program.

Member Avatar for pingpongplaya
0
4K
Member Avatar for alishanvr
Member Avatar for happikoto

The "&&" operator has higher precedence than the "||" operator. Your statement in line 3 is evaluating [CODE]m==12 && d<1[/CODE] first, and then running the "||" evaluations. Can you see how this isn't what you wanted?

Member Avatar for WaltP
0
199
Member Avatar for jefgreen

You've got your assignments backwards. The receiving variable should be on the left, and the calculation should be on the right. So: [CODE]31-day=inbetween[/CODE] should be: [CODE]inbetween = 31 - day;[/CODE] (Note that the use of spaces in your code makes reading it more understandable.)

Member Avatar for mzimmers
0
182
Member Avatar for fsefsef23

It looks to me as though you're currently counting swaps, not comparisons. To count comparisons, you need to move your line 15 outside the if statement. Also, note that you're not initializing comparisons, so if your function is passed a non-zero argument, your count will be off by that amount.

Member Avatar for mzimmers
0
7K
Member Avatar for spar

What have you done so far? Post your code, and put it within code tags, please.

Member Avatar for XMasterrrr
0
324
Member Avatar for optimumph

The problem is that end() isn't what you think it is; I think it's a sentinel node, but in any event, it's not a valid data element. You can replace it with: [CODE] sort(a1.begin(), a1.begin() + size - 1); [/CODE] I'm looking into a better way to do it, without …

Member Avatar for mzimmers
0
226
Member Avatar for Jsplinter

Compiles (and runs) using gcc, too. Here's my entire program, built from your snippet: [CODE]#include "vector" #include "iostream" using namespace std; int main () { vector<int> iv; iv.push_back(4); vector<int>::iterator it = iv.begin(); cout << *it; cout << *(iv.begin()); //debug assertion here return 0; } [/CODE] This doesn't compile on your …

Member Avatar for Jsplinter
0
281
Member Avatar for ladybug21

your line: [CODE]if (answer != 'n' || answer != 'N' || answer != 'y' || answer != 'Y') [/CODE] Will never return false. The "||" operator is an OR, not an AND. The variable answer can't be all four of the values you test, so at least three of the …

Member Avatar for mzimmers
0
265
Member Avatar for express690

You'll need a second array to hold whether the corresponding elements have been found or not. If you're super-tight on memory (unlikely) you can use bit arrays, but a simple bool array will work just fine.

Member Avatar for WaltP
0
356
Member Avatar for triumphost

A couple things come to mind: 1. you don't have to use the third parameter; it might be better to leave it out. [URL="http://www.cplusplus.com/reference/string/string/find/"]http://www.cplusplus.com/reference/string/string/find/[/URL] 2. I can't remember all the characters that require escaping in a string sequence...have you tried searching for something simpler, like alpha text without any other …

Member Avatar for triumphost
0
171
Member Avatar for crownedzero

My first thought is, why would you want to use arrays instead of strings? You have a perfectly good implementation using strings...why argue with prosperity? If you do want to use arrays, you'll have to buffer the input string (the "sentence") and rebuild it into another array as you replace …

Member Avatar for mzimmers
0
2K
Member Avatar for Firzin

1. get rid of the curly braces on lines 38 and 39. 2. your 2nd and 3rd calls to getline() won't work, because you're trying to pass a double in the second parameter, and getline() expects a streamsize (int) variable here. But I don't think you want a getline() here …

Member Avatar for mzimmers
0
189
Member Avatar for alarifth
Member Avatar for Kyle Willett

Your constructor paramater is missing a type. I noticed that you chose the same name for your parameter as you chose for your array. You're aware that just by giving them the same name, you're not actually passing the array into the constructor, right?

Member Avatar for Kyle Willett
0
526
Member Avatar for David321

A static method can only access static members of the class. This feature doesn't prove useful very often, in my experience. The "const" at the end of a function bans the function from modifying any members of the object.

Member Avatar for mike_2000_17
0
160
Member Avatar for jenbrandau341

I believe you're missing a semi-colon at the end of line 17. And, you're attempting to reuse a variable name in line 34 that you've already used in line 19. Fixing these should at least get you to compile.

Member Avatar for WaltP
0
232
Member Avatar for jonnyboy12

It's going to be system/compiler dependent. Is your matrix going to be sparsely populated? You might consider a different data structure in that case.

Member Avatar for nickcampau
0
135
Member Avatar for skylinedrifter
Member Avatar for frogboy77
0
111
Member Avatar for fanfunstar

I'm taking a look at this program, and the instructions. I'm not sure what "in = temp" is supposed to mean, but I think it's putting you into an infinite loop. (This doesn't appear to be your only bug, though.) Also, as you appear to have discovered, there's no clear() …

Member Avatar for raptr_dflo
0
2K
Member Avatar for george08.08

Not sure what you mean by "show" a constant. If you're trying to declare a constant, do so in the definition of your class. [CODE]class Savings { private const double INTEREST_RATE = 0.03; . . . }; [/CODE] If I understand what you're trying to do here.

Member Avatar for mzimmers
0
189
Member Avatar for george08.08

I'm curious...why did you create a separate class for the account number? It seems to me that you could have put your static variable in the Account class. Then, you constructor could retrieve the account number, copy it to the member accountNumber, and increment it. This would obviate your issue …

Member Avatar for mzimmers
0
205
Member Avatar for tvm78

From [URL="http://www.cprogramming.com/tutorial/operator_overloading.html"]http://www.cprogramming.com/tutorial/operator_overloading.html[/URL]: [QUOTE]... the overloaded operator is a member of the class ...[/QUOTE] Try declaring it in the public section of your class definition.

Member Avatar for NathanOliver
0
275
Member Avatar for rjstamey

Let's have a quick terminology check here to make sure we're on the same page: an [I]object[/I] is a collection of data and methods to access that data. a [I]class[/I] is a definition of an object. a [I]member[/I] is a data element within an object. (I just whipped these definitions …

Member Avatar for xfbs
0
478
Member Avatar for mikepablo

A good start would be to put each of those code fragments into separate routines, and post the code here. Please put the code in tags for easier reading, too. Thanks.

Member Avatar for ag_17
0
215
Member Avatar for v3ga
Member Avatar for Zssffssz
Member Avatar for mzimmers
0
120
Member Avatar for dkXIII

Where is cin declared and initialized? I see no mention of a filename, or an attempt to open a file; how is your program going to access the file? Also, I see no need for the randomizing of c. Finally, why are you casting the characters you read into integers? …

Member Avatar for raptr_dflo
0
194
Member Avatar for _electricblue

This is actually a pretty clever problem. Can you be sure that your input file is exactly 22x80? Were you given any other rules about the contents of the input file?

Member Avatar for mazzica1
0
876
Member Avatar for DeusManP0W
Member Avatar for klw

This tutorial may help you get your file access working: [URL="http://www.cplusplus.com/reference/iostream/fstream/open/"]http://www.cplusplus.com/reference/iostream/fstream/open/[/URL] Also, I believe you have your valid test reversed in line 27. Once you get these addressed, we can go from there.

Member Avatar for MandrewP
0
150
Member Avatar for XodoX

There are plenty of C++ tutorials on the Internet. The challenge is, if you think like most people do, you won't internalize a concept until you see a need for it. In C++, this is tricky, especially if you're an experienced C programmer. You have to conceptualize a real need …

Member Avatar for raptr_dflo
0
155
Member Avatar for minghags

If I understand your question, you want to establish a starting value as well as an ending value for your prime number search? If so, that's quite simple; instead of having a single num, have two ints: start_nbr and end_nbr. Prompt the user for them separately, and pass them both …

Member Avatar for minghags
0
257
Member Avatar for Oscariuz

I'm not sure I understand your question. Are you asking the probability of certain patterns of characters occurring? Or, are you asking how to compare the selected characters?

Member Avatar for mzimmers
0
183
Member Avatar for Zssffssz

GCC has a similar tag: [QUOTE] -fexpensive-optimizations Perform a number of minor optimizations that are relatively expensive. [/QUOTE] I'd venture that "expensive" here means time-consuming to the compiler. Your code might not even contain the kind of stuff that such optimizations target, though.

Member Avatar for mzimmers
0
124
Member Avatar for eternalblizzard

I'm not at all sure I fully understand your program, but...I wonder if line 43: [CODE] for (int i=0; i<cCol; ++i)[/CODE] should be: [CODE] for (int i=0; i< BOARD_SIZE; ++i)[/CODE] It's not clear to me that you're exhausting all possibilities with your current loop limit.

Member Avatar for eternalblizzard
1
168

The End.