String Library Quick Reference



string Library Quick Reference

[pic]

|string Operation |Description |

|string aString; |Declare aString as an empty string |

|string aString = "hi"; |Declare aString as a non-empty string< |

|cin >> aString; |Read a word from cin, storing it in aString |

|cout string2 |Greater-than relational comparison |

|string1 = string2 |Greater-than-or-equal relational comparison |

|string1 = string2; |Make string1 a copy of string2 |

|string1 + string2 |Create a new string consisting of string1 followed by string2 |

|string1 += string2; |Append string2 to string1 |

For each of the "find" functions, if the item being sought is not present in the string, the function returns NPOS, a special constant defined in the string library.

#include // cin, cout,

#include // class string

using namespace std;

int main()

{

cout englishWord;

cin.get(separator);

piglatinWord = Piglatin(englishWord);

cout ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download