Thanks, sorry about that I'll read those before I ask questions, this fixed the problem:
csis << "Enter book title: ";
cin.ignore(1,'\n');
Type: Posts; User: ryanmcclure4
Thanks, sorry about that I'll read those before I ask questions, this fixed the problem:
csis << "Enter book title: ";
cin.ignore(1,'\n');
Alright, I've run into another little problem. When I run the program it prints "Enter B for book, R for recording", and for example if I type 'B' and press enter it prints "Enter book title", new...
I would write my own class as you said, but his instructions were "Note: Please do not use the C++ String class to create any String objects in your constructors." I can't think of a reason why he...
Like I said above, I can't use c++ strings; only c-style strings.
When i use std::getline I still get the error. I've never used the std:: in the body of a program before, always written the global "using namespace std;". Do I need to get rid of that if I want to...
How can I initialize the char arrays when I don't know how long they will be?
I tried both of these functions, and realized that I need to use the C-strings one but my problem is that the length of the array isn't defined until runtime so I can't just write...
Hi everyone,
I have a program that is like a media library and has the user input titles, authors, etc. for books or recordings. What I have works so far, but when you input something with a space...
Hi everyone,
I overloaded the addition operator for pointer notation in my assignment and I keep getting this error when I compile:
3 overloads have similar conversions
could be 'char *operator...
Alright thanks, good to know!
I just realized I was overloading the wrong operator (I was supposed to be overloading the assignment operator for this part of my assignment) and changed it - now it works fine...Sorry for the...
Sorry about that! I always forget to do that when I declare the constructors and functions.
This is my new string class:
class String{
protected:
int length;
char* buf;
public:
Hi everyone, I have a base class "String" and derived the class "ReverseString" from "String". When I try to use member variables from String in the ReverseString class, it is telling me...
Ah alright, that makes sense.
Thanks for all the help everyone! It's much appreciated :D
I read up some more on the this pointer and understand what you mean now. I thought my code worked but it actually didn't. I changed it to this:
IntArray& IntArray::operator=(const IntArray&...
iMalc - I read up on passing by const-reference and from what I understand the reason for doing this is so that the compiler doesn't need to make a copy of the object in order to use it in the...
Thanks for all the info! That all makes sense to me (except for the *this pointer, which for whatever reason always confuses me) however, I apologize I left out the fact that I need to keep each...
Ahh I'm sorry I didn't mean to say compare, I am trying to set the three objects equal to each other.
Hi everyone, I'm writing a part of my program that compares three objects of class IntArray:
IntArray IntArray::operator=(IntArray h){
if (len != h.len){
hault();
}
else...
In the function:
string ZipCode::zipToBar(int zip) { //Converts zip to bar code
int zipArr[5];
string ZERO = "11000",
ONE = "00011",
...
Nevermind, I wan't thinking and used "=" in the if statement instead of "==". Thanks for the help though!
Alright, I changed the barToZip funciton to return type int instead of void, changed the code as you said, and it worked! I keep forgetting about these small things and they always pop up when I do....
Ahh, that was it! Thanks a lot for explaining all that, I'll definitely use it in the future :D
I hate to ask for more advice, but I keep running into more problems...in the following code I am...
I changed the second parameter to 25 as std100093 said, and that seemed to fix the problem. Also, thanks for the tip laserlight I changed my code accordingly.
Unfortunatley, now I've run into...
brewbuck - The barCode string is originally 27 characters long, and I wrote the code in line 2 in order to remove the first and last characters of the string. I wasn't sure if it would work to use...