Results 1 to 6 of 6

Thread: C++ ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User ABDON's Avatar
    Join Date: Apr:2004
    Location:
    Posts: 1,849

    Arrow C++ ?


    , . .
    :

    Code:
    #include <iostream>
    #include <string>
    #include <cctype>
    
    using namespace std;
    
    void showValues(string, int);
    
    long int main()
    {
        string sentence;
        cout << "Enter text: ";
        getline(cin, sentence);
        showValues(sentence, sentence.length());
        system("pause");
        return 0;
    }
    
    void showValues (string chars, int size)
    {
    
        
           int y=0;
          for (int i=0;i<size;i++)
          {
           int temp=(int)chars[i];
          if ((temp>64 && temp<91) || (temp>96 && temp<123) || (temp>1040 && temp<1103)) y++;
          }
          cout << y << " Letters" <<  endl;
          cout << endl;
    }


    . 3-4 , . .
    2.
    Last edited by ABDON; 14th January 2010 at 23:48.
    Toys: ThinkPad T510 | iPhone 4 | Ultimate Ears Super.fi 4vi | X-mini II
    www.ivanzhelev.com

  2. #2
    Bombera's Avatar
    Join Date: Jul:2001
    Location: 4EVA
    Posts: 13,833
    Win32 :
    IsCharAlpha
    , . , , IsCharAlphaW.
    EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
    Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|

  3. #3
    Registered User
    Join Date: Oct:2003
    Location:
    Posts: 4,317
    ? , 866.
    Unicode, ?

  4. #4
    Bombera's Avatar
    Join Date: Jul:2001
    Location: 4EVA
    Posts: 13,833
    Code:
    #include <iostream>
    #include <string>
    #include <cctype>
    #include <windows.h>
    
    using namespace std;
    
    void showValues(string, int);
    
    long int main()
    {
        string sentence;
    
        cout << "Current code page:" << GetConsoleCP()<<endl;
        cout << "Enter text: ";
        getline(cin, sentence);
        showValues(sentence, sentence.length());
        system("pause");
        return 0;
    }
    
    void showValues (string chars, int size){
    	int y=0;
    
        for (int i=0;i<size;i++){
           if (IsCharAlpha(chars[i])) 
    		   y++;
        }
        cout << y << " Letters" <<  endl;
        cout << endl;
    }
    , -. string , . sizeof(chars[i]) e . .
    EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
    Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|

  5. #5
    Pesho's Avatar
    Join Date: Nov:2001
    Location: Sofia
    Posts: 5,169
    Quote Originally Posted by Bombera View Post
    , -. string , . sizeof(chars[i]) e . .

    - Regional Settings - "...for non-unicode programs" "Bulgaria" CP1251.

    Unicode std::wstring.
    , !

  6. #6
    Bombera's Avatar
    Join Date: Jul:2001
    Location: 4EVA
    Posts: 13,833
    , , 1251. GetConsoleCP. , , string, STL(?), C++ .
    C++ -, .
    , IsCharAlpha , , , , .
    , , , - , , (). , - ANSI .
    , IsCharAlpha .
    EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
    Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |