Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <string.h>
  5. using namespace std;
  6.  
  7.  
  8. //https://pastebin.com/AM7CGswP
  9.  
  10. //https://pastebin.com/SzwN5JKN
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. int main()
  18. {
  19.  
  20.   char tab[20] = "Hello world";
  21.  
  22.   for( int i=0; i<20; i++)
  23.   {
  24.       cout << (int) tab[i] << "\t" << tab[i] << endl;
  25.   }
  26.  
  27.   cout << ">" << tab << "<" << endl;
  28.  
  29.  
  30. //  cout << "Podaj tekst ";
  31. //  cin >> tab;
  32.  
  33.   int i=0;
  34.   while ( tab[i] !='\0' ) {
  35.     cout << tab[i];
  36.     i++;
  37.   }
  38.   cout << endl;
  39.  
  40.   char tab2[20];
  41.  
  42.   cout << tab2 << endl;
  43.  
  44.   i = 0;
  45.   while ( tab[i] != 0 )
  46.   {
  47.     tab2[i] = tab[i];
  48.     i++;
  49.   }
  50.   tab2[i] = 0;
  51.  
  52.   cout << tab2 << endl;
  53.  
  54.  
  55.   cout << "dlugosc tekstu: ";
  56.  
  57.   i=0;
  58.   while ( tab[i] != 0 ) i++;
  59.   cout << i << endl;
  60.  
  61.   cout << strlen(tab) << endl;
  62.  
  63.  system("pause");
  64.  return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement