Skip to Content
C++ Data Structures and Algorithms
book

C++ Data Structures and Algorithms

by Wisnu Anggoro
April 2018
Intermediate to advanced content levelIntermediate to advanced
322 pages
6h 57m
English
Packt Publishing
Content preview from C++ Data Structures and Algorithms

Using std::string for more flexibility features

There is a std::string data type in the C++ Standard Template Library (STL). We can use it to replace characters in an array, since it has more flexibility features. The biggest advantage to using this data type instead of a characters array is that the size of std::string can be extended dynamically in runtime. Other functionalities that it has are as follows:

  • getline(): This function is used to get input from the user and then store it to a character stream in memory
  • push_back(): This function is used to insert a character at the end of the string
  • pop_back(): This function is used to remove the last character from the string
  • size(): This function is used to retrieve the number of character ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Structures and Algorithms Using C++

Data Structures and Algorithms Using C++

Ananda Rao Akepogu, Radhika Raju Palagiri
C++ Data Structures and Algorithm Design Principles

C++ Data Structures and Algorithm Design Principles

John Carey, Anil Achary, Shreyans Doshi, Payas Rajan
C++ Plus Data Structures, 6th Edition

C++ Plus Data Structures, 6th Edition

Nell Dale, Chip Weems, Tim Richards

Publisher Resources

ISBN: 9781788835213Supplemental Content