Contents

조회 수 18079 댓글 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. [ios] Debug Extensions (from 종길 차장님 ㅋㅋ)

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

    Date2013.04.23 CategoryDevelop Byhooni Views18815
    Read More
  3. [ios] 자주 쓰는 패턴과 API

    Date2013.04.23 CategoryDevelop Byhooni Views18426
    Read More
  4. [c] 팩토리얼 서버/클라이언트..

    Date2003.04.23 CategoryDevelop Byhooni Views18266
    Read More
  5. [java] 입출력 스트림 1부 (문자)

    Date2013.04.23 CategoryDevelop Byhooni Views18154
    Read More
  6. [c] ICMP 패킷을 이용한 장난감

    Date2003.04.23 CategoryDevelop Byhooni Views18126
    Read More
  7. [c++] 문자열 뒤집기(문자열 거꾸로 출력)

    Date2013.04.23 CategoryDevelop Byhooni Views18079
    Read More
  8. [unix] 쉘 스크립트 예제 모음

    Date2003.04.23 CategoryDevelop Byhooni Views17975
    Read More
  9. [winmobile] 윈도우 모바일 간단한 테스트 코드 ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views17955
    Read More
  10. [ios] PHP로 APNS 프로바이더~

    Date2013.06.27 CategoryDevelop Byhooni Views17940
    Read More
  11. 프로그래밍 소스 관련 사이트..

    Date2013.04.23 CategoryDevelop Byhooni Views17900
    Read More
  12. 프로그램 문서 관리 (Doxygen)

    Date2013.04.23 CategoryDevelop Byhooni Views17834
    Read More
Board Pagination Prev 1 ... 7 8 9 10 11 12 13 14 15 16 ... 71 Next
/ 71