The errors are:
error C2784: 'bool std: :operator ==(const std: :pair<_Ty1,_Ty2> &,const std: :pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std: :pair<_Ty1,_Ty2> &' from 'std::string'
error C2676: binary '==' : 'std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
if((required == 'Y') || (required == 'y'))
if((used == 'U') || (used == 'u'))
books = atof(enrollment.data())*.67;
else
books = atof(enrollment.data())*.87;
else
if((used == 'U') || (used == 'u'))
books = atof(enrollment.data())*.38;
else
books = atof(enrollment.data())*.45;
I'm just wondering why that won't work and i can't tell from my class notes. Dr. Gee fucked around with this message on 02-23-2005 at 09:50 PM.
I also remembered to go back and edit to disable smilies in the post. That helped too.
error C2676: binary '==' : 'std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
code:
if((required == 'Y') || (required == 'y'))
{
if((used == 'U') || (used == 'u'))
books = atof(enrollment.data())*.67;
else
books = atof(enrollment.data())*.87;
}
else
{
if((used == 'U') || (used == 'u'))
books = atof(enrollment.data())*.38;
else
books = atof(enrollment.data())*.45;
}
You might need to define the binary operator in the string.h or string.cpp file. Razor fucked around with this message on 02-23-2005 at 10:01 PM.
And for neatness, I suggest you use brackets and otherwise lest you can get some wacky errors that you normally wouldn't see.
quote:
Deathbeam Warhero had this to say about Duck Tales:
Perhaps I'm wrong, but if you're using the == operator with strings, don't you need to use double quotes, ie "y", and not single quotes, ie 'y'?
Single quotes means it's a character.
Looks like there's no == defined between STL strings and characters. Putting double quotes should fix it.
quote:
Naimah stopped beating up furries long enough to write:
As Razor said it is good formatting practice to use braces on everything that can have them. Doing an if with only one operator inside it? Brace before on its own line and bracer after on its own line. They don't hurt your performance any and they make the code a whole lot easier to interpret. Infact when people would ask me for help I would tell them to format correctly first, matters that much.
That's a matter of preference. For example, the GNU Coding Standards completely disagrees with you, and the Linux Coding Style Guidelines as well as the Java Coding Conventions disagree with your brace placement.
quote:
Rabidbunnylover thought about the meaning of life:
That's a matter of preference. For example, the GNU Coding Standards completely disagrees with you, and the Linux Coding Style Guidelines as well as the Java Coding Conventions disagree with your brace placement.
My coding style developed for ease of seeing the layers and what is attached to those layers. I'm sure that my style is part of some convention somewhere I just don't know nor care where it would be.
cin.get(); cin.ignore();
system("cls");
Would just a cin.ignore() work to wait for a carriage return to move to the next line? This part doesn't really matter, just a question of style.
The only problem i face is that we get marked down 5 points if we can't crash the program, and seeing how everything goes into strings i can't think of anything . The only thing i could think of didn't work and just returned a 0 from the decision lines (the ones in my first post) rather than crashing like i hoped.
Try just hitting enter where it asks the yes/no question. That might work. Probably not though.
quote:
`Doc's unholy Backstreet Boys obsession manifested in:
You lose points if your program is stable? What sort of ascinine teaching method is your professor using?Try just hitting enter where it asks the yes/no question. That might work. Probably not though.
Tried that before i posted. It doesn't since a blank string is still a string and it just moves into the "else" part of the if/else.
And his view on it is, "If you don't know how to break it, then you don't know how it works." I wouldn't worry too much about it but it is 5% of the project grade.
I'm not going to go for all permutations. It's easier to error-check with a do-while loop, but that wasn't a part of this assignment and it won't be looked for grading wise.
quote:
Blindy. said this:
Make a function called toUpper for gods sake. I have no idea why people will take the time to do two comparisons on every input but wont take 45 seconds to write a 3 line function.
Actually thats a prewritten function in the string.h file for C.. I'm sure C++ has the same, if not a similiar header file with the same general function.
As a coder, you need to aim for stupid user proof not what the prof tells you. Pesco fucked around with this message on 02-25-2005 at 12:08 AM.
quote:Unless, of course, you're given a huge assignment with no time to do it, in which case you do the bare minimum and still lose a fuckload of sleep.
Pesco probably says this to all the girls:
As a coder, you need to aim for stupid user proof not what the prof tells you.
quote:
Pesco attempted to be funny by writing:
Who cares about whether or not it will be included in the grading, do it because it needs to be done. Especially when it comes to error handling.As a coder, you need to aim for stupid user proof not what the prof tells you.
More like aim for compiling then fix everything later.
quote:
A sleep deprived Alidane stammered:
Unless, of course, you're given a huge assignment with no time to do it, in which case you do the bare minimum and still lose a fuckload of sleep.
Pesco always preferred arguing with the professor about how he was right until they changed his grade. It helps him that he's been coding professionally since he was like 16 or 17, tho.
-Tok