hahahia

String Process 본문

Language/C++ STL

String Process

hahahia 2012. 3. 24. 11:28

                    <C Base>

bool isalpha(char)     - alphabet ?   
bool isalnum(char)    - alphabet or number ?
bool isupper(char)    - capital letter ?
bool islower(char)     - small letter ?
char toupper(char)    - change to capital letter
char tolower(char)     - change to small letter      

 
int atoi(char [])
float atof(char [])
int itoa(int, char [], int radix)
int _itoa(int, char [], int radix)
int _itoa_s(int, char [], size_t bufsize, int radix)
ex)  char str[100], str2[100];
 itoa(1024, str, 10);
 str = “1024”
 str = “10000000000”


                    <C++ Base>
 
find(“str”)                   - return value : offset
find(“str”, offset)             fail – return : -1
substr(offset, count)
insert(offset, “str”)
replace(offset, count, “str”)
erase(offset, count)
c_str()

/* 들어온 입력이 PUSH면 PUSH를 출력
POP이면 POP을 출력하시오 
ex)    <In>                  <Out>
        5                         PUSH
        ABC                    PUSH
        PUSH                  POP
        PUSH
        POP                       
        DEF
*/

#include <iostream>
#include <string>
using namespace std;

int main()
{
int n;
string s;
cin >> n;
while(n--)
{
cin >> s;
if(s==string("PUSH"))
cout << s << endl;
else if(s==string("POP"))
cout << s << endl;
}
return 0;
}

'Language > C++ STL' 카테고리의 다른 글

set  (0) 2012.03.24
Vector assign  (0) 2012.03.24
vector  (0) 2012.03.24
cmath  (0) 2012.03.24
sstream  (0) 2012.03.24
Comments