Mira2706

kodche

Mar 12th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <string.h>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. char* convert(int n)
  9. {
  10.     string s = to_string(n);
  11.  
  12.     char* converted = new char[s.length() + 1];
  13.     strcpy(converted, s.c_str());
  14.     cout << converted;
  15.  
  16.     return converted;
  17.  
  18. }
  19. int main()
  20. {
  21. int chislo;
  22.     cin >> chislo;
  23.  
  24.     char *nechislo = convert(chislo);
  25.     cout << nechislo;
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment