what type do i declare something if i want it to be able to hold multiple characters? i've tried string but it doesn't exist, do i need to add a special library?
Printable View
what type do i declare something if i want it to be able to hold multiple characters? i've tried string but it doesn't exist, do i need to add a special library?
you need to include string if you want to use it:
#include <string>
you can also use character arrays
To use string as a datatype (as in VB):
Code:#include <string>
using namespace std;
void main()
{
string mystr = "something";
mystr = mystr + "something else"
}
Of course you can use char arrays.
Code:char mystr[] = "something"
//will have to use functions like strcpy etc.