Skip to content

Instantly share code, notes, and snippets.

@rogerioagjr
Created May 5, 2015 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerioagjr/41526c406ffaebc7e3d6 to your computer and use it in GitHub Desktop.
Save rogerioagjr/41526c406ffaebc7e3d6 to your computer and use it in GitHub Desktop.
String de C++
#include <string>
#include <iostream> // cin e cout
using namespace std;
int main(){
string frase; // declaro a string frase
cin >> frase; // leio o valor de frase
// imprimo o tamanho de frase e substring nela contida, a partir da posição 2
cout << frase.size() << " " << frase.substr(2) << "\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment