in a way, but getline isn't the default application of strings usually cin>> is. I want to , and am making a string class that goes right up until newline is reached. also it will be smaller (sizeof wise) than string.
#include <iostream>
#include <string>
int main()
{
std::string line;
std::cout << "Please type a string of characters or words followed by ENTER\n> ";
std::getline(std::cin, line);
std::cout << "\n";
std::cout << line;
return 0;
}
Please type a string of characters or words followed by ENTER
> This works properly. I swear!
This works properly. I swear!
As for making it smaller, that would cool but isn't only 4 bytes?
I'm not arguing that getline () doesn't do it. im saying cin>> does not. with mine cin>> would. and yes it is only 4 bytes. mine would be 2. also I want to add things like the divide operator. you divide the string by another and it would take all the letters in string 2 and get them out of string 1
I would personally keep the same string class (as the size is not really a problem) but a library of functions to modify strings in different ways would be neat.
also I want to add things like the divide operator. you divide the string by another and it would take all the letters in string 2 and get them out of string 1
You know, when people complain about operator overloading in C++ that's exactly what they have in mind. Why not just have a properly named member function?