Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. char str[1000];
  2. int i = 0;
  3. n[i] = getchar();
  4. while (n[i] != 'n') {
  5. i++;
  6. n[i] = getchar();
  7. }
  8.  
  9. string s = str;
  10.  
  11. string s;
  12. getline(cin,s);
  13.  
  14. string s(str, i);
  15.  
  16. i++;
  17. str[i] = '';
  18. string s(str);
  19.  
  20. #include <iostream>
  21. #include <string>
  22.  
  23. int main(){
  24. char buf[] = "Hello, World!";
  25. std::string str;
  26. str = buf;
  27. std::cout << str << std::endl;
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement