Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Yes, I've read your jpeg.
But what code have you managed to come up with so far?
For example, can you read the string from the user, and just print it back to the user?
Can you add to that printing the length of the string?
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Maybe this will kick-start you
#include <iostream>
#include <string>
using namespace std;
int main ( ) {
string s = "hello world";
cout << "The length is " << s.length() << endl;
cout << "The 5th character is " << s[4] << endl;
return 0;
}
There are all sorts of different methods for manipulating strings. http://www.sgi.com/tech/stl/basic_string.html
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953