정수 값 x, y, z를 감소하지 않는 순서로 출력하는 C++ 프로그램을 작성하라.
#include<iostream>
using namespace std;
void prtSort(int x, int y, int z)
{
if(x > y)
swap(x, y);
if(x > z)
swap(x, z);
if(y > z)
swap(y, z);
cout<<x<<" "<<y<<" "<<z<<endl;
}
void main(void)
{
int x=3, y=2, z=1;
prtSort(x, y, z);
}
아악 문제 왤케 많아 ㅋㅋ;;



덧글