12 Mart 2010 Cuma

C++ da toupper() ve tolower() Metodları

//www.ethemsulan.com
#include <cstdlib>
#include <iostream>
#include <cctype>
using namespace std;
const int ignore=0;
const int upper=1;
const int lower=2;
void print(char *s,int how=-1){
     static int oldcase=ignore;
     if(how<0) how=oldcase;
     while(*s){
               switch(how){
 case upper: cout<<(char) toupper(*s);break;
case lower:cout<<(char) tolower(*s);break;
                           default:cout<<*s;
                           }
                           s++;
               }
               oldcase=how;
     }
int main(int argc, char *argv[])
{
    print("KEWIN MITNICK\n",ignore);
    print("hacker kewin mitnick\n",upper);
    print("MEHMET ETHEM SULAN\n",lower);
    print("ethem kewin\n");
    system("PAUSE");
    return EXIT_SUCCESS;
}

Hiç yorum yok:

Yorum Gönder