Click here to Skip to main content
15,890,186 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can Terminate AfxbeginThread ? Pin
Le@rner12-Jan-11 23:13
Le@rner12-Jan-11 23:13 
GeneralRe: How can Terminate AfxbeginThread ? Pin
Andrew Brock13-Jan-11 0:11
Andrew Brock13-Jan-11 0:11 
GeneralRe: How can Terminate AfxbeginThread ? Pin
Le@rner12-Jan-11 23:42
Le@rner12-Jan-11 23:42 
GeneralRe: How can Terminate AfxbeginThread ? Pin
Andrew Brock12-Jan-11 23:56
Andrew Brock12-Jan-11 23:56 
GeneralRe: How can Terminate AfxbeginThread ? Pin
Le@rner12-Jan-11 23:59
Le@rner12-Jan-11 23:59 
AnswerRe: How can Terminate AfxbeginThread ? Pin
Prasann Mayekar12-Jan-11 18:59
Prasann Mayekar12-Jan-11 18:59 
AnswerRe: How can Terminate AfxbeginThread ? Pin
Cedric Moonen12-Jan-11 20:49
Cedric Moonen12-Jan-11 20:49 
QuestionWhile Statement Issue. Pin
Mike Certini12-Jan-11 17:53
Mike Certini12-Jan-11 17:53 
In the below code I have put together a text example of a shopping cart whereby the user selects a commodity to purchase and based upon a menu selection, tells the program which leg in my switch statement to execute. After a selection is made, the program drops out of the switch statement and proceeds the the bottom of the while statement where "ordercom" tells the while statement to continue taking orders. This is obviously an un-ending loop but is coded this way to trouble shoot the issue at hand. I am testing the code with code breaks. What is happening is that after I select two menu selections or two loops of the while statement the program skips over the scanf statement.
Can someone help me with this issue?

#include <stdio.h>
#define Artichoke 1.25
#define Beets .65
#define Carrots .89
#define Discount .05
#define Shipping1 10.00
#define Shipping2 8.00

int main(void)
	{
	char ordercom;
	char type;
	float pounds;
	float gross;
	float poundTot = 0;
	ordercom = 'Y';
	while(ordercom == 'Y')
		{
		printf("*******************************************************************************************************************\n");
		printf("Determine What You Want To Buy\n");
		printf("1) (a)\t	Artichokes\t		3) (c)\t   Carrots\n");
		printf("2) (b)\t	Beets\t				4) (q)\t   Quit\n");
		printf("*******************************************************************************************************************\n");
		printf("\n");
		printf("Select The Type Of Vegetable You Want And The Pounds Of The Vegetable You Want Or (q) To Quit :");
		scanf("%c ""%f",&type,&pounds);
		
		switch(type)
			{
			case 'a' :
				{
				gross = pounds * Artichoke;
				break;
				}
			case 'b' :
				{
				gross = pounds * Beets;
				break;
				}
			case 'c' :
				{
				gross = pounds * Carrots;
				break;
				}
			case 'q' :
				{
				break;
				}
			default  :
				{
				break;
				}
			}
		ordercom = 'Y';
		}
	
	}

AnswerRe: While Statement Issue. Pin
David Crow12-Jan-11 17:57
David Crow12-Jan-11 17:57 
GeneralRe: While Statement Issue. Pin
Andrew Brock12-Jan-11 18:06
Andrew Brock12-Jan-11 18:06 
GeneralRe: While Statement Issue. Pin
Mike Certini12-Jan-11 18:23
Mike Certini12-Jan-11 18:23 
GeneralRe: While Statement Issue. Pin
Andrew Brock12-Jan-11 18:35
Andrew Brock12-Jan-11 18:35 
GeneralRe: While Statement Issue. Pin
Mike Certini12-Jan-11 18:48
Mike Certini12-Jan-11 18:48 
GeneralRe: While Statement Issue. Pin
Malli_S12-Jan-11 19:02
Malli_S12-Jan-11 19:02 
GeneralCorrected Version. Pin
Mike Certini12-Jan-11 19:27
Mike Certini12-Jan-11 19:27 
GeneralRe: Corrected Version. Pin
Andrew Brock12-Jan-11 19:34
Andrew Brock12-Jan-11 19:34 
GeneralRe: Corrected Version. Pin
Andrew Brock12-Jan-11 19:37
Andrew Brock12-Jan-11 19:37 
GeneralRe: While Statement Issue. Pin
Andrew Brock12-Jan-11 19:31
Andrew Brock12-Jan-11 19:31 
AnswerRe: While Statement Issue. Pin
Luc Pattyn12-Jan-11 18:05
sitebuilderLuc Pattyn12-Jan-11 18:05 
GeneralRe: While Statement Issue. Pin
Mike Certini12-Jan-11 18:17
Mike Certini12-Jan-11 18:17 
QuestionDisabling popup menu item Pin
David Crow12-Jan-11 8:01
David Crow12-Jan-11 8:01 
AnswerRe: Disabling popup menu item PinPopular
User 742933812-Jan-11 8:29
professionalUser 742933812-Jan-11 8:29 
GeneralRe: Disabling popup menu item [SOLVED] Pin
David Crow12-Jan-11 8:54
David Crow12-Jan-11 8:54 
AnswerRe: Disabling popup menu item Pin
Niklas L12-Jan-11 21:18
Niklas L12-Jan-11 21:18 
QuestionRe: Disabling popup menu item Pin
David Crow14-Jan-11 3:20
David Crow14-Jan-11 3:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.