사이드바 열기






Posted by LaLuna







Posted by LaLuna




Posted by LaLuna

학교 실습시간

Posted by LaLuna
머리가 굳어서 인가.. 예제가 이따구 밖에 안나오네..

어떻게 쉽게 하려고 해도 똥망진창이 되어가는 코드..
주석도 붙이려다가.. 결국은 안붙이게 되고..




Posted by LaLuna

교수님께서 장장 일주일 전에 내주신 레포트를 내기 하루전에 시작했다.

흠 Scheme 문법이 생소하기도 하고, 내 생각이 폭넓지 못해 두어시간 고생한듯 싶다.

Source Code

Output
Posted by LaLuna
목적 : 수업시간에 분수를 클래스화 하는 실습을 진행하고 있고, 멘토링 모임을 진행하고 있어서 분수 클래스를 만들어 보기로 한다.

목표
1. 산술연산 및 대입연산, 관계연산이 모두 가능하도록 만들기로 한다.

2011년 10월 20일 목요일
헤더파일에 생성자와 파괴자, 연산자 오버로딩을 정의

Rational.h
Rational.cpp

Posted by LaLuna
#include 
#include 
#include 
#include 

#define UINT unsigned int

using namespace std;

typedef struct _Word_info {
    string word;
    int freq;
} Word_info;

bool compareTo(const Word_info& x, const Word_info& y);
string lowcaseString(const string &s);

int main(void)
{
    vector word_vector;
    string word;
    Word_info word_info;

    while( cin >> word ) 
    {
        bool flag= false;
        word = lowcaseString(word);
        if( word_vector.size() == 0)
        {
            word_info.word = word;
            word_info.freq = 1;
            word_vector.push_back(word_info);
            continue;
        }
        for(UINT i = 0; i < word_vector.size(); i++)
        {
            if(word_vector[i].word == word)
            {
                word_vector[i].freq++;
                flag = true;
            }
        }
        if( flag==false) {
            word_info.word = word;
            word_info.freq = 1;
            word_vector.push_back(word_info);
        }
    }
    sort(word_vector.begin(), word_vector.end(), compareTo);

    for(UINT i = 0; i < word_vector.size(); i++)
    {
        cout << word_vector[i].word << ' ' << word_vector[i].freq << endl;
    }
    return 0;
}

string lowcaseString(const string &s)
{
    char* buf = new char[s.size()+1];
    s.copy(buf, s.size());
    for(UINT i = 0; i < s.size(); i++) buf[i] = tolower(buf[i]);
    string word(buf, s.size());
    delete buf;
    return word;
}
bool compareTo(const Word_info& x, const Word_info& y)
{
    return x.word < y.word;
}
Posted by LaLuna
이걸 하면서 정말 답이 없다는걸 느낍니다.

그것은 HTML은 정말 답이 없다는걸요.
얼마나 Well-Format 한 Documet 가 중요하다는것을...

기본적인 parser 뼈대 코드 참고 : http://zyint.tistory.com/352
기본적인 자바 정규식 : http://litlhope.springnote.com/pages/1786498
자바 한글 정규식 참고 : http://ohgyun.tistory.com/132

Posted by LaLuna
이놈의 codepad css 글꼴하고 글자폭 높이 조절이 힘드네


Posted by LaLuna
이전페이지 1 2 3 4 다음페이지
위로

사이드바 열기