일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 플로이드-워셜
- 다이나믹프로그래밍
- 서브쿼리
- BFS
- 시뮬레이션
- DP
- 분할정복
- 자료구조
- 그래프 탐색
- 다익스트라
- 트리
- 수학
- 재귀
- 누적합
- MST
- 투포인터
- 에라토스테네스의 체
- DFS
- 다시
- join
- 구현
- 브루트포스
- GROUP BY
- 그래프 이론
- 다이나믹 프로그래밍
- 백트래킹
- 해시
- 그리디
- 크루스칼
- 우선순위큐
- Today
- Total
목록전공/C (20)
기록하고 까먹지 말기

#include int main(){ // declaring variables for program int n, i, search=0; printf("Enter size of array : "); scanf("%d", &n); // entering size of array if(n 10){ //checking whether entered size of array in in required range printf("%d is an invalid value.", n); // if not, end program return 0; } // declaring array based on entered size int arr[n]; int* ptr = arr; // pointing array printf("Enter..
#include #include #include // declaring structure struct person{ int id; char name[10]; double point; }; int cnt=0; // global variable for total structures struct person add(){ // function add returning struct person after entering elements struct person temp; printf("Enter ID : "); scanf("%d", &temp.id); printf("Enter Name: "); scanf("%s", temp.name); printf("Enter Reward_point: "); scanf("%lf"..
버스 예약 프로그램을 만드는 과제였다. 개인적으로 이런 작은 프로젝트성 과제는 예전에 수강할때 해 보아서 ptsd가 왔지만 조금은 성장했으리라 생각했기 때문에 과제가 나온 당일날 곧바로 부딫혔다. 문제를 보니까 단순 알고리즘뿐만 아니라 파일 스트림까지 활용하여 문제를 해결해야 하는 것이었다. 그래서 파일 스트림을 활용하기 위해 구글이랑 열혈 c프로그래밍을 꽤나 많이 봤던 것 같았다. #include #include #include void registration(); void login(); void reservation(); void back(); void quit(); // structure as a person(customer) struct person{ char first[20]; char las..

#include #include #include // creating structure typedef struct Student{ char name[20]; int id; double salary; }; int main(){ struct Student s; // declaring structure // initializing structure's contents strcpy(s.name, "Henry"); s.id = 1112; s.salary = 95743; // printing output printf("Name: %s\n", s.name); printf("Id: %d\n", s.id); printf("Salary: %f", s.salary); return 0; } #include #include #..

#include #include int main(){ int n, i= 0; // declaring variables int smallest ; // smallest float printf("Enter the total number of elements: "); scanf("%d", &n); // enter size of inputs int* ptr = (int*)malloc(n*sizeof(int)); // declaring array with memory allocation for(i=0; i *(ptr+i)) smallest = *(ptr+i); } // printing output printf("Smallest element is %d", smallest); free(ptr); // erasing..

동적할당을 통해 일정 값을 입력받고 입력받은 수 중에서 최댓값을 출력하는 프로그램이다. #include #include int main(){ int n, i= 0; // declaring variables float largest ; // largest float printf("Enter the total number of elements: "); scanf("%d", &n); // enter size of inputs float* ptr = (float*)malloc(n*sizeof(int)); // declaring array with memory allocation for(i=0; i

string의 배열을 반대로 만들어 출력하는 문제다. #include #define MAX_SIZE 100 // maximum size of array int main(){ char str[MAX_SIZE], reverse[MAX_SIZE]; char *s = str; char *t = reverse; int len = 0; printf("Enter any string: "); gets(str); int i = 0; while(s[len] != 0) len++; // getting length of entered string // setting reversed string for(i=0; i