General discussion

Locked

Bubble-up sorting program, Part 3 0f 3

By riffael ·
double get_amount()
{
int counter;
char amount[40];
int flag;
char input;

for (counter=0; counter <=40; counter++) amount[counter] = 0;

counter = 0;
flag = 0;

while (input=getch())
{
if ( (input >= '0' && input <= '9') )
{
amount[counter]=input;
printf("%c",input);
counter++;
}
if ( input == '.' )
if (!flag)
{
amount[counter]=input;
printf("%c",input);
counter++;
flag = 1;
}
if (input == 13) break;
if (input ==
{
for (counter=0; counter <=40; counter++) amount[counter] = 0;
counter=0;

printf("\nLost input, please re-enter: ");
}
}
return atof(amount);
}



int get_menu_input(int count)
{
int input;

while (input = getch())
if ( (input >= 65 && input <= 64+count) ||
(input >= 97 && input <= 96+count) )
break;

printf("%c",input);

if (input < 91)
input = input - 65;
else
input = input - 97;

return input;
}
THANK YOU SO MUCH!

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Bubble-up sorting program, Part 3 0f 3

by zchris In reply to Bubble-up sorting program ...
Collapse -

Bubble-up sorting program, Part 3 0f 3

by riffael In reply to Bubble-up sorting program ...

The question was auto-closed by TechRepublic

Collapse -

Bubble-up sorting program, Part 3 0f 3

by Cedric King In reply to Bubble-up sorting program ...

Think it's best if you close this 2 uncomplete question and repost.

Collapse -

Bubble-up sorting program, Part 3 0f 3

by riffael In reply to Bubble-up sorting program ...

The question was auto-closed by TechRepublic

Collapse -

Bubble-up sorting program, Part 3 0f 3

by riffael In reply to Bubble-up sorting program ...

This question was auto closed due to inactivity

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums