I cannot get this program from having a continuous loop. I need to have a user-defined loop, but can't figure it out. Any help would be appreciated. Yes, this is an assignment for my 1st programming class.
Here is what I have so far:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int a,b,c,high,med,low;
printf("This programs sorts numbers from highest to lowest\n");
printf("Enter 3 numbers seperated by a comma or 'Q' to quit\n");
while(scanf("%d,%d,%d", &a,&b,&c) != 'Q')
{
if (a < c && c < b)
{
high = b;
med = c;
low = a;
}
if (c < a && a < b)
{
low = c;
med = a;
high = b;
}
if (b < a && a < c)
{
high = c;
low = b;
med = a;
}
printf("Here are your numbers high to low:%d,%d,%d\n",high,med,low);
printf("Enter 3 numbers or 'Q' to quit:\n");
}
return 0;
}