Need Help With Char Vectors

Pages: 12
I did mention that I needed an easy way to add a new character to the end and be able to have it grow as large as I need it to...
Using a vector an push_back is the easiest way I know!
Congratulations on the working code!

Still, you should really switch to std::string. It has push_back. It has +=(char). It has so much more than a vector when it comes to text-handling. There really is no reason to use a vector for it!
If it works in the same way then I'll do this...

Is there a simple way to output contents of a stein without a for loop indexing?
I think I've tried just entering the string variable name but this didn't work?
It does work.
1
2
3
4
#include <iostream>
#include <string>
std::string myString = "Hello World!";
std::cout << myString;
Ok I've just changed my vector to a string now and removed the for loop displaying indevidual letters till the end of the vector (which should improve performance speed). I've just swapped it for cout << word << endl; and its working now (I'm using a dev-cpp beta I think so it might have just been a problem with the IDE)...
Anayway thanks for everyones help!
Topic archived. No new replies allowed.
Pages: 12