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] iphone SetDeviceOrientation 화면 강제 회전

    Date2013.11.20 CategoryDevelop Byhooni Views20236
    Read More
  2. [js] 파이어폭스(Firefox;F/F)에서 outerHTML 작동하도록 만든 메소드

    Date2013.04.23 CategoryDevelop Byhooni Views20152
    Read More
  3. [ios] Objective-C에서 형식이 있는 문자열(Format Strings)에 사용할 수 있는 토큰들(Tokens)

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

    Date2013.04.23 CategoryDevelop Byhooni Views19892
    Read More
  5. URI 인코딩, URL 인코딩

    Date2013.04.23 CategoryDevelop Byhooni Views19820
    Read More
  6. 모터에 대한 pid 제어.. ㅎㅎ

    Date2013.04.23 CategoryDevelop Byhooni Views19726
    Read More
  7. [ios] 앱에서 다른 앱 실행시키기

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

    Date2014.01.28 CategoryDevelop Byhooni Views19573
    Read More
  9. [js] 동적(innerHTML)으로 자바스크립트 실행하기..

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

    Date2013.09.06 CategoryDevelop Byhooni Views19407
    Read More
  11. [js] jQuery 관련 사이트 링크 모음

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

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