Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void sort(int* ,int*, int*);
- void swap(int* ,int*);
- int main()
- {
- int min,mid,max;
- printf("Please enter three numbers to sort:");
- scanf("%d%d%d",&min,&mid,&max);
- sort(&min,&mid,&max);
- printf("sorted : %d %d %d\n",min,mid,max);
- }
- void swap(int* a, int* b)
- {
- int tmp = *a;
- *a = *b;
- *b = tmp;
- }
- void sort(int* pmin, int* pmid ,int* pmax)
- {
- if(*pmin > *pmid)///?אני יכול כבר בשלב הזה להוריד את הכוכביות?
- swap(pmin,pmid);
- if(*pmid > *pmax)
- swap(pmid,pmax);
- if(*pmin > *pmid)
- swap(pmin,pmid);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement