SHARE
TWEET

C++ functions

apl-mhd Feb 19th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <cctype>
  5. using namespace std;
  6.  
  7. void  chane(string *x){
  8.  
  9.     x[0] = '1';
  10. }
  11.  
  12.  
  13. int main() {
  14.  
  15.     string name = "apel";
  16.  
  17.     chane(&name);
  18.  
  19.     cout<<name;
  20.  
  21. //find locaation
  22.  
  23. int loc = name.find("x");
  24.  
  25. //substring
  26. string name2 = name.substr(0,2);
  27.  
  28. int len = name.size();
  29.  
  30.  
  31. /*input full string*/
  32. /*getline(cin,name);
  33.  
  34. name +="xxzzxxxx";
  35. cout<<name;*/
  36.  
  37.  
  38. /*string compare*/
  39.  
  40. //cout<< name.compare("Apel");
  41.  
  42.  
  43. //name.clear();
  44.  
  45.  
  46. /*Character array*/
  47.  
  48.  
  49. /*
  50. int x[100] = {1,2,33,3,4};
  51.  
  52. char  a[100],b[100],c[100];
  53.  
  54. cin>>a;
  55. cout<<a<<endl;
  56.  
  57.     cin>>b;
  58.     cout<<b<<endl;
  59.     cin>>c;
  60.     cout<<c<<endl;
  61. */
  62.  
  63. /*
  64. char d[100],e[100];
  65.  
  66. cin>>d;
  67.  
  68. int i=0;
  69. while(d[i] !='\0'){
  70.  
  71.     cout<<d[i];
  72.     e[i] = d[i];
  73.     i++;
  74. }
  75. cout<<endl;
  76.  
  77. e[i] = '\0';
  78.  
  79. i =0;
  80.     while(e[i] !='\0'){
  81.  
  82.         cout<<e[i];
  83.         i++;
  84.     }
  85.  
  86. */
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100. /*
  101. string name3,name4,name5;
  102.  
  103. cin>>name3;
  104. cout<<name3<<endl;
  105.  
  106. cin>>name4;
  107. cout<<name4<<endl;
  108.  
  109. cin>>name5;
  110. cout<<name5<<endl;
  111. */
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.     return 0;
  127. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top