¶
#.20105801
1~5.www.koistudy.net 100~104 Accept( 한테 )
-#include<stdio.h>
int main()
{
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d",a+b);
return 0;scanf("%d %d",&a,&b);
printf("%d",a+b);
}
-#include<stdio.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d %d",a/b,a%b);
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d %d",a/b,a%b);
return 0;
}
-#include<stdio.h>
int main()
{
double a,b;
scanf("%lf %lf",&a,&b);
printf("%g ",a*b/2);
{
double a,b;
scanf("%lf %lf",&a,&b);
printf("%g ",a*b/2);
return 0;
}
-#include<stdio.h>
-#include<stdio.h>
int main()
{
float r,c;
{
float r,c;
scanf("%f ",&r);
c=(float)r/2;
printf("%.2f ",c*c*3.14);
c=(float)r/2;
printf("%.2f ",c*c*3.14);
return 0;
}
-#include<stdio.h>
int main()
{
float n1,n2,n3;
{
float n1,n2,n3;
scanf("%f %f %f",&n1,&n2,&n3);
printf("%.3f ",(float)(n1+n2+n3)/3);
printf("%.3f ",(float)(n1+n2+n3)/3);
return 0;
}
6.포 해 함 swap ( . 해해 )
-#include<stdio.h>
void swap(int *a,int *b);
int main()
{
int main()
{
char x='A',y='B';
printf("x= %c y=%c\n",x,y);swap(&x,&y);
printf("x=%c ,y=%c\n",x,y);
return 0;
printf("x=%c ,y=%c\n",x,y);
return 0;
}
void swap(int *a,int *b)
{
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;temp=*a;
*b=temp;
}
7.2 (4x4) 하 .
2X2행 해
#include<stdio.h>
printf("행 \n");
for(j=0;j<2;j++){
}
for(p=0;b<2;p++){
if(j==0 && p==0){
}else if(j==0&& p==1){
}else if(j==1&&p==0){
}else{
}
cjp=q*w+e*r;
printf("%d",cjp);
}
printf("\n");if(j==0 && p==0){
}else if(j==0&& p==1){
}else if(j==1&&p==0){
}else{
}
cjp=q*w+e*r;
printf("%d",cjp);
}
}
return 0;
}
}
8. 형태 .
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25
#include<stdio.h>
int main()
{
int a[]5={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};
int c55;
int j,p;
int main()
{
int a[]5={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};
int c55;
int j,p;
for(j=0;j<5;j++){
for(p=0;p<5;p++){
for(p=0;p<5;p++){
}
printf("\n");
j++;
}
printf("\n");
j++;
}
return 0;
}
}
9.포 한 하 .
#include<stdio.h>
int main()
{
int main()
{
int num=2;
int *a;
a=#
printf("%d\n",*a);
return 0;
}int *a;
a=#
printf("%d\n",*a);
return 0;
//'0' .
10.LinearSearch 해. 1000 , random함 해 1 1000 , 777 . 행킬 ?
(rand()%1000 한 1 1000 .)
-linear search 트 하 하 형탐 한.
해 합
#include<stdio..h>
int Lsearch(int ar[], int len, int targer)
{
int i;
for(i=0;i
int Lsearch(int ar[], int len, int targer)
{
int i;
for(i=0;i
return -1;
}
int main(){
int arr[]={3,5,2,4,9};
int idx;
idx=Lsearch(arr,sizeof(arr)/sizeof(int),4);
int idx;
idx=Lsearch(arr,sizeof(arr)/sizeof(int),4);
if(idx== -1)
printf("search fail\n");
else
printf("%d\n",idx);
idx = Lsearch(arr,sizeof(arr)/sizeof(int),7);
printf("search fail\n");
else
printf("%d\n",idx);
idx = Lsearch(arr,sizeof(arr)/sizeof(int),7);
if(idx ==-1)
printf("search fail\n");
else
printf("%d\n",idx);
return 0;
printf("search fail\n");
else
printf("%d\n",idx);
return 0;
}
11.Sort 하 해. 11 , 하, 하 .
- u.u
- u.u
12. 탕, int* a; int b; 했 &a,a,*a,&b,b 해 하, 하 해할 해.( 한 테트해 .)
- *a b 키 포 , &a a , a (, b -포 ), &b b , b (할한 ),a=&b . b .*a=b b 할한 .
#include<stdio.h>
struct Student
{
{
int id;
int age;
char *name;
int age;
char *name;
};
int main()
{
struct Student stu;
{
struct Student stu;
stu.id =1001;
stu.age=10;
stu.name ="kim so ri";
stu.age=10;
stu.name ="kim so ri";
printf("id : %d\n",stu.id);
printf("age : %d\n",stu.age);
printf("name : %s\n",stu.name);
printf("age : %d\n",stu.age);
printf("name : %s\n",stu.name);
return 0;
}
}
2.할 , 할 하 .
-할 malloc 해.....
molloc 함 하 활 하 크 할하 활.
하 크, ..
molloc 함 하 활 하 크 할하 활.
하 크, ..
하 =
포 = (포 형 )malloc(하 크);
포 = (포 형 )malloc(하 크);
ex..
arr = (int *)malloc(sizeof(int)*nSize); // malloc nSize int 형
malloc 한 free 호해 할하 한. 할 할 .
3.포 , 포 해 2 형태 .
- 포 키 포 포 한.
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
void main()
{
{
int **ptr;
int i,j,k=1;
//int ptr22;
ptr = (int **)malloc(2*sizeof(int *));
for(i=0;i<2;i++)
for(i=0;i<2;i++)
{
}
}int i,j,k=1;
//int ptr22;
ptr = (int **)malloc(2*sizeof(int *));
for(i=0;i<2;i++)
ptri = (int *)malloc(2*sizeof(int));
for(i=0;i<2;i++)
{
}
//히 해 ㅜ
4.택, 큐 하, 한 한 .
-택 , 큐 .
int sp=0;
int push(int);
int pop(int *);
int push(int);
int pop(int *);
int main(){
int n=0;
push(10);
push(20);
push(30);
if (push(40) == -1)
{
push(10);
push(20);
push(30);
if (push(40) == -1)
{
printf("Stack Overflow\n");
}
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
printf("pop : %d\n",n);
pop(&n);
printf("pop : %d\n",n);
printf("pop : %d\n",n);
if(pop(&n) == -1)
{
printf("Stack Underflow\n");
{
printf("Stack Underflow\n");
}
return 0;
}
return 0;
}
}else
{
{
return -1; // overflow
}}
}else
{
return -1; // . underflow
{
return -1; // . underflow
}
}
}
// pop 할 30 .
-큐
#include<stdio.h>
#include<conio.h>
#define MAX 5
#include<stdio.h>
#include<conio.h>
#define MAX 5
void Delete()
{
{
if(rear < 0 )
--rear;
}printf(" 큐 ");
else --rear;
void main()
{
{
int insert_num;
int i,j;
for(i=0; i<5; i++)
{
for(j=0; j
for(j = front ; j < 5; j++){ //엔터를 한번씩 누르면 값이 차례대로 빠짐
}
}int i,j;
for(i=0; i<5; i++)
{
printf(" 하");
scanf("%d", &insert_num);
insert(insert_num);
}scanf("%d", &insert_num);
insert(insert_num);
for(j=0; j
printf("%d " ,queuej); printf("\n");
}for(j = front ; j < 5; j++){ //엔터를 한번씩 누르면 값이 차례대로 빠짐
}
희 ¶
1~5.www.koistudy.net 100~104 Accept( 한테 )
6.포 해 함 swap ( . 해해 )
-06.c
-06.c
7.2 (4x4) 하 .
-07.c
-07.c
8. 형태 .
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25
- 하 for 하 ㅜ,ㅜ
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25
- 하 for 하 ㅜ,ㅜ
9.포 한 하 .
-09.c
-09.c
11.Sort 하 해. 11 , 하, 하 .
-11.c
-11.c
12. 탕, int* a; int b; 했 &a,a,*a,&b,b 해 하, 하 해할 해.( 한 테트해 .)
하 형 하 .
a_01.c
int* a;
int b=10;
a=&b;
printf("%d\n",&a); //포 a
printf("%d\n",a); //a 키
printf("%d\n",&b); //b
printf("%d\n",b); //b
1. , 한 하 .int b=10;
a=&b;
printf("%d\n",&a); //포 a
printf("%d\n",a); //a 키
printf("%d\n",&b); //b
printf("%d\n",b); //b
하 형 하 .
a_01.c
2.할 , 할 하 .
힙 할하 할 한.
행 할해 하 크 .
-a_02.c
-> 해 ㅠ.ㅠ
힙 할하 할 한.
행 할해 하 크 .
-a_02.c
-> 해 ㅠ.ㅠ
3.포 , 포 해 2 형태 .
포 포 하 한 포.
a_03.c
포 포 하 한 포.
a_03.c
4.택, 큐 하, 한 한 .
택 / 한 할 . .
큐 FIFO. 택 .
->( !ㅜ.ㅜ)
택 / 한 할 . .
큐 FIFO. 택 .
->( !ㅜ.ㅜ)
한 ¶
1 100)
#include<stdio.h>
int main(){
#include<stdio.h>
int main(){
int a,b;
scanf("%d",&a);
scanf("%d",&b);
printf("%d",a+b);
return 0;
}scanf("%d",&a);
scanf("%d",&b);
printf("%d",a+b);
return 0;
2 101)
#include <stdio.h>
#include <stdio.h>
int main()
{
{
int a,b,c,d;
scanf("%d %d",&a,&b);
c=a/b;
d=a%b;
printf("%d %d",c,d);
return 0;
}scanf("%d %d",&a,&b);
c=a/b;
d=a%b;
printf("%d %d",c,d);
return 0;
3 102)
#include <stdio.h>
#include <stdio.h>
int main()
{
{
int u,h;
double s;
scanf("%d %d", &u,&h);
s = (u*h)/2.0;
return 0;
}double s;
scanf("%d %d", &u,&h);
s = (u*h)/2.0;
printf("%g",s);
return 0;
4 103)
#include <stdio.h>
#include <stdio.h>
int main()
{
{
int R;
double s,r ;
scanf("%d", &R);
r=R/2.0;
s = 3.14*r*r;
return 0;
}double s,r ;
scanf("%d", &R);
r=R/2.0;
s = 3.14*r*r;
printf("%.2lf",s);
return 0;
5 104)
#include <stdio.h>
#include <stdio.h>
int main()
{
{
int a,b,c;
double ave ;
scanf("%d %d %d", &a, &b, &c);
return 0;
}double ave ;
scanf("%d %d %d", &a, &b, &c);
ave = (float)(a + b + c) / 3.0;
printf("%.3lf",ave); return 0;
6 105)
#include<stdio.h>
int main(){
#include<stdio.h>
int main(){
double a,b,c,d;
scanf("%lf",&a);
scanf("%lf",&b);
scanf("%lf",&c);
d=-(b/a);
printf("%g",d);
return 0;
}scanf("%lf",&a);
scanf("%lf",&b);
scanf("%lf",&c);
d=-(b/a);
printf("%g",d);
return 0;
7.포 해 함 swap ( . 해해 )
#include <stdio.h>
void point(int *pval1 , int *pval2)
{
{
int temp;
temp = *pval1;
temp = *pval1;
- pval1=*pval2;
- pval2= temp;
void main()
{
{
int val1;
int val2;
val1=10;
val2=20;
printf("%d %d \n" , val1, val2);
point(&val1, &val2);
printf("%d %d \n" , val1, val2);
} int val2;
val2=20;
printf("%d %d \n" , val1, val2);
point(&val1, &val2);
printf("%d %d \n" , val1, val2);
#include <stdio.h>
int main()
{
int a44,b44,c44,d44={0},i,j,k,l;
printf("öe¡© a O¤A : ");
for(i=0; i<4; i++) //a배öe열¯¡© 입O력¤A
{
}
printf("öe¡© b O¤A : ");
for(i=0; i<4; i++) //b배öe열¯¡© 입O력¤A
{
}
for(i=0; i<4; i++)
{
for(i=0; i<4; i++)
{
}
return 0;
}printf("öe¡© a O¤A : ");
for(i=0; i<4; i++) //a배öe열¯¡© 입O력¤A
{
}
printf("öe¡© b O¤A : ");
for(i=0; i<4; i++) //b배öe열¯¡© 입O력¤A
{
}
for(i=0; i<4; i++)
{
for(j=0; j<4; j++)
{
}
}{
for(k=0; k<4; k++)
{
{ {
for(k=0; k<4; l++)
}
}
}for(i=0; i<4; i++)
{
}
return 0;
9. 형태 .
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25
#include <stdio.h>
int main()
{
int main()
{
return 0;
}#include<stdio.h>
int main(){
char ch;
char *p;
char *q;
ch = 'A';
p = &ch;
q = p;
char *p;
char *q;
ch = 'A';
p = &ch;
q = p;
- p = 'Z';
printf("chÆ¢® Æ¢®oÆi O¥A ƨ£ : ch=> %c\n",ch);
11.LinearSearch 해. 1000 , random함 해 1 1000 , 777 . 행킬 ?
(rand()%1000 한 1 1000 .)
12.Sort 하 해. 11 , 하, 하 .
13. 탕, int* a; int b; 했 &a,a,*a,&b,b 해 하, 하 해할 해.( 한 테트해 .)
&a : a
*a : a 키 , a
&b : b
*b : b 키 , b
&a : a
*a : a 키 , a
&b : b
*b : b 키 , b
*a = b
*b = a
1.4.1.2 ¶
1. , 한 하 .
: 하 한 형 합
#include<stdio.h>
int main(){
printf("I¬¡× : %s\n",s.name);
printf("ø¨£I : %d\n",s.age);
*b = a
1. , 한 하 .
: 하 한 형 합
#include<stdio.h>
int main(){
printf("I¬¡× : %s\n",s.name);
printf("ø¨£I : %d\n",s.age);
return 0;
}
2.할 , 할 하 .
할 하 : 하 해
할 malloc함, 함 하 해 "stdlib.h"헤파 포함해 한
포 = (포 형 )malloc(하 크);
}
2.할 , 할 하 .
할 하 : 하 해
할 malloc함, 함 하 해 "stdlib.h"헤파 포함해 한
포 = (포 형 )malloc(하 크);
3.포 , 포 해 2 형태 .
포 : 포 키 포
포
: 포형 트 ( ) 해 !
택 : 하 할
큐(Queue) : 한 형태 한 형태 합. (rear) (front) 합. 할 큐 합.
포 : 포 키 포
포
: 포형 트 ( ) 해 !
( 하 )
포 Int **p;
4.택, 큐 하, 한 한 .택 : 하 할
큐(Queue) : 한 형태 한 형태 합. (rear) (front) 합. 할 큐 합.
황혜 ¶
12. 탕, int* a; int b; 했 &a,a,*a,&b,b 해 하, 하 해할 해.( 한 테트해 .)
a : a
&a : a
*a : a 키
&b : b
b : b
a : a
&a : a
*a : a 키
&b : b
b : b
1.4.1.2
1. , 한 하 .
- 하 하 합
struct Student
{
int id;
int age;
char* name;
};
2.할 , 할 하 .
- 한 할 해 함.
int* pTmp=malloc(100);
int* pTmp=(int*)malloc(100);
3.포 , 포 해 2 형태 .
- 포 키 포
- 하 하 합
struct Student
{
int id;
int age;
char* name;
};
2.할 , 할 하 .
- 한 할 해 함.
int* pTmp=malloc(100);
int* pTmp=(int*)malloc(100);
3.포 , 포 해 2 형태 .
- 포 키 포
4.택, 큐 하, 한 한 .
택 : LIFO()
큐 : FIFO()
택 : LIFO()
큐 : FIFO()