Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- //why line 47 get duplicated? how to fix it?
- int main()
- {
- char ch;
- float a,b,c,temp;//
- a = b = c = temp = 0.0;
- printf("artishoks a\t\nbeetroot b\t");
- printf("carrots c\t\nquit q\n");
- scanf("%c",&ch);
- //scanf("%*[\n]");
- while( ch!='q' )
- {
- switch(ch)
- {
- case 'a':
- {
- printf("How much of artishoks do you want?\n");
- scanf("%f",&temp);
- a+=temp;
- }
- break;
- case 'b':
- {
- printf("How much of beetroot do you want?\n");
- scanf("%f",&temp);
- b+=temp;
- }
- break;
- case 'c':
- {
- printf("How much of carrots do you want?\n");
- scanf("%f",&temp);
- c+=temp;
- }
- break;
- }//end of switch
- printf("chose a,b,c,or q now\n");
- scanf("%c",&ch);
- }//end of while
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement