Difference between revisions of "컴퓨터프로그래밍및실습"
Jump to navigation
Jump to search
Line 109: | Line 109: | ||
* Unix에서 프로세스가 만들어지면 생성되는 세 개의 파일. 모든 프로세스는 세 개의 파일이 열려(open)있다. | * Unix에서 프로세스가 만들어지면 생성되는 세 개의 파일. 모든 프로세스는 세 개의 파일이 열려(open)있다. | ||
**Standard input, standard output, standard error | ** Standard input, standard output, standard error | ||
** | ** Standard output 예제<syntaxhighlight lang="c">#include <stdio.h> | ||
#include <fcntl.h> | |||
int main() | |||
{ | |||
int fd; | |||
char buf[10]; | |||
strcpy(buf, "hello\n"); | |||
fd = open("stdoutput.c", O_RDONLY); | |||
printf("%d\n", fd); | |||
write(1, buf, sizeof(buf)); | |||
}</syntaxhighlight> | |||
** 실행 결과<syntaxhighlight lang="text"> | |||
3 | |||
hello</syntaxhighlight> | |||
==== 4교시 HUFS Karel 프로그래밍 ==== | ==== 4교시 HUFS Karel 프로그래밍 ==== |
Revision as of 17:55, 6 July 2022
개요
대상
한국외국어대학교 정보통신공학과 2학년
교재
- 절대 JAVA - 자바프로그래밍의 기초부터 안드로이드까지 (강환수, 조진형) INFINITY BOOKS
- 배포하는 강의자료
실습 사이트
- 구름(Goorm) 사이트를 활용한 실습 및 과제
참고 자료
실습 도구
Java compiler
- 두 가지 버전이 필요합니다. Karel을 이용한 실습을 위하여 Java SE 1.6 버전이 필요합니다.
- 그 외의 실습을 위하여 Java SE 1.7 이후 버전이 필요합니다.
- JAVA_HOME 환경 변수 설정 (예: JAVA_HOME, C:\Program Files\Java\jdk-11.0.8)
- Windows 10의 경우 다음 메뉴를 선택하여 환경 변수 설정함 : 설정 / 정보 / 고급 시스템 설정 / 환경 변수
Visual Studio Code (vscode)
- 설치
- vscode 다운로드 - 본인의 운영체제에 해당하는 것을 다운로드하여 설치합니다.
- Extension 설치
- vscode를 설치한 다음 확장 메뉴(Ctrl-<shift>-X)를 선택하여 Extension 설치합니다.
- Vscode에서 설치해야 할 Extensions
- Java를 위한 확장들
- Extension Pack for Java
- Debugger for Java
- Language Support for Java(TM) by Red Hat
- Project Manager for Java
- 한국어 메뉴 지원
- Korean Language Pack for Visual Studio Code
- 프로젝트 관리
- IntelliCode
- Maven for Java
- Maven dependency explorer
- Unified Modeling Language(UML) 지원
- PlantUML
- PlantUML Previewer
- PlantUML Grammer
- Windows Subsystem for Linux (WSL) 지원
- Remote - WSL
- Java를 위한 확장들
강의 자료
1주차 - 오리엔테이션
1교시 Java와 프로그래밍의 중요성
- 오리엔테이션 - 강의 방법, 강의 내용
- 도구로서의 프로그래밍 언어
- 조각가 로댕의 예술 작품은 무엇인가?
- 조각가 로댕의 도구는 무엇인가?
- 구름 사이트 가입 방법
- 가입한 후 이름, 학번, 학과를 반드시 기입할 것. 이름에 학번, 학과 등을 붙이지 말 것.
- 이름의 적절한 예 : 홍길동, 부적절한 예 : 홍길동_2022012345
2교시 실습 환경 구축 (각자 노트북을 가져올 것)
- Java 설치법
- Vscode 설치법
3교시 기본 예제 프로그램 및 설명
- 첫 번째 Java 프로그램 @ The Java Programming Language (Ken Arnold, James Gosling, David Holmes)
public class FirstClass { public static void main(String[] args) { System.out.println("hello"); } }
- 첫 번째 C 프로그램 @ The C Programming Language (Brian W. Kernighan, Dannis M. Ritchie) - Unix의 창시자
#include <stdio.h> int main() { fprintf(stdio, "hello\n"); }
- C/C++ Extension 설치
- MinGW-w64 설치
$ pacman -Syu // 설치 후 실행 $ pacman -Syu // Run "MSYS2 MSYS" from Start menu. $ pacman -S --needed base-devel mingw-w64-x86_64-toolchain
- Path에 C:\msys64\mingw64\bin 등록함
- vscode 실행
mkdir projects cd projects mkdir helloworld cd helloworld code .
- Build
- 터미널 / 작업 실행 선택
- 실행 : 터미널에서 직접 helloworld.exe를 실행한다.
- 첫 번째 C++ 프로그램 @ The C++ Programming Language (Bjarne Stroustrup)
#include <iostream> using namespace std; int main() { cout << "hello" << endl; }
- Unix에서 프로세스가 만들어지면 생성되는 세 개의 파일. 모든 프로세스는 세 개의 파일이 열려(open)있다.
- Standard input, standard output, standard error
- Standard output 예제
#include <stdio.h> #include <fcntl.h> int main() { int fd; char buf[10]; strcpy(buf, "hello\n"); fd = open("stdoutput.c", O_RDONLY); printf("%d\n", fd); write(1, buf, sizeof(buf)); }
- 실행 결과
3 hello