Views 17281 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
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. [unix] 날짜 관련 쉘 명령어 (특정일 또는 +-시간, 날짜 계산된 값)

  2. [sql] 중복데이터 삭제 쿼리

  3. [linux] 랜카드 2개 설정 & iptables 로 사설 ip..

  4. [htm] DOM에 대해 ㅎㅎ

  5. [css] z-index에 설정할 수 있는 최대값?

  6. [linux] 리눅스 활용 팁^^

  7. [linux] sendmail 설정/사용

  8. [linux] 아파치설치/설정(CGI부분)

  9. [mac] SVN 1.8 업데이트 방법

  10. [ios] Objective-C에서 SQLite 사용하기..

  11. [ios] iOS In App Purchase #1 (코드 구현 전 웹 설정 작업)

  12. [doc] 네트워크 장비와 라우터 설정 방법 발표 자료

  13. [linux] 아파치설치/설정

  14. [linux] 기본 명령어 (내공쌓기)

  15. [c] 메시지큐(Message Queue) 설명.. (joinc)

  16. [c] vc++ 에서 clrscr(), gotoxy() 함수 사용하기..

Board Pagination Prev 1 ... 17 18 19 20 21 ... 74 Next
/ 74