|
#include <stdio.h>
int main()
{
int x,y,z,i;
scanf("%d %d %d",&x,&y,&z);
int stred(int a, int b, int c)
{
int n;
if((b>a && a>c)||(c>a && a>b)) n=1;
if((a>b && b>c)||(c>b && b>a)) n=2;
if((a>c && c>b)||(b>c && c>a)) n=3;
return n;
}
i=stred(x,y,z);
switch(i){
case 1:printf("Prostredni je bod A.");break;
case 2:printf("Prostredni je bod B.");break;
case 3:printf("Prostredni je bod C.");break;
}
return 0;
}
V téhle podobě to funguje, prohnal jsem to přes gcc. Tady máš výpis:
EXECUTING:
/home/jenicek/foobar-sample/Debug/foobar_sample
----------------------------------------------
2
1
4
Prostredni je bod A.
----------------------------------------------
Program exited successfully with errcode (0)
Press the Enter key to close this terminal ...
|