본문 바로가기

Studies

Visual Studio C++ 비쥬얼 스튜디오 링크에러 수정방법 첫번째 예제코드를 작성하고 봤더니 Visual Studio 2010 에서 링크 에러를 내네요. Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' 해결 방법은 인터넷 검색으로 찾았습니다. 이미 알려진 문제인 듯 합니다. 프로젝트 상태에서 메뉴 -> Project -> 맨 아래 Properties -> Linker -> General -> Enable Incremental Linking 을 "No" 로 변경합니다. 경로는 아래 그림을 참고하세요. 참고 > 만약 Properties로 진입했는데 Linker가 보이지 않는다면, 현재 소스코드 (C 또는 CPP파일)이 활성화된 상태라서 그렇습니다.. 더보기
윤성우 열혈강의 C 프로그래밍 솔류션 만들기 시작합니다 제목과 같습니다. C언어 교제중 가장 널리 사용되고 있는 윤성우 저자의 열혈강의 C에 대한 솔류션 만들기를 시작하려 합니다. 코드가 도움이 되신다면, 구글 광고라도 열심히 봐주시고 클릭해주시면 감사하겠습니다. 사실, 이 코드를 과제에 직접 카피해 쓰시다가는 조교님이나 교수님도 금방 찾아내실거에요. 구글에 검색하면 나올테니까요. 이 코드들이 네이버 검색에 걸릴지는 잘 모르겠네요 7월 한달 내에 100% 완성하는 것이 목표입니다. 뒷부분 고급 코드들은 소스 코드를 공개적으로 올리지는 않을지도 모르겠습니다. 그 부분은 수익모델 때문에 고민중입니다. 사실 이런 작업 자체가 용돈벌이가 될 수 있는가라는 질문에 대한 공개실험이라고 생각하셔도 좋습니다. 문의사항이나 필요한 내용이 있다면 방명록이나 E-mail을 주십.. 더보기
9장 Programming 1. 은행계좌 ※ 아 이건 문제가 좀 거지 같네요. Virtual 함수 쓰는 법 연습인 건 알겠지만, 문제 정의도 별로고... 실제 테스트 시나리오도 너무 부실하게 기술되어 있고... 좀더 문제가 이해하기 쉬웠으면 좋겠습니다. 결국, 제 맘대로 해버렸다는... 에서 cout으로 출력할 대, float 계산 결과의 소수점 맞추는 것도 마음에 안드네요. 이건 c의 stdio의 fprinf 같은 것 이용해야 깔끔합니다. ● BankAcct.h #ifndef __BACKACCT_H__ #define __BACKACCT_H__ #include #include class BankAcct { protected: int money; public: BankAcct(); ~BankAcct(); void deposit(int v_mone.. 더보기
Chapter 8 LAB solution p.339의 상속관련 예제입니다. ● human.h #include #include using namespace std; #ifndef HUMAN_H #define HUMAN_H class Human { protected: string name; int age; public: Human(); Human(string name, int age); ~Human(); void setName(string v_name); string getName(void); void setAge(int v_age); int getAge(void); void print(void); }; #endif ● human.cpp #include "human.h" Human::Human() { /* Default constructor */ .. 더보기
Programming 08-07 (p.338) 클래스 설계 Student.h #include #include using namespace std; class Student { protected: string name;//이름 string id;//학번 string major;//전공 unsigned int grade;//학년 unsigned int credit;//학점 public: Student(); ~Student(); }; Student::Student() { /* Do nothing */ } Student::~Student() { /* Do nothing */ } graduate.h class Graduate:private Student { private: string assistant;//조교 float scholarship;// 장학금 public: .. 더보기
[Review] Chapter 01. p.14 ~ 15 Name Space 와 변수 Name Space와 변수 ○ using namespace std (p.15) ● Using namespace 선언의 경우, 두 개 이상의 name을 등록할 수도 있다. 만약 두 개 이상의 name을 등록했을 때, 동일한 이름의 함수가 두 곳에 모두 있다면 compile error가 날 것인가? 아니면 어떤 우선순위를 가지고 넘어갈 것인가? test를 해보려면 어떻게 해야 하나? ○ 변수는 데이터를 담아두는 상자와 같다. (p.17) ● 변수를 상자로 표현하는 것은 좋은 아이디어가 아닌 것 같다. 변수는 실제 컴퓨터 안에서는 메모리 "주소"에 이름을 붙있다는 의미가 더 크다. Computer 구조와 연산방식에 대한 이해가 없다면 Pointer에 대한 이해는 영원히 어렵다. Basic 같은 언어에서라면 상.. 더보기
[Review] Chapter 01. p.06 - 객체지향방법 (Object-oriented approach)의 목적 객체 지향 방법의 최대 목표는 코드의 재사용(reuse)이다. (p.7) ● 객체지향의 최대 목표가 코드의 재사용일까? 실제 작업에서는 그 이점을 크게 느끼기는 어렵다. 다른 사람이 만든 코드를 라이브러리로 제공하는 것은 꼭 객체지향방법론에만 적용되는 것은 아니다. jQuery와 같이 JavaScript 같은 언어에서도 라이브러리로 함수 Set을 제공한다. 특히, Virtual 및 Interface를 이용한 추상함수의 경우, 함수 상속자가 각각의 함수를 재구현해야 한다. 경험한 바에 따르면, Class를 상속한다고 해서 작업량이 늘 줄어드는 것은 아니다. ● 객체지향의 가장 큰 장점은, 오히려 각각의 객체간의 완전한 분리를 통한 수정 용이성이 아닐까? 전역변수를 철저하게 배재하고 깔끔하게 독립적으로 돌아.. 더보기
뭐부터 할까? 확실히, 개강시즌이라 그런지 "C++ Espresso 해답" 이란 검색어로 들어오는 분들이 많네요. 진도가 어디쯤인지, 과제가 어떤 식인지, 혹은 어떤 부분이 막히는지 남겨주시면 그 부분부터 볼까 합니다. 뭐 교수님도 검색해서 이 블로그를 아시겠지만... 더보기
C++ Espresso 에스프레소 by 천인국 에 관한 Technical Review 및 과제 등록 게시판 입니다 C++ 책을 졸업하고 몇년만에 다시 훝어보고 있습니다. 그동안의 짬밥이 헛된 것이 아니기를 바라며, 책의 내용에 대한 궁금증들에 대한 답을 스스로 해보려고 합니다. 우선은 Technical한 부분에 치중을 하겠지만, 중간에 재미있는 과제들이 보인다면 그에 대한 해답도 가끔 올라갈 것입니다. 사실, 과제 위주로 하고 싶은 마음도 크지만, 블로그에 소스코드를 보기좋게 올리는 것이 생각보다 쉽지 않아서 - Syntax highlighting이 제대로 지원되지 않아, 캡춰 후 이미지로 올려야 웹에서 보기 좋습니다 - 좀 고민이 되고 있습니다. 새로 PC를 산 뒤에 아직 빌드 환경을 깔지 않은 것이 두번째 이유 입니다. 귀찮다고 여기는건데, 영 좋지 않습니다. 퇴근 후 잠깐잠깐 할까 했으나, 이미 잘시간이 되어갑.. 더보기
Project 9-67 Euclid's method to get the Greate commom divisor and the Least common muliple 유클리드 소거법으로 최대공약수, 최소공배수 구하기 //============================================================================ // 제출일 : 2005. 4. 12 // 작업환경 : Windows XP SP1, VC++ 6.0, Pentium4 // 연습문제 9-67 //============================================================================ #include int get_gcd(int a, int b); //recursive fuction int main() { int gcd; int a, b; cout > a; cout > b; gcd = get_gcd(a, b); cout 더보기
Project 4-41 Create customers' bills 영수증 발행 //============================================================================ // 제출일 : 2005. 3. 12 // 작업환경 : Windows XP SP1, VC++ 6.0, Pentium4 // 연습문제 4-41 // : Call by Reference를 사용하기 위하여 메인함수에 값을 받아오는 함수를 // 추가하였습니다. 클래스 구조를 사용할 경우 굳이 사용할 필요는 없습니다만 // 주어진 조건에 충실하기 위하여 추가하였습니다. //============================================================================ #include #include #define LABOR 0.35 .. 더보기
Project 4-40 Random number 랜덤 //============================================================================ // 제출일 : 2005. 3. 12 // 작업환경 : Windows XP SP1, VC++ 6.0, Pentium4 // 연습문제 4-40 //============================================================================ #include #include #include #include int main() { float number; int rand_num; float product; //Process No. cout > number; //2 cout 더보기
Project 4-39 Temperature convertor : Fathrenheit VS Centigrade 온도변환기 : 화씨 섭씨 //============================================================================ // 제출일 : 2005. 3. 12 // 작업환경 : Windows XP SP1, VC++ 6.0, Pentium4 // 연습문제 4-39 //============================================================================ #include void C2F(float input) //썹씨를 화씨로 고치는 함수 { float output; output = 32 + input*(180/100); //변환식 cout 더보기
Project 4-38 Compute the interest and print the balance //============================================================================ // 제출일 : 2005. 3. 12 // 작업환경 : Windows XP SP1, VC++ 6.0, Pentium4 // 연습문제 4-38 //============================================================================ #include #include #include #include #include float calc(float input); //이자의 계산 void print(float input); //출력 int main() { float begining_balance; cout > begining.. 더보기
Project 4-37 Prepare a payroll earnings statement //============================================================================ // 제출일 : 2005. 3. 12 // 작업환경 : Windows XP SP1, VC++ 6.0, Pentium4 // 연습문제 4-37 // data.txt로 부터 세일즈맨의 정보를 읽어와 처리함 //============================================================================ #include #include #include #include #include class Salesperson { public: Salesperson(); //Default 생성자 ~Salesperson(); //소멸자 voi.. 더보기
Problem 4-35 print the ceiling, floor, and rounded value of a floating-point number //============================================================================ // 제출일 : 2005. 3. 12 // 작업환경 : Windows XP SP1, VC++ 6.0, Pentium4 // 연습문제 4-35 //============================================================================ #include #include float round(float num); int main() { float num; cout > num; cout 더보기
Problem 4-33 Modify the "Add two digit" grogram //============================================================================ // 제출일 : 2005. 3. 12 // 작업환경 : Windows XP SP1, VC++ 6.0, Pentium4 // 연습문제 4-33 //============================================================================ #include //using namespace std; // Prototype Declarations int addThreeDigits (int num); int firstDigit (int); int secondDigit (int); int thirdDigit (int); int ma.. 더보기
Computer Science: A structured approach using C++ This book is the main textbook of this category. I'll post exercise & quizz's solutions on this category. Please, do NOT simple copy & paste for your homework. If you can find this one, your prof. & friends can find, too. It's no easy to avoid copy finder. :-( If you need more hint, leave some message on Guestbook. Thanks. 이 책이 교과서고, 앞으로 이 카테고리에는 연습문제의 소스들이 일부 올라갈 것임. 힘들게 숙제를 했는데 그냥 나만 보기는 좀 아쉬워.. 더보기
문제 2. 지뢰 찾기 (Mine sweeper) // Written by rinehart // rinehart@naver.com //2007. 6. 8 /* Note : This code will be better if get map text from file. (I'm lazy...) Maybe, some part of main function need to seperate to another functions */ #include #include #include #define MAP_MAX 100 #define Type_New_map 1 #define Type_Read_map 2 #define Type_Exit 3 int Get_String(char *input_buf, int *m, int *n); int Get_Result(char **map,.. 더보기
문제 1. 3n+1 문제(The 3n+1 Problem) // Written by rinehart // rinehart@naver.com //2007. 6. 1 /* Note : About 110,000 times tries, the program freezed. I don't know why. Maybe the windows OS can't support too much loop or function calls. */ #include #include #include #define MAX_INPUT 1000000 #define MIN_INPUT 1 int Get_Numbers(int *input_a, int *input_b); int Get_Cycle(int x); int main() { int v_input_a, v_input_b, v_input_temp; .. 더보기
File mode checker APUE 책에 IF - ELSE로 구현 된 것을 switch - case로 재구현 한 것. stat 스트럭쳐 의 st_mode 의 내부를 들여다 본 것. 헤더파일과 구현부로 나뉘어 있음. /* Header : myhdr.h */ #include #include #include "ourhdr.h" //Defined Values #define N_IFREG 32768 // 1000 0000 0000 0000 #define N_IFDIR 16384 // 0100 0000 0000 0000 #define N_IFCHR 8192 // 0010 0000 0000 0000 #define N_IFBLK 24576 // 0110 0000 0000 0000 #define N_IFIFO 4096 // 0001 0000 00.. 더보기
myShell 입력받은 커맨드를 실행하고, 그 실행 시간을 측정한다. 유닉스 쉘의 입력 부분만 흉내낸 것 Get command from user, then calculate the command's execute time. This is a simple UNIX shell. Just make command input part #include //for types for time and etc. #include //for wait() #include //for signal catching #include "ourhdr.h" //System Programming Default Header #include //for times() //functions static void sig_int(int); /* our signal-.. 더보기
myCAT : cat(1) 파일의 내용을 보여주거나, 둘 이상의 파일을 내용을 합쳐서 출력해주는 cat(1)을 직접 구현한 것. cat는 유닉스에 기본으로 포함되어 있는 명령어이다. #include "ourhdr.h" //기본 헤더파일 //Common header int main (int argc, char *argv[]) { FILE *file[argc-1]; //파일 포인터 배열 : 입력 받은 파일 명의 수 만큼 파일포인터를 선언 int loop; //순환문을 위한 변수 char buffer; //Read Buffer if (argc 더보기
WC : Word Count UNIX의 wc(1)의 기능을 구현한 것. #include "ourhdr.h" //System Programming Default Header enum bool {false, true}; //C dosen't support the "boolean" type. So, I defined as enumeration type. ///////////////////////////////////////// //main function //////////// //////////////////////////////////////// int main (int agrc, char *agrv[]) { int c = 0; //get character input int lines = 0, words = 0 , bytes = 0;.. 더보기
실행파일 만들기 : Make a .exe file for APUE APUE 의 모든 소스 코드들은 우선 error.h 가 컴파일 된 상태에서 링크를 통해 만들어져야 한다. 직접적인 예제를 보여주면 gcc -c error.c //error.o가 만들어짐 gcc -c myWC.c //myWC.o가 만들어짐 gcc -o a.out error.o myWC.o //실행파일을 a.out으로, error.o와 myWC.o를 링크시킨다. a.out //실행. 더보기
error.c Advanced Programming in the UNIX Environment 의 기본적인 error처리 library. 컴파일 해서 Object파일을 만든 후, 실제 실행파일 컴파일 시 링크시켜 줄 것. #include /* for definition of errno */ #include /* ANSI C header file */ #include "ourhdr.h" static void err_doit(int, const char *, va_list); char *pname = NULL; /* caller can set this from argv[0] */ /* Nonfatal error related to a system call. * Print a message and return. */ voi.. 더보기
ourhdr.h 역시, Advanced Programming in the UNIX Environment(이하 APUE)의 기본 헤더파일. 다운 받아도 좋고, 직접 긁어 저장해도 좋다. /* Our own header, to be included *after* all standard system headers */ #ifndef __ourhdr_h #define __ourhdr_h #include /* required for some of our prototypes */ #include /* for convenience */ #include /* for convenience */ #include /* for convenience */ #include /* for convenience */ #define MAXLINE 40.. 더보기
Advanced Programming in the UNIX Environment http://www.yendor.com/programming/unix/apue/apue.html Advanced Programming in the UNIX Environment by W. Richard Stevens Addison-Wesley Professional Computing Series 0-201-56317-7 * Hardback * 768 pages * ©1992 Web/HTML/man-page-linking by: Ariel Faigon 위 주소에 가면 이 책의 모든 소스를 구할 수 있다. 정말, 주옥같은 소스코드들이 실려있는 책이다. 아직 본격적으로 본문을 읽지는 않고, 소스코드만 보고 있는데, 그것만으로도 이 책의 진가를 알 수 있다. 더보기
게시판별 용도 각 게시판의 용도를 알려드립니다. Studies : 각 교과서들의 해설과 연습문제 풀이 A Book on C : C 언어 기본서. Kelley & Pohl. 4th Edition. 영문판 A Structured Approach Using C++ : C++ 기본서. 2nd Edition. 영문판 Advanced Programming in the UNIX Environment : Stevens. System Programing 기본서. 영문판 Programming Chanllenge 알고리즘 트레이닝 북 : 프로그래밍 연습문제집 Excercise & Quizz : 교과서에 없는 연습문제와 과제 풀이 Term Project : 규모가 좀 되는 프로젝트. ECIM List (Help!) : 방명록을 통해 들어온.. 더보기
[개강공지] Computer Engineering 1st year. Blog just opend and Welcome! 안녕하세요. 컴공과 1학년 블로그 과대표 로엔그린 입니다. 네이버에 본래 블로그를 운영하고 있었으나, 좀더 전문적인 내용으로 바꾸기 위하여 컴퓨터 관련된 내용을 새로운 블로그로 독립하여 운영합니다. 기존 블로그는 본의 아니게 지나치게 정치색(?)을 띠게 되어버렸습니다. 과대표 소개를 간단하게 드리면, 최초로 베이직으로 프로그램을 짠지 한 16년 정도 되었습니다. 컴공과에 입학하여 C언어를 배운지 10년 정도 되었습니다. 그리고, 지금도 프로그램을 만드는 것을 업으로 하고 있습니다. 어떤 개그맨은 "16년 정도 하면 달인이다" 라고 주장합니다만, 아직 짠 프로그램의 수가 5만 6천개가 안되서인지... 아직 달인이라고 부르기는 부끄러울 정도의 수준입니다. 프로가된 지금 돌아보면 항상, "그 때 배울 때 이런.. 더보기