pabloliva87

Ej7Chapter20C++

Aug 19th, 2013
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. int main(void)
  5. {
  6.     char* p = NULL;
  7.     std::string s1(p);
  8.     std::cout << s1 << std::endl;
  9.  
  10.     const char input[] = "Hola";
  11.     std::string s2(input);
  12.     std::cout << s2.at(4) << std::endl;
  13.  
  14.     std::vector<char> charvec(5, 'a');
  15.     std::string s3(&charvec[0], 5);
  16.     std::cout << s3 << std::endl;
  17.  
  18.     std::string s4 (std::string::npos, 'a');
  19.     std::cout << s4 << std::endl;
  20.  
  21.     return EXIT_SUCCESS;
  22. }
Add Comment
Please, Sign In to add comment