Contents

조회 수 17291 댓글 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. [c++] SetWindowPos함수를 이용한 크기조절 예제

    Date2013.04.23 CategoryDevelop Byhooni Views11092
    Read More
  2. [c++] 바탕화면 테두리에 자석처럼 붙는 스냅효과..

    Date2013.04.23 CategoryDevelop Byhooni Views8907
    Read More
  3. [c++] 트리컨트롤 스텝 3 예제..

    Date2013.04.23 CategoryDevelop Byhooni Views7951
    Read More
  4. [c++] 트리컨트롤 스텝 2 예제..

    Date2013.04.23 CategoryDevelop Byhooni Views6961
    Read More
  5. [c++] 트리컨트롤 예제1 ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views7176
    Read More
  6. [c++] 윈도우 프로세스뷰어 분석.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views8842
    Read More
  7. [c++] 레지스트리 편집하는 부분..ㅡㅡ;

    Date2013.04.23 CategoryDevelop Byhooni Views8282
    Read More
  8. [js] 서서히 나타나는 화면.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views6199
    Read More
  9. [php] 이미지 회전시키기(gd)

    Date2013.04.23 CategoryDevelop Byhooni Views7320
    Read More
  10. [C++] 18일차 과제물, String 클래스 디자인 【 C++ 문제 】

    Date2013.04.23 CategoryDevelop Byhooni Views7048
    Read More
  11. [c++] 문자열 뒤집기(문자열 거꾸로 출력)

    Date2013.04.23 CategoryDevelop Byhooni Views17291
    Read More
  12. [php] 현재에서 일정한 날짜 더하기..

    Date2013.04.23 CategoryDevelop Byhooni Views7116
    Read More
Board Pagination Prev 1 ... 36 37 38 39 40 41 42 43 44 45 ... 71 Next
/ 71