별의 공부 블로그 🧑🏻‍💻

🗒️ Categories (1539)

728x90
  1. 2017.10.15 CMD에서 프로그램의 출력값을 txt 파일로 저장하는 방법

    - 우선 컴파일 되어 생성된 프로그램 실행 파일(.exe)과 입력 값이 들어 있는 파일(.txt)이 필요하다. 1. - 테스트를 하기 위해 최상위 루트인 C:/ 디렉토리에 프로그램(binary.exe)과 input1.txt 파일을 각각 넣었다. 2. - input1.txt 파일의 내용을 확인하였다. 2. - 관리자 권한으로 CMD를 실행하여 최상위 루트인 C:/ 디렉토리로 이동하기 위하여 cd / 명령어를 입력하였다.- 그 다음, binary exe output1.txt 명령어를 입력하여 binary.exe 프로그램을 통하여 input1.txt 파일 안의 내용의 결과가 output1.txt 파일을 통하여 출력되도록 하였다.- 명령어 형식은 아래와 같다. 프로그램 이름 출력 파일 이름 - 그러면 같은 경로..

  2. 2017.10.15 PowerShell 명령어 모음

    - PowerShell에 Get-Command 명령어를 입력하면 알 수 있음. CommandType Name Version Source----------- ---- ------- ------Alias Add-ProvisionedAppxPackage 3.0 DismAlias Add-ProvisioningPackage 3.0 ProvisioningAlias Add-TrustedProvisioningCertificate 3.0 ProvisioningAlias Apply-WindowsUnattend 3.0 DismAlias Disable-PhysicalDiskIndication 2.0.0.0 StorageAlias Disable-StorageDiagnosticLog 2.0.0.0 StorageAlias Enab..

  3. 2017.10.15 CMD 명령어 모음

    [유틸리티 실행] CALC 계산기 CHARMAP 문자표 CLEANMGR 디스크 정리 CLICONFG SQL Server 클라이언트 네트워크 유틸리티 EXPLORER 탐색기 MAGNIFY 돋보기 MRT 악성 소프트웨어 제거 도구 MSCONFIG 시스템 구성 MSINFO32 시스템 정보 MSPAINT 그림판 MSTSC 원격 데스크톱 연결 NOTEPAD 메모장 OSK 화상 키보드 REGEDIT 레지스트리 편집기 SIGVERIF 장치 드라이버 디지털 서명 검사 TASKMGR 작업 관리자 WRITE 워드패드 [제어판] APPIWIZ.CPL 프로그램 추가 및 제거 CONTROL 제어판 CONTROL DESKTOP 개인 설정 CONTROL FOLDERS 폴더 옵션 CONTROL FONTS 글꼴 CONTROL KEYB..

  4. 2017.10.10 0부터 n까지의 숫자의 2진수 출력하기

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 // 0부터 입력받은 수의 2진수 출력하기 #include #include // pow() using namespace std; void main() { int x, num; cin >> num; for (int j = 0; j = 0; --x) { cout x) & 1); } cout

  5. 2017.10.06 [C] 배열의 크기를 입력 받아 해당 크기의 배열 생성하기 (동적 할당)

    배열의 크기를 입력 받아 해당 크기의 배열 생성하기 (동적 할당) 가끔. 배열의 크기를 처음부터 확정짓지 못할 경우가 많다. 또 쓰지 않는 공간이 많은 배열을 생성하여 메모리를 낭비하는 경우가 생기곤 한다. 이럴 때는 동적할당을 이용하여 사용자로부터 배열의 크기를 입력 받아 해당 크기의 배열을 생성하여 메모리를 절약할 수 있다. 아래는 예시 코드이다. #include // scanf, printf #include // malloc, free int main(void) { int *arr; // 배열 이름을 포인터 변수로 int n; // 배열의 크기를 받을 변수 int i; printf("배열의 크기 : "); scanf("%d", &n); // 배열의 크기를 받음 arr = (int *)malloc(s..

  6. 2017.09.27 [BOJ1110][C++] 더하기 사이클

    문제 0보다 크거나 같고, 99보다 작거나 같은 정수가 주어질 때 다음과 같은 연산을 할 수 있다. 먼저 주어진 수가 10보다 작다면 앞에 0을 붙여 두 자리 수로 만들고, 각 자리의 숫자를 더한다. 그 다음, 주어진 수의 가장 오른쪽 자리 숫자와 앞에서 구한 합의 가장 오른쪽 자리 숫자를 이어 붙이면 새로운 수를 만들 수 있다. 다음 예를 보자. 26부터 시작한다. 2+6 = 8이다. 새로운 숫자는 68이다. 6+8 = 14이다. 새로운 숫자는 84이다. 8+4 = 12이다. 새로운 숫자는 42이다. 4+2 = 6이다. 새로운 숫자는 26이다. 위의 예는 4번만에 원래 숫자로 돌아올 수 있다. 따라서 26의 사이클의 길이는 4이다. N이 주어졌을 때, N의 사이클의 길이를 구하는 프로그램을 작성하시오...

  7. 2017.09.24 [Web] 온라인 저지 사이트 목록

    한국 사이트 AOJ (Algospot), Algospot Online Judge V2 Baekjoon Online Judge, Baekjoon Online Judge JUNGOL 정올 (한글과 컴퓨터 학원 (경기도) OJ) DOVELET 더블릿 koistudy koistudy.net (경기과학영재학교 OJ) Codeup CodeUp Online Judge 외국 사이트 en: Codeforces Codeforces en: TopCoder TopCoder en: CodeChef CodeChef en: HackerRank HackerRank en: Sphere Online Judge SPOJ en: POJ 북경대학교 온라인 저지 (Peking University Judge Online) en: UVa Onli..

  8. 2017.09.24 [BOJ11721][C++] 열 개씩 끊어 출력하기

    문제 알파벳 소문자와 대문자로만 이루어진 길이가 N인 단어가 주어진다. 한 줄에 10글자씩 끊어서 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 단어가 주어진다. 단어는 알파벳 소문자와 대문자로만 이루어져 있으며, 길이는 100을 넘지 않는다. 길이가 0인 단어는 주어지지 않는다. 출력 입력으로 주어진 단어를 열 개씩 끊어서 한 줄에 하나씩 출력한다. 단어의 길이가 10의 배수가 아닌 경우에는 마지막 줄에는 10개 이하의 글자만 출력할 수도 있다. 예제 입력 1 BaekjoonOnlineJudge 예제 출력 1 BaekjoonOn lineJudge 예제 입력 2 OneTwoThreeFourFiveSixSevenEightNineTen 예제 출력 2 OneTwoThre eFourFiveS ixSevenEi..

  9. 2017.09.23 [STL] ceil, floor, round

    *[STL] ceil, floor, round - 헤더 파일 (header) C : C++ : - ceil() : 올림 함수 (C90, C99, C++98, C++11) - floor() : 내림 함수 (C90, C99, C++98, C++11) - round() : 반올림 함수(C99, C++11). floor(x + 0.5)로 구현할 수 있음. - 자세한 내용 ceil : http://www.cplusplus.com/reference/cmath/ceil/ floor : http://www.cplusplus.com/reference/cmath/floor/?kw=floor round : http://www.cplusplus.com/reference/cmath/round/?kw=round [예제 코드] 1..

  10. 2017.09.22 [BOJ11720][C++] 숫자의 합 : 문자를 정수로 바꾸기

    문제 N개의 숫자가 공백 없이 쓰여있다. 이 숫자를 모두 합해서 출력하는 프로그램을 작성하시오. 입력첫째 줄에 숫자의 개수 N (1 ≤ N ≤ 100)이 주어진다. 둘째 줄에 숫자 N개가 공백없이 주어진다. 출력입력으로 주어진 숫자 N개의 합을 출력한다. 예제 입력 1 1 1 예제 출력 1 1 예제 입력 2 5 54321 예제 출력 2 15 힌트 출처 · 문제를 만든 사람: baekjoon 알고리즘 분류 · 출력 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #include using namespace std; int main() { int n; char num[100]; // 문자 담을 배열 int numb[100]; /..

  11. 2017.09.22 [STL] sort

    *[STL] sort - 데이터의 크기에 따라 오름차순 또는 내림차순으로 데이터를 정렬해주는 함수. - C++ 표준라이브러리 헤더에 포함되어 있음. - 헤더 : 내림차순 정렬을 위한 greater을 포함하고 있는 헤더. - sort 함수는 정수뿐만 아니라 크기 비교가 가능한 모든 변수들을 정렬 할 수 있음.- 시간 복잡도 : - 템플릿 default (1) template void sort (RandomAccessIterator first, RandomAccessIterator last); custom (2) template void sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp); - 자세한 내용 : http://ww..

  12. 2017.09.22 system 함수 : cls. pause

    *system 함수 : cls, pause - system 명령어는 stdlib.h / stdio.h / windows.h 등의 헤더를 인쿨르드해야 함. 1) cls : cmd 창 화면을 지우는 명령어. (Unix/LINUX의 clear 명령어). 2) pause : '계속하려면 아무 키나 누르십시오...'라는 문장 출력. (프로그램 정지) 1 2 3 4 5 6 7 #include int main() { system("pause"); // 화면 정지 system("cls"); // cmd의 화면을 지움 } cs

  13. 2017.09.21 배열 요소 정리 : 배열에 담긴 수를 분류하고, 그 개수를 각각 출력하기

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 #include #define NUM 10 using namespace std; int main() { int tmp, mark = 0, count = 1; int ary[NUM]; int a[NUM], b[NUM]; cout

  14. 2017.09.14 배열 내에서 같은 수의 개수 찾기 (Finding the number of the same number in an array)

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include int main() { int count = 0, input = 0; int ary[10] = {0, 1, 2, 3, 4, 4, 3, 2, 5, 6}; printf("Input a number : "); scanf("%d", &input); for(int i = 0; i

  15. 2017.09.12 Hard Link & Soft Link

    sys1798@linux:~$ clear sys1798@linux:~$ ls -l total 44 drwxrwxr-x 3 sys1798 sys1798 4096 Sep 12 12:57 C drwxrwxr-x 2 sys1798 sys1798 4096 Sep 12 12:56 cd drwxrwxr-x 2 sys1798 sys1798 4096 Sep 7 15:13 dir -rw-r--r-- 1 sys1798 sys1798 8445 Aug 31 15:36 examples.desktop -rw-rw-r-- 1 sys1798 sys1798 13 Sep 7 16:38 ln.txt drwxrwxr-x 4 sys1798 sys1798 4096 Sep 12 12:52 test drwxrwxr-x 2 sys1798 sys179..

  16. 2017.09.05 달력 규칙

    1. 1주일이 7일이므로 같은 요일이 7일마다 반복됨. 이 원리를 알게 되면 1년 뒤 요일도 계산할 수 있음. 예) 오늘이 1월 6일 금요일이면, 다음 금요일은 6+7=13일, 그 다음 금요일은 6+7+7=20일. 2. 서로 이웃하는 4개의 날짜를 살펴보면, 대각선 방향에 놓인 두 수의 합이 같음. 3. 달력의 아무 곳에나 위치를 정해 3X3의 사각형을 그린 후 9개 숫자의 합은 사각형의 한 가운데 있는 수에 9를 곱한 것과 같음.

  17. 2017.09.02 C++ Character Literals

    C++ Character Literals Value Escape sequence newline \n horizontal tab \t vertical tab \v backspace \b carriage return \r form feed \f alert \a backslash \\ question mark ? or \? single quote \' double quote \" the null character \0 octal \ooo hexadecimal \xhhh Unicode (UTF-8) \uxxxx Unicode (UTF-16) \Uxxxxxxxx Resource from : https://msdn.microsoft.com/en-us/library/6aw8xdf2.aspx

  18. 2017.09.01 실행 시간 측정 (clock() 이용)

    1 2 3 4 5 6 7 8 9 10 11 12 13 #include void main() { double start, finish, duration; start = clock(); // 시작 시간 Algorithm(); // 측정하려는 알고리즘 finish = clock(); // 종료 시간 // duration에 시간 저장 duration = ((double)(finish - start)/CLOCKS_PER_SEC); } Colored by Color Scripter cs More Information : http://www.cplusplus.com/reference/ctime/clock/

  19. 2017.09.01 [Web] cplusplus

    cplusplus . http://www.cplusplus.com/ This site has lots of information about C++. (Information, Tutorials, Reference, Articles and Forum) I use this site to refer to C/C++ references.

  20. 2017.09.01 goto문

    *goto문 - 기존 어셈블리 코드에서 사용하는 기능을 상위 프로그래밍 언어에 접목시키는 과정에서 생겨난 기능. - 무조건 원하는 레이블로 건너뛰는 기능을 함. - 형식 문장A; goto Label1; 문장B; ... Label1: 문장C; -> 문장A를 실행한 후에 바로 문장C를 수행. (문장 B는 실행 되지 않음.) - 코드 예시 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #include int main() { int i, j; i = j = 0; printf("goto문의 테스트입니다."); do { printf("do-while문의 %d번째 반복입니다. \n", i); for(j = 0; j

  21. 2017.08.31 scanf와 ' '(공백)

    I wonder why scanf wants to get one more than the number of 'num' when I use this function for array index with infinite loop. 5 // The number of the index of an array. 1 2 3 4 5 // I put 5 numbers because I set the number of the index as 5. but.. 6 // I had to put another number to finish the work of scanf. 1 2 3 4 5 // The numbers in the array. 6 has disappeared. Here is a code that I made to ..

  22. 2017.08.29 최대공약수 (The Greatest Common Denominator(GCD)), 최소공배수(The Least(Lowest) Common Multiple(LCM))

    *최대공약수 (The Greatest Common Denominator(GCD)), 최소공배수(The Least(Lowest) Common Multiple(LCM)) # Algorithm 1 : 간단한 방법(Simple Way)을 이용한 최대공약수(GCD) 구하기 1 2 3 4 5 6 int min(int a, int b) { if (a > b) return b; else if (a =1; g--) if ((m % g == 0) && (n % g == 0)) return g; } Colored by Color Scripter cs # Algorithm 2 : 유클리드 호제법(Euclidean Algorithm)을 이용한 최대공약수(GCD) 구하기 1 2 3 4 5 6 7 8 9 10 11 12 13 14..

  23. 2017.08.29 알고리즘이란?

    *알고리즘이란? - 알고리즘(algorithm) : 주어진 문제를 해결하는 절차(procedure) - 각 단계는 기본적인 연산(operation) 하나로 이루어져 있을 수도 있고, 혹은 다른 부분 문제(subproblem)에 대한 알고리즘일 수는 있찌만 충분히 구체적이어야 함. - 일반적으로 알고리즘은 다음의 두 조건을 반드시 만족해야 함. 종료(termination) : 모든 가능한 입력 사례에 대하여 반드시 끝난다. 정확성(correctness) : 모든 가능한 입력 사례에 대하여 옳은 답을 출력한다. - 가능한 입력에 대하여 항상 종료하고 옳은 답을 출력하면 알고리즘이 되지만, 실행시간이 빠르고 또한 메모리를 적게 쓰는 알고리즘을 선호하게 됨. - 다시 말하면 자원(resource)을 적게 쓰는 ..

  24. 2017.08.29 C/C++ Language and Standard Libraries (Visual Studio 2015)

    This section of the documentation includes guidelines and reference content for the Microsoft implementation of the ISO standards for C and C++. Title Description Welcome Back to C++ Describes modern C++ programming idioms and best practices. C/C++ Languages Reference content for the C and C++ languages. C Run-Time Library Reference Reference content for the Microsoft implementation of the C run..

  25. 2017.08.15 [1Z0-851E] Question 21~30

    QUESTION 21 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 22 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 23 Select and Place: Correct Answer: Section: (none) Explanation Explanation/Reference: QUESTION 24 Place the correct description of the compiler output on the code fragments to be inserted at lines 4 ..

  26. 2017.08.15 [1Z0-851E] Question 11~20

    QUESTION 11 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 12 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 13 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 14 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: QUESTION 15 Select and..

  27. 2017.08.15 [1Z0-851E] Question 01~10

    QUESTION 1 Select and Place: Correct Answer: Section: All Explanation Explanation/Reference: package alpha; public class Alpha { protected String alpha; public Alpha() { this("A"); } protected Alpha(String a) { alpha = a;} } package beta; public class Beta extends alpha.Alpha { public Beta(String a) { super(a); } } QUESTION 2 Place the Relations on their corresponding Implementation Structures. ..

  28. 2017.08.13 [Textbook] Common Lisp: A Gentle Introduction to Symbolic Computation

    Common Lisp: A Gentle Introduction to Symbolic Computation David S. Touretzky This book, with minor revisions, is back in print from Dover Publications and can be purchased in paperback form at Amazon.com, Barnes& Noble, etc. An e-book version will be released in late February, 2013. Free software accompanying the book is also available. This 1990 edition may be distributed in hardcopy form, for..

  29. 2017.08.13 [1Z0-851D] Question 41~50

    QUESTION 41 Given: 1. public class Venus { 2. public static void main(String[] args) { 3. int[] x = { 1, 2, 3 }; 4. int y[] = { 4, 5, 6 }; 5. new Venus().go(x, y); 6. } 7. 8. void go(int[]... z) { 9. for (int[] a : z) 10. System.out.print(a[0]); 11. } 12. } What is the result? A. 1 B. 12 C. 14 D. 123 E. Compilation fails. F. An exception is thrown at runtime. Correct Answer: C Section: All Expla..

  30. 2017.08.13 [1Z0-851D] Question 31~40

    QUESTION 31 Click the Exhibit button. 1. import java.util.*; 2. public class TestSet{ 3. enum Example {ONE, TWO, THREE } 4. public static void main(String[] args) { 5. Collection coll = new ArrayList(); 6. coll.add(Example.THREE); 7. coll.add(Example.THREE); 8. coll.add(Example.THREE); 9. coll.add(Example.TWO); 10. coll.add(Example.TWO); 11. coll.add(Example.ONE); 12. Set set = new HashSet(coll)..

728x90


📖 Contents 📖