-
Question:
Is there a String data type in c++?
In writing a function header that would take a string value for an argument, would this work:
void rentOne (int vidNum, String title)
{
}
or do I need to use CHAR ? (I fricken hope not)
I seem to think so, but maybe I'm remembering my Java OOP class instead..
please help
-
A string is basically a bunch of chars, so yes, you will have to use char.
Your function would look like this:
void rentOne (int vidNum, char *title)
{
}
to make a string, you must have the char and a pointer (*). I hope this clarifies any problems.
-
Use the string library.
Code:
#include <string>
using namespace std;
int main()
{
string text;
text = "mytext"
text = text+"other text"
Very easy to use.
-
thanks
Thanks for both your replies. I think inclusion of the string library is what I was recalling. Thanks