Presentation is loading. Please wait.

Presentation is loading. Please wait.

Concatenation + Tack new stuff onto the end/right-hand side of a string “New stuff” can be: Char variable String variable Char literal String literal.

Similar presentations


Presentation on theme: "Concatenation + Tack new stuff onto the end/right-hand side of a string “New stuff” can be: Char variable String variable Char literal String literal."— Presentation transcript:

1

2 Concatenation + Tack new stuff onto the end/right-hand side of a string “New stuff” can be: Char variable String variable Char literal String literal

3 Example string name = "John"; string family = "Smith"; name += " K. "; name += '\n'; name += family;

4 ????????? (A) Based on the starter code provided, perform some concatenation so that the string ends up containing the text C++ string one = “C”;

5 Moving Between ASCII Values Mathematically Uppercas e Letter ASCII Value Shift ASCII Value Lowercas e Letter A65+3297a B66+3298b

6 Example char c; cout<<"Enter character: "; cin>>c; if(c>='0' && c<='9') cout<<"Numeric digit!";

7 ????????? (B) What value is contained in s after the code executes? string s = “abcd”; s.at(0) +=2; s.at(s.length()-1)-=3;


Download ppt "Concatenation + Tack new stuff onto the end/right-hand side of a string “New stuff” can be: Char variable String variable Char literal String literal."

Similar presentations


Ads by Google