Contents

조회 수 7046 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
연습과제 1>>
main함수의 소스가 수행될 수 있는 String클래스를 디자인해보자.

[main함수]
int main()
{
    String str1 = "Good";
    String str2 = "morning";
    String str3;    

    str1 = str3 = str2;
    str1 = "good ";        
    String str4 = str1 + str2;
    
    cout << str1 <<endl;
    cout << str2 <<endl;
    cout << str3 <<endl;
    cout << str4 <<endl;
    
    str1 += str2;
    if(str1 == str4)
        cout << "문자열이 일치합니다.
";
    else
        cout << "문자열이 일치하지 않습니다.
";
    
    String str5;
    cout << "문자열 입력 : ";
    cin >> str5;
    
    cout << "입력 문자열은 [" << str5 << "] 입니다.
";
    
    String str6 = "Hello";
    
    if( !str6.isEmpty() ) //문자열이 비어있는지 검사하는 함수
    {        
        str6.Empty(); //문자열 비우는 함수
        cout << "str6 문자열 초기화 수행
";        
    }
    
    cout << "str6 문자열 출력 : " << str6 << endl;    
    str6 = "Happy Birthday";
    
    str6.Replace(); //문자열 역순저장 함수
    cout << "역순 문자열은 " << str6 << " 입니다.
";
    
    int len = str6.Lenth(); //문자열의 길이를 구하는 함수
    cout << "문자열의 길이는 " << len << " 입니다.
";
    
    return 0;
}


?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
405 Develop git 브런치 배우기 (링크) hooni 2013.07.09 20571
404 System/OS [mac] 컨텍스트(Context) 메뉴 "다음으로 열기" 내용 정리 hooni 2013.07.10 18798
403 Etc 영어의 12 시제 (The twelve tenses of English) hooni 2013.07.12 15702
402 Develop [ios] App States file hooni 2013.07.22 13195
401 Develop [ios] Background 에서 네트워크 사용 file hooni 2013.07.22 11510
400 Develop [ios] 소소한 팁 (Rect,Point,Path,URL 등) hooni 2013.08.08 29457
399 Develop [ios] libxml/tree.h file not found file hooni 2013.08.08 18709
398 Develop [ios] UI컨트롤러 샘플코드 hooni 2013.08.08 15425
397 Develop [ios] 최신 UI 모음.. (나중에 정리할 것) secret hooni 2013.08.09 0
396 Develop 아이 훌레시 작업중 ㅋㅋ secret hooni 2013.08.09 0
395 Etc [web] 제로보드 XE 템플릿에서 if문에 대해서 알아봅시다 hooni 2013.08.16 19815
394 Etc 베지어 곡선 (Bezier curve) file hooni 2013.08.18 221478
Board Pagination Prev 1 ... 60 61 62 63 64 65 66 67 68 69 ... 98 Next
/ 98