1 / 2

C++ Programming: chapter 5 – string

C++ Programming: chapter 5 – string. 2014, Spring Pusan National University Ki-Joune Li http://isel.cs.pnu.edu/~lik. #include <iostream> #include <string> using namespace std; int main() { string s1(“abcd”); string s2=“bcde”; string *s3=new string(s1); string s4=s1+”, “+s2;

daire
Download Presentation

C++ Programming: chapter 5 – string

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. C++ Programming: chapter 5 – string 2014, Spring Pusan National University Ki-Joune Li http://isel.cs.pnu.edu/~lik

  2. #include <iostream> #include <string> using namespace std; int main() { string s1(“abcd”); string s2=“bcde”; string *s3=new string(s1); string s4=s1+”, “+s2; string s5,s6,s7; getline(cin,s5) >> s6; // return type of getline is reference of the first parameter getline(cin,s7, ‘+’); // ‘+’ is used as a delimiter cout << s4.length(); cout << s1[3] << s1.at(3); cout << s1.find(“cd”); } stringclass

More Related