목차
첫 번째 문제
1). 개요
2). input
3). output
4). 본문
5). 실행결과
6). 결론
1). 개요
2). input
3). output
4). 본문
5). 실행결과
6). 결론
본문내용
.내림차순으로 바꾸어 주는 for문에서 13개의 숫자를 두 개씩 바꾸어주니 6번 돌려 주는 것을 생각하지 못해서 애를 먹었었다.
call by reference
#include< iostream.h >
void refer(int* c,int* d);
void main()
{
int a=5,b=3;
cout <<"함수호출전"< cout << "a=" << a << "b=" << b << endl;
refer(&a,&b);
cout << "함수호출후"< cout << "a=" << a << "b=" << b <
}
void refer(int* c,int* d)
{
int k;
k=*c;
*c=*d;
*d=k;
}
call by value
#include
using namespace std;
void swap(int, int)
int mian()
{
int x=20; int y=80; // 실인수
cout << "x=" << x << "y=" << y << endl;
swap(x,y); // 가인수
cout << "x=" << x << "y=" << y << endl;
return 0;
}
void swap(int u, int v)
{
int temp;
temp=u;
u=v;
v=temp;
}
call by name
#include
using namespace std;
int myprintf(void);
int main()
{
myPrint();
return 0;
}
int myPrint(void)
{
printf("이게 함수\n");
return 0;
}
call by reference
#include< iostream.h >
void refer(int* c,int* d);
void main()
{
int a=5,b=3;
cout <<"함수호출전"< cout << "a=" << a << "b=" << b << endl;
refer(&a,&b);
cout << "함수호출후"< cout << "a=" << a << "b=" << b <
void refer(int* c,int* d)
{
int k;
k=*c;
*c=*d;
*d=k;
}
call by value
#include
using namespace std;
void swap(int, int)
int mian()
{
int x=20; int y=80; // 실인수
cout << "x=" << x << "y=" << y << endl;
swap(x,y); // 가인수
cout << "x=" << x << "y=" << y << endl;
return 0;
}
void swap(int u, int v)
{
int temp;
temp=u;
u=v;
v=temp;
}
call by name
#include
using namespace std;
int myprintf(void);
int main()
{
myPrint();
return 0;
}
int myPrint(void)
{
printf("이게 함수\n");
return 0;
}
소개글