본문 바로가기
반응형

학부공부/C_Basic13

2. Project_64 PuyoPuyo[C Basic] 2.1. Environment • Windows 10 • Visual Studio 2017 • Programming language: C (C++ will not be allowed.) 2.2. Project • Write a program “64 PuyoPuyo” • 64 PuyoPuyo is a block-matching puzzle game • Each block consists of a number and a binary arithmetic operator (addition or difference) • Merge two numbers with one operator • When it reaches 64, the block vanishes and user earns points • Goal of .. 2021. 11. 7.
1. Project_KU Mobile Phone Bill Calculator[C Basic] 1.1. Environment • OS: Windows 10 • IDE: Visual Studio 2017 • Language: C (‘C’ only. If use any of ‘C++’, will get 0 point.) 1.2. KU Mobile Phone Bill Calculator • Your program should display the main menu providing following functions. ①Display plans ②Usage information for past two months ③Input this month usage ④Total fee for past 3 months ⑤Best plan recommendation ⑥Exit • A user can execute e.. 2021. 11. 7.
1. Quiz[C Basic] 다음 프로그램을 실행할 경우 출력 결과를 작성하라.(오류가 나면 오류도 함께 작성할 것.) 1.1. #include #define PR(X,Y,Z) printf("X=%d, Y=%d, Z=%d\n", X, Y, Z) int x=1, y=3, z=7; int sum(int *x, int y){ PR(z,*x,y); *x = 4; y = -y; return (*x+y+z); } int main(){ int x=2, z; z=sum(&y, x); PR(x,y,z); z=sum(&x, z); PR(y,z,x); return 0; } 1.2. #include int x = 10; void f( ){ x++; printf("%d, ", x); } void g( ){ static int x = 30; printf(".. 2021. 11. 7.
10. File[C Basic] * fgets exapmle #include int main() { char line[255]; FILE *file=fopen("example_fputs.txt","r"); if(file==NULL){ printf("파일열기 실패\n"); return 1; } while((fgets(line,sizeof(line),file))!=NULL) printf("%s",line); fclose(file); return 0; } * fprintf exapmle #include int main() { int num1=20; int num2=40; FILE *file=fopen("example_fprintf.txt","w"); if(file==NULL){ printf("파일열기 실패\n"); return 1; } fp.. 2021. 11. 7.
9. Struct[C Basic] * 2 char text[MAX][80]; char *temp = NULL; gets(&text[i][0]); for (i = 0;i < MAX;i++) { strcpy(std[i].name, strtok(&strtok(&text[i][], "/"))); atoi()이용하여 stdnum에 저장 } scanf("%s / %d", &korea_university[i].name, &korea_university[i].stdnum); scanf("%s \ %d",,); while (scanf("%c", &korea_university[i].name[j++] != '/')); void bubble(struct *std) { } temp_int = korea_university[j].stdnum; korea_uni.. 2021. 11. 7.
8. Bit operator[C Basic] *1 int func(unsigned int bits){ unsigned int i; unsigned int mask=1 2021. 11. 7.
반응형