조회 수 18079 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
string class를 이용하여 문자열을 거꾸로 출력하는 프로그램 작성.

확실히 C style로 하는 것보다 편리하다. 
#include<iostream>
#include<string>
using namespace std;

string ReverseString(const string src, int len)
{
      string reverse;

      for(int i=0;i<len;i++)
            reverse+=src.substr(len-i-1,1);

      return reverse;
}

int main()
{
      string origin;
      //cin>>origin;  //space를 문자열의 끝으로 받아들인다. 
      getline(cin,origin); //한줄을 받아들이는 함수 C++ style

      string copy=ReverseString(origin,origin.size());

      cout<<origin<<endl;
      cout<<copy<<endl;

      return 0;
}

?

  1. [perl] 영규가 만든 스크립트.. 하하..

    Date2013.04.23 CategorySystem/OS Byhooni Views19198
    Read More
  2. NAT와 DHCP에 대한 간단한 설명

    Date2013.04.23 CategorySystem/OS Byhooni Views19152
    Read More
  3. [vc++] 게임 소스 등.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views19104
    Read More
  4. [windows] 인터넷 익스플로러(IE) 도구모음 표시줄에 아이콘 추가

    Date2013.04.23 CategorySystem/OS Byhooni Views19089
    Read More
  5. [windows] 종료, 재시작, 로그아웃 아이콘 만들기

    Date2013.04.23 CategorySystem/OS Byhooni Views19079
    Read More
  6. [web] 웹서비스 취약점 자료.. (논문첨부)

    Date2003.04.23 CategorySystem/OS Byhooni Views18924
    Read More
  7. [ios] Debug Extensions (from 종길 차장님 ㅋㅋ)

    Date2013.04.23 CategoryDevelop Byhooni Views18907
    Read More
  8. [c#] 정규표현식을 이용한 문자열에서 태그 제거함수

    Date2013.04.23 CategoryDevelop Byhooni Views18816
    Read More
  9. [linux] 메일서버 세팅정보(sendmail)

    Date2003.04.23 CategorySystem/OS Byhooni Views18653
    Read More
  10. [windows] 도스 사용 팁

    Date2003.04.23 CategorySystem/OS Byhooni Views18632
    Read More
  11. GSM에서 음성이 실리는 과정 요약..

    Date2013.04.23 CategoryEtc Byhooni Views18627
    Read More
  12. [linux] 커널 컴파일, 설정

    Date2003.04.23 CategorySystem/OS Byhooni Views18626
    Read More
  13. 무선 인증 서버.. 김도.. ㅋㅋ

    Date2013.04.23 CategorySystem/OS Byhooni Views18623
    Read More
  14. 암호 알고리즘 및 프로토콜의 이해..

    Date2013.04.23 CategoryAlgorithm Byhooni Views18577
    Read More
  15. 네트워크별 MTU(최대 전송 단위)

    Date2013.04.23 CategorySystem/OS Byhooni Views18500
    Read More
  16. [windows] 패스워드를 잊어먹었을때..

    Date2003.04.23 CategorySystem/OS Byhooni Views18491
    Read More
Board Pagination Prev 1 ... 12 13 14 15 16 ... 74 Next
/ 74