목록언어 (17)
Dailelog

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; /* * Recursive FUnction(재귀함수) * * 어떠한 함수 정의 내에서 자기 자신 함수 호출 * ex) * void f() * { * ..... * f(); * ..... * } * * 분할 정복(divide & conquer) 방식의 문제해결기법 * n개의 문제 -> 1개의 문제 + (n-1)개으 ㅣ문제 * n개의 문제 -> n/2개의 문제 + n/2개의 문제 * n개의 문제 -> n/4개의 문제 + n/4개의 문제+ n/4개의 문제 +n/4개의 문제 * * 단점: 속도 느림 / 기억..

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; /* * built-int type 변수 특징 * -의미: 정수를 저장하는 거억장소 * -목적: 셀수 있는 숫자 저장 * 학생수, 지갑의 돈, 자동차 수 소수점 없음 * -상수: 1234. 0x7f12. 0755 * -크기: 4바이트 * -표형양식: 양수경우/음수경우 * -연산자: +-* %(modulo operator) * -주의사항: overflow / truncation * -short(ushort):2 bytes * -long(ulong: 8bytes * * 문자형 변수(character va..

#include #include class GravitySource { sf::Vector2f pos; float strength; sf::CircleShape s; public: GravitySource(float pos_x, float pos_y, float strength) { pos.x = pos_x; pos.y = pos_y; this->strength = strength; s.setPosition(pos); s.setFillColor(sf::Color::Red); s.setRadius(15); //반지름 } void render(sf::RenderWindow& wind) { wind.draw(s); } sf::Vector2f get_pos() { return pos; } float get_st..

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 부산시 { class 동래구 { //visibility(가시성) // 동래구라는 class를 다른 namespace또는 class에서 사용하려면 public을 해주어야 한다. public static string wherAreYou() { return "부산시/동래구/사직동"; } public static int add(int x, int y) { return x + y +100; } } class Program { static int add(int x, int y) { return..

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; // 강의 주제 : C로 작성된 getSum() 함수를 C#으로 만들어 보기 // //자동할당 복습 //namespace : namespace안에는 여러개의 클래스를 포함할수 있다. //class //command line argument: 고급C프로그래밍 - 12-2-2차원 배열 동적 할당 //command line argument 는 argc,argv와 같음 // ex) //main(int argc,char* argv[]) //{ //} // C#에서 함수는 두가지로 나누어진다. //static ..

#include #include using namespace std; const int NAME_LEN = 20; void ShowMenu(); //메뉴출력 void MakeAccount(); //계좌개설을 위한 함수 void DepositMoney(); //입금 void WithdrawMoney(); //출금 void ShowAllAccInfo(); //잔액조회 enum {MAKE = 1, DEPOSIT, WITHDRAW, INQUIRE, EXIT}; typedef struct { int accID; //계좌 번호 int balance; //잔액 char cusName[NAME_LEN]; //고객 이름 }Account; Account accArr[100]; //Account 저장을 위한 배열 int a..

구조체 (structure) 서로 밀접한 연관이 있는 변수들을 모아 놓은 복합 변수 -> 나중에 "객체"라고 지칭함 cf.배열 */ #include struct point { int x; int y; }; void findCenterPoint(struct point *p,struct point q,struct point r) { p->x = (q.x + r.x) / 2; p->y = (q.y + r.y) / 2; } void printPoint(char *name,struct point p) { printf("%s = (%d,%d)\n",name,p.x,p.y); } main() { struct point a; struct point b; struct point c; a.x = 10; a.y = 10; ..

C -> Cpp iostream #include int main() { char name[100]; char lang[200]; std::cout name; std::cout lang; std::cout

#include #include //#define _CRT_SECURE_NO_WARNINGS int getSum(int **x,int row,int col) { int s = 0; int i,j; for(i = 0; i

#include #include main() { int *p; //int p[3]; //원래는 이렇게 자동할당으로 배열을 만들어 주어야 하는데 만들어주지 // 않고 동적할당으로 heap영역에 만들게 됨 int i; p = (int *) malloc(3*sizeof(int));//12byte를 할당해서 저장 장소 3개를 만드는 행위 //동적할당은 사용하는 이유는 배열에서 공간을 예상해서 선언해주는데 그 공간이 정해지지 않을때 //그리고 오버플로우를 방지하기 위해서 //int p[n]; 배열의 크기는 변수로 못함 그래서 sizeof앞에 수를 변수로 처리하면 오버플로우 없이 //저장공간을 그때그때 할당할수 있다. p[0] = 13; p[1] = 72; p[2] = 81; for(i = 0; i