Contents

조회 수 18081 댓글 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] 자주 쓰는 패턴과 API

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

    Date2013.04.23 CategoryDevelop Byhooni Views18822
    Read More
  3. [ios] Debug Extensions (from 종길 차장님 ㅋㅋ)

    Date2013.04.23 CategoryDevelop Byhooni Views18913
    Read More
  4. [vc++] 게임 소스 등.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views19106
    Read More
  5. [js] jQuery 관련 사이트 링크 모음

    Date2013.04.23 CategoryDevelop Byhooni Views19376
    Read More
  6. [ios] None IB vs. StoryBoard 샘플 소스

    Date2013.09.06 CategoryDevelop Byhooni Views19413
    Read More
  7. [js] 동적(innerHTML)으로 자바스크립트 실행하기..

    Date2013.04.23 CategoryDevelop Byhooni Views19415
    Read More
  8. [ios] NSString 간단한 정규식 사용법

    Date2014.01.28 CategoryDevelop Byhooni Views19594
    Read More
  9. [ios] 앱에서 다른 앱 실행시키기

    Date2013.09.05 CategoryDevelop Byhooni Views19697
    Read More
  10. 모터에 대한 pid 제어.. ㅎㅎ

    Date2013.04.23 CategoryDevelop Byhooni Views19733
    Read More
  11. URI 인코딩, URL 인코딩

    Date2013.04.23 CategoryDevelop Byhooni Views19822
    Read More
  12. [java] 입출력 스트림 3부 (오브젝트)

    Date2013.04.23 CategoryDevelop Byhooni Views19898
    Read More
Board Pagination Prev 1 ... 55 56 57 58 59 60 61 62 63 64 ... 71 Next
/ 71