You can input ctrl-z. It signifies end-of-line.
Type: Posts; User: Iceboxes
You can input ctrl-z. It signifies end-of-line.
struct cat {
cat() {}
explicit cat(const cat&) {}
};
void cheezburger(cat) { std::cout << "i iz hungry, gief chezburger plz"; }
void cheezburger(const cat&) { std::cout << "lolololol...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Purrfect explanation
(ΦωΦ)
intaddEm (cat myCat);
int addEm (const cat& myCat);
An ambigous call is what you think it is, and this happens because your two functions may take the same argument. Needless to say, it cant know...
Dont know if I understood you correctly, but I think you can use getline.
getline (string) - C++ Reference
With your code, it would look something like this:
while (!p.eof())
{
...
A neat way to iterate through the string is to use a range-for loop! It looks atleast a lot easier than what you described :)
Range-Based For Loops in C++11 - Cprogramming.com
Example with your...
Hello!
So I have a problem with finishing this task from C++ Primer 5th edi, Chapter 9:
Write a function that takes three strings, s, oldVal, and newVal. Using iterators, and the insert and...
Dont think so much about the efficiency of such a small level program. I cant help you out if it were a high level program, but you should just focus on how to write a program doing what you want it...
Thank you! :) I think it was the second one the book was asking for
Hello, I am learning about ways of initializing strings from other containers. One of the tasks is to initialize a string from a char vector, but something goes wrong, and the book doesnt show an...
Is that what pinkie pie would say, my friend? :C
I meant as in how they work :) Or do they work differently? If I were to take a fstream, make it into a string and then apply that string to istringstream, I would basically have the same stream as I...
Aah, that was what I thought, that istringstream is basically fstream, just specifically for strings. (If it's that what you meant) I just wasnt sure. Thank you very much!
Consider I have a vector of strings and then I use an istringstream to read each word of each element in the vector, why do I nescessarily use an istringstream?
This is the code that does what I...
Omg, I KNEW that, but completely forgot .... Another derp moment on this forum... So embarrasing >,< thank you so much for pointing the error out though!! You are a nice person :-)
I am trying to write a function that takes a string input from a file and then stores the string in a vector.
I think the problem lies in the algorithm to take the input and store it in the...
Enumerated types are basically assigning a value to a "word" and you can use that word later on as a replacement for that value which helps readability. I know what the book wants you to do, and that...
What do you think you ought to do? .. You have the clearly stated algorithm and people are not gonna write the code for you.. Do something and ofcourse you will receive help.
Was writing on my phone, so some details was easily forgotten >.>
Thanks to everyone that helped me, you guys are awesome!!!!!
Or a "function" outside the class
You made me understand constructors more, but moving on, I dont think I am supposed to use a copy constructor here.
Do I set "Contents" equal to something in the constructor, or am I supposed to do that when I declare it?
Are these constructers what the book is asking for?
screen(pos ht, pos wd) :...
This excercise is from C++ primer 5th edition.
I have not understood everything about constructors, mainly about how they function.
Work prior to the excercise was creating a class called...
Thanks guys! It compiled and I think it is working as it should.
@laserlight, part of my problem (which I didnt mention) was that I didnt know exactly what to do in order to add the functions to...
This is from C++ Primer 5th edition excercise 6.54 and 6.55.
So the first excercise goes like this:
Write a declaration for a function that takes two int parameters and returns an int, and...