Thread: Please Help!

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    2

    Unhappy Please Help!

    I'm trying to do an assignment and I keep getting an error on my code that says "line 36: unrecognised types in comparison
    'while ( dep_OR_withdraw != 0 ) { printf("\nEnter deposit (+) or withdrawal (-): ")' aborting compile". This is what I have and I can't figure out what is wrong.

    Code:
    currentBalance = initialBalance;
    dep_OR_withdraw = 1; /*Dummy value used to get the loop started*/
    	
    	while ( dep_OR_withdraw != 0 ) {
    		printf("\nEnter deposit (+) or withdrawal (-): ");
    		scanf("%f", &dep_OR_withdraw);
    			if (currentBalance < 0) {
    				printf("\n**I am sorry.  You bounced your check.");
    				printf("$10 will be deducted.");
    				currentBalance = currentBalance + dep_OR_withdraw - FEE;
    			}
    			else
    				currentBalance = currentBalance + dep_OR_withdraw;
    		printf("Current Balance: %.2f", currentBalance);
    	}

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    well, it would help if we knew the type of "dp_Or_withdraw". from what i gather it's a float.
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Please Help!
    Choose better titles in future - this tells us nothing.

    In addition to posting more relevant code (like including the types as misplaced says), you should also mention your OS and especially, your compiler.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Apr 2005
    Posts
    2

    very inexperienced programmer

    All the variables were declared as floats except for FEE which is a constant of 10. I'm trying to balance a checkbook in the program. My compiler is Miracle C and I have no idea what OS means. I'm taking an introductory course of C and this is the first program I have tried to write using selection statements or loops. I'll probably just try to write this again a different way, but I was hoping that maybe there was just some obvious little error that somebody would notice who knows what they are doing. The whole program is obviously not written well though! Please post if you have any tips that might help. Thanks.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > My compiler is Miracle C
    Yeah, that's the problem then - biggest P-o-S compiler every released onto the net.

    It's little better than "my homework was to write a compiler, and here it is", which is pretty good as far as it goes.

    But as a serious compiler, it's a JOKE!!!! Even crusty old Borland 2.01 spanks this lame compiler good.
    What's absolutely hysterical about miracle-C is that he asks for $$$

    Goto www.compilers.net and look for say dev-c++.
    Now that's a really good compiler with a useful IDE and all for $0.

    > and I have no idea what OS means
    Your operating system, which I guess means some flavour of windows.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed