|
-
Apr 19th, 2001, 12:44 AM
#1
Thread Starter
I wonder how many charact
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
-
Apr 19th, 2001, 06:31 AM
#2
Hyperactive Member
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.
Designer/Programmer of the Comtech Operating System(CTOS)
-
Apr 19th, 2001, 06:38 AM
#3
Frenzied Member
Use the string library.
Code:
#include <string>
using namespace std;
int main()
{
string text;
text = "mytext"
text = text+"other text"
Very easy to use.
-
Apr 19th, 2001, 08:54 AM
#4
Thread Starter
I wonder how many charact
thanks
Thanks for both your replies. I think inclusion of the string library is what I was recalling. Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|