Program that has unlimited strings?

Is there a way to have unlimited strings? I'm trying to make a program that let's you quickly keep track of and edit a recipe. I want to be able to type in as much as I want. So how do I make it have unlimited strings?
And....no one answers me for like an hour....
Last edited on
Well, when I run the following program:

1
2
3
4
5
6
7
8
9
10
11
#include <string>
#include <iostream>

int main()
{
     std::string s;

     std::cout << s.max_size() << std::endl;

     return 0;
}


I get the value 4294967294. So, if you use just one std::string you can have up to around 4.29 billion characters. If your recipe is longer than that, then I would really like to taste the result.

no one answers me for like an hour

An hour isn't too bad. I'd start to get worried after a day.
Well, I wanna be able to hit enter, and have it show me a list of everything I entered till that point Wait, ofcourse! If I just use this code
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <string>
int main()
{
string input;
while (true)
{
cin >> input;
cout << input << endl;
}
}

it will print what I entered, and then the next thing I enter will reassign input, then it will print the NEW input out. So I'll have a list of everything I enter. This is one of the reasons I like programming, if you're stuck on something for a bit, you feel really good when you use logic and problem solving to find the solution. I don't know if that goes away when you start to get really GOOD at programming, but yeah.
What I did didn't exactly do EXACTLY what I spoke of, but it got the effect I wanted
Last edited on
Perhaps this will help.
Press ENTER twice to finish
http://www.cplusplus.com/forum/beginner/2409/#msg9254
Last edited on
Topic archived. No new replies allowed.