Advertisement
Guest User

Untitled

a guest
May 26th, 2017
126
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 <cstring>
  3. #include <cctype>
  4.  
  5. class Counter
  6. {
  7.     char* m_pStr;
  8.     unsigned int m_nOwners;
  9.     Counter* pNext;
  10.  
  11.     static Counter* Head;
  12.     static unsigned int m_curCounters;
  13.     Counter(char* str);
  14. public:    
  15.     static Counter* Init(char* str);
  16.     static void Count();
  17.     const char* Get_Str();
  18.     static void Change_Register();
  19.     static void AlphabetSort();
  20.     static void Print_All();
  21.     void Swap_Str(Counter& ref);
  22.     void Del();
  23.     void Add() { m_nOwners++; }
  24.     ~Counter();
  25. };
  26.  
  27. void Counter::Change_Register()
  28. {
  29.     int n = m_curCounters;
  30.  
  31.     Counter* p = Head;
  32.  
  33.     while (n--)
  34.     {
  35.         int i = 0;
  36.  
  37.         while (i < strlen(p->m_pStr))
  38.         {
  39.             if (('A' <= p->m_pStr[i]) && (p->m_pStr[i] <= 'Z'))
  40.                 tolower(p->m_pStr[i]);
  41.             if (('a' <= p->m_pStr[i]) && (p->m_pStr[i] <= 'z'))
  42.                 toupper(p->m_pStr[i]);
  43.             i++;
  44.         }
  45.         if (n != 0) p = p->pNext;      
  46.     }
  47.    
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement