SHARE
TWEET

Untitled

a guest Nov 15th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     const short rozmiar = 100;
  6.     char wyraz[rozmiar];
  7.    
  8.     cout << "Wprowadz lancuch max 80 znakow: "; cin.getline(wyraz, rozmiar);
  9.    
  10.     if(strlen(wyraz) <= 80) {
  11.         int k = 0;
  12.         for (int i = 1; i < rozmiar; i++)
  13.             if (wyraz[k] != wyraz[i])
  14.             wyraz[++k] = wyraz[i];
  15.         wyraz[++k] = '\0';
  16.        
  17.        
  18.         cout << "Lancuch zawiera " << strlen(wyraz) << " znakow: " << wyraz << endl;
  19.     }
  20.     else {
  21.     cout << "Lancuch zawiera za duzo znakow." << endl;
  22.     }  
  23. }
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