Newbie Again

This is a discussion on Newbie Again within the C Programming forums, part of the General Programming Boards category; I've gotten this far, but I don't know how to use the 'function' properly... I've tried several things, but keep ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    15

    Newbie Again

    I've gotten this far, but I don't know how to use the 'function' properly... I've tried several things, but keep coming back to this base code because I know it works.

    Can anyone give me a better idea of how to take this part of the coding in the switch:

    Code:
    printf("\nPlease Enter the Amount in x.xx Hong Kong Dollars to Convert.\n$");
        scanf("%f", &f_input_AMT);  //get AMT input from User for HKD conversion
        f_result[4] = f_input_AMT * f_const_HKD;
        printf("\n$%.2f Hong Kong Dollars is equal to $", f_input_AMT);
        printf("%.2f US Dollars.\n\n", f_result[4]);
    And make it a function? Problem is that I can't figure out how to pass the menu selection as an argument and get the right result. I keep getting mixed responses.

    I understand that I'm going to have to do something like this:

    Code:
    getCurrencyValue(void)
    printf("\nPlease Enter the Amount in x.xx (first argument) to convert. \n$)", (first argument);
    scanf("%f", $f_input_AMT);  //get amt for conversion
    f_result[4] = f_input_AMT * f_const_(need argument here to define what constant to use);
    printf("\n$.2f (first argument) is equal to $", f_input_AMT);
    printf("%.2f US Dollars.\n\n", f_result[4]);
    I just don't quite get how to figure out how to get the argument from my menu selection and tell the program what constant to use in the calculation.

    Any help, tips, pointers are appreciated.

    Full Program
    Code:
    //Currency Conversion Program
    //Written by ***********, University of Phoenix
    //Version 3 4/2/2006
    
    #include <stdio.h>
    #include <system.h>
    #include <stdlib.h>
    #include <ctype.h>
    
    //global variable declarations and initialization with foreign exchange rates from <http://www.xe.com/ucc.convert.cgi> as of 4/2/2006
    //this global variable defnition is to remain constant throughout use in the program
    
    #define f_const_USD 1.00;	 	//1.00 USD = 1.00 USD		*United States Dollar*		 	
    #define f_const_GBP 1.73710;	 	//1.00 GBP = 1.73710 USD	*United Kingdom Pounds*
    #define f_const_CAD 0.855872; 	//1.00 CAD = 0.855872 USD 	*Canadian Dollars*
    #define f_const_MXN 0.0919608; 	//1.00 MXN = 0.0919608 USD 	*Mexican Pesos*
    #define f_const_JPY 0.00849675;	//1.00 JPY = 0.00849675 USD 	*Japanese Yen*
    #define f_const_HKD 0.128871;		//1.00 HKD = 0.128871 USD 	*Hong Kong Dollars*
    
    main(void)  //Main Program for Currency Conversion
    {
    	//The following f_input variable is for storing the AMT input from the user, declared initially as '0'
    	float f_input_AMT = 0.00;  
    	//The following f_result array is for storing calculations within the program declared initially as '0'
    	float f_result[4] = {0.00};
    	// f_result[0] = United Kingdom Pounds
    	// f_result[1] = Canadian Dollars
    	// f_result[2] = Mexican Pesos
    	// f_result[3] = Japanese Yen
    	// f_result[4] = Hong Kong Dollars
    	
    	//variable declaration for menu input, default is '0'
    	int i_menu_choice = '0';
    		
    	do  //Do while structure so program will continue until user selects 6 to exit
    	{
    		do //Error Checking Loop Structure for Menu Selection
    		{
    			//create menu to choose currency conversion type
    			printf("\n\tCurrency Conversion\n");  //Title of Program
    			printf("\n1\tConvert United Kingdom Pounds to US Dollars");
    			printf("\n2\tConvert Canadian Dollars to US Dollars");
    			printf("\n3\tConvert Mexican Pesos to US Dollars");
    			printf("\n4\tConvert Japanese Yen to US Dollars");
    			printf("\n5\tConvert Hong Kong Dollars to US Dollars");
    			printf("\n6\tExit Currency Conversion Program\n\n");
    			//Accept input for menu selection
    			printf("Please make your selection now: ");
    			i_menu_choice = getchar();
    		
    	
    		//switch structure for menu selection
    		switch (i_menu_choice)
    		{
    		case '1':
    			printf("\nYou Selected Conversion from United Kingdom Pounds to US Dollars.");
    			do  //begin do structure to error check f_input_AMT for digits
    			{
    				printf("\nPlease Enter the Amount in x.xx United Kingdom Pounds to Convert.\n$");
    				scanf("%f", &f_input_AMT);  //get AMT input from User for GBP conversion
    				f_result[0] = f_input_AMT * f_const_GBP;
    				printf("\n$%.2f United Kingdom Pounds is equal to $", f_input_AMT);
    				printf("%.2f US Dollars.\n\n", f_result[0]);
    			}
    			while (isdigit (f_input_AMT));  //end do structure to error check f_input_AMT for digits
    			break;
    		case '2':
    			printf("\nYou Selected Conversion from Canadian Dollars to US Dollars.");
    			do  //begin do structure to error check f_input_AMT for digits
    			{
    				printf("\nPlease Enter the Amount in x.xx Canadian Dollars to Convert.\n$");
    				scanf("%f", &f_input_AMT);  //get input from User for CAD conversion
    				f_result[1] = f_input_AMT * f_const_CAD;
    				printf("\n$%.2f Canadian Dollars is equal to $", f_input_AMT);
    				printf("%.2f US Dollars.\n\n", f_result[1]);
    			}
    			while (isdigit (f_input_AMT));  //end do structure to error check f_input_AMT for digits
    			break;
    		case '3':
    			printf("\nYou Selected Conversion from Mexican Pesos to US Dollars.");
    			do  //begin do structure to error check f_input_AMT for digits
    			{
    				printf("\nPlease Enter the Amount in x.xx Mexican Pesos to Convert.\n$");
    				scanf("%f", &f_input_AMT);  //get input from User for MXN conversion
    				f_result[2] = f_input_AMT * f_const_MXN;
    				printf("\n$%.2f Mexican Pesos is equal to $", f_input_AMT);
    				printf("%.2f US Dollars.\n\n", f_result[2]);
    			}
    			while (isdigit (f_input_AMT));  //end do structure to error check f_input_AMT for digits
    			break;
    		case '4':
    			printf("\nYou Selected Conversion from Japanese Yen to US Dollars.");
    			do  //begin do structure to error check f_input_AMT for digits
    			{
    				printf("\nPlease Enter the Amount in x.xx Japanese Yen to Convert.\n$");
    				scanf("%f", &f_input_AMT);  //get AMT input from User for JPY conversion
    				f_result[3] = f_input_AMT * f_const_JPY;
    				printf("\n$%.2f Japanese Yen is equal to $", f_input_AMT);
    				printf("%.2f US Dollars.\n\n", f_result[3]);
    			}
    			while (isdigit (f_input_AMT));	//end do structure to error check f_input_AMT for digits
    			break;
    		case '5':
    			printf("\nYou Selected Conversion from Hong Kong Dollars to US Dollars.");
    			do  //begin do structure to error check f_input_AMT for digits
    			{
    				printf("\nPlease Enter the Amount in x.xx Hong Kong Dollars to Convert.\n$");
    				scanf("%f", &f_input_AMT);  //get AMT input from User for HKD conversion
    				f_result[4] = f_input_AMT * f_const_HKD;
    				printf("\n$%.2f Hong Kong Dollars is equal to $", f_input_AMT);
    				printf("%.2f US Dollars.\n\n", f_result[4]);
    			}
    			while (isdigit (f_input_AMT));  //end do structure to error check f_input_AMT for digits
    			break;
    		case '6':
    			return 0;  //end program
    		default:
    			printf("\nYou Have Made and Invalid Selection.  Please Try Again.\n\n\n");
    			i_menu_choice = getchar();						
    		} //end switch
    		} //end error check do while for menu selection criteria
    		while (!isdigit(i_menu_choice) || (i_menu_choice , '1') && (i_menu_choice > '6'));  
    	
    	} //end program run do while statement
    	while (i_menu_choice != '6');
    
    }  //end main program

  2. #2
    Registered User
    Join Date
    Mar 2006
    Posts
    15

    Why?

    Can someone tell me why this program is returning such strange values?

    Code:
    //Currency Conversion Program
    //Written by ***********, University of Phoenix
    //Version 3 4/2/2006
    
    #include <stdio.h>
    #include <system.h>
    #include <stdlib.h>
    #include <ctype.h>
    
    main(void)  //Main Program for Currency Conversion
    {
    
    	//variable declaration for menu input, default is '0'
    	int i_menu_choice = '0';
    	float tempVal = 0.00;
    		
    	do  //Do while structure so program will continue until user selects 6 to exit
    	{
    		do //Error Checking Loop Structure for Menu Selection
    		{
    			//create menu to choose currency conversion type
    			printf("\n\tCurrency Conversion\n");  //Title of Program
    			printf("\n1\tConvert United Kingdom Pounds to US Dollars");
    			printf("\n2\tConvert Canadian Dollars to US Dollars");
    			printf("\n3\tConvert Mexican Pesos to US Dollars");
    			printf("\n4\tConvert Japanese Yen to US Dollars");
    			printf("\n5\tConvert Hong Kong Dollars to US Dollars");
    			printf("\n6\tExit Currency Conversion Program\n\n");
    			//Accept input for menu selection
    			printf("Please make your selection now: ");
    			i_menu_choice = getchar();
    		
    			if (i_menu_choice == '6')
    				return;  //end program
    			else
    			{
    				tempVal = getCurrencyValue(i_menu_choice);
    				printf("\nThat converts to $%.2f", tempVal);
    				printf("\n\n");
    			}
    		}  //end error check do while for menu selection criteria
    		while (!isdigit(i_menu_choice) || (i_menu_choice , '1') && (i_menu_choice > '6'));  
    	
    	} //end program run do while statement
    	while (i_menu_choice != '6');
    
    }  //end main program
    
    getCurrencyValue(int i_menu_choice)  //function declaration
    {	
    	//The following f_input variable is for storing the AMT input from the user, declared initially as '0'
    	float f_input_AMT = 0.00;  
    	//The following f_result array is for storing calculations within the program declared initially as '0'
    	float f_result = 0.00;
    	//The following f_const varibles are for the constant conversions
    	float f_const_USD = 1.00;	 	//1.00 USD = 1.00 USD		United States Dollar		 	
    	float f_const_GBP = 1.73710;	 	//1.00 GBP = 1.73710 USD	United Kingdom Pounds
    	float f_const_CAD = 0.855872; 		//1.00 CAD = 0.855872 USD 	Canadian Dollars
    	float f_const_MXN = 0.0919608; 		//1.00 MXN = 0.0919608 USD 	Mexican Pesos
    	float f_const_JPY = 0.00849675;		//1.00 JPY = 0.00849675 USD 	Japanese Yen
    	float f_const_HKD = 0.128871;		//1.00 HKD = 0.128871 USD 	Hong Kong Dollars
    	
    	//switch structure for menu selection
    		switch (i_menu_choice)
    		{
    		case '1':
    			printf("\nYou Selected Conversion from United Kingdom Pounds to US Dollars.");
    			do  //begin do structure to error check f_input_AMT for digits
    			{
    				printf("\nPlease Enter the Amount in x.xx United Kingdom Pounds to Convert.\n$");
    				scanf("%f", &f_input_AMT);  //get AMT input from User for GBP conversion
    				f_result = f_input_AMT * f_const_GBP;
    			}
    			while (isdigit (f_input_AMT));  //end do structure to error check f_input_AMT for digits
    			break;
    		case '2':
    			printf("\nYou Selected Conversion from Canadian Dollars to US Dollars.");
    			do  //begin do structure to error check f_input_AMT for digits
    			{
    				printf("\nPlease Enter the Amount in x.xx Canadian Dollars to Convert.\n$");
    				scanf("%f", &f_input_AMT);  //get input from User for CAD conversion
    				f_result = f_input_AMT * f_const_CAD;
    			}
    			while (isdigit (f_input_AMT));  //end do structure to error check f_input_AMT for digits
    			break;
    		case '3':
    			printf("\nYou Selected Conversion from Mexican Pesos to US Dollars.");
    			do  //begin do structure to error check f_input_AMT for digits
    			{
    				printf("\nPlease Enter the Amount in x.xx Mexican Pesos to Convert.\n$");
    				scanf("%f", &f_input_AMT);  //get input from User for MXN conversion
    				f_result = f_input_AMT * f_const_MXN;
    			}
    			while (isdigit (f_input_AMT));  //end do structure to error check f_input_AMT for digits
    			break;
    		case '4':
    			printf("\nYou Selected Conversion from Japanese Yen to US Dollars.");
    			do  //begin do structure to error check f_input_AMT for digits
    			{
    				printf("\nPlease Enter the Amount in x.xx Japanese Yen to Convert.\n$");
    				scanf("%f", &f_input_AMT);  //get AMT input from User for JPY conversion
    				f_result = f_input_AMT * f_const_JPY;
    			}
    			while (isdigit (f_input_AMT));	//end do structure to error check f_input_AMT for digits
    			break;
    		case '5':
    			printf("\nYou Selected Conversion from Hong Kong Dollars to US Dollars.");
    			do  //begin do structure to error check f_input_AMT for digits
    			{
    				printf("\nPlease Enter the Amount in x.xx Hong Kong Dollars to Convert.\n$");
    				scanf("%f", &f_input_AMT);  //get AMT input from User for HKD conversion
    				f_result = f_input_AMT * f_const_HKD;
    			}
    			while (isdigit (f_input_AMT));  //end do structure to error check f_input_AMT for digits
    			break;
    		case '6':
    			f_result = -1; 
    		default:
    			f_result = -1;						
    		} //end switch
    		
    		return f_result;
    } //end getCurrencyValue function

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    I don't do other people homework and some folks here wouldn' even read your post but as i'm into a very good mood, try to fix this before you do any change in the source:
    Code:
    homework.c:6:20: system.h: No such file or directory
    homework.c:11: warning: return type defaults to `int'
    homework.c: In function `main':
    homework.c:34: warning: `return' with no value, in function returning non-void
    homework.c:37: warning: implicit declaration of function `getCurrencyValue'
    homework.c:42: warning: left-hand operand of comma expression has no effect
    homework.c:42: warning: suggest parentheses around && within ||
    homework.c:47: warning: control reaches end of non-void function
    homework.c: At top level:
    homework.c:50: warning: return type defaults to `int'
    homework.c: In function `getCurrencyValue':
    homework.c:56: warning: unused variable `f_const_USD
    Specially line 42.

  4. #4
    Registered User
    Join Date
    Mar 2006
    Posts
    15
    Thank you very much! I've seen the other posts where people ask for others to do their homework, that's really not what I'm after here.

    I have a very poor text that does an awful job of explaining things. I have two other books that I'm reading from to compensate... and I'm stuck using the Miracle C not-really-a-compiler.

    Thank you to all of you for your help in understanding coding. I've learned more here on the boards than I have at University of Phoenix! I don't want anyone to do anything for me - I just want to understand what's 'actually' wrong so I can fix the right thing

    Thank you again!

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Miracle. Pathetic.

    Maragato's errors are from the good ol' gcc compiler, you really really should be using something like that.

  6. #6
    Registered User
    Join Date
    Mar 2006
    Posts
    15
    Trust me, I know. When I code stuff in gcc, it works fine... then when I move it to Miracle, I spend hours trying to tweak it to work. It really is useless, and I've filed a formal complaint with UofP to do something about it.

    Hey, can you guys give me a hint as to why this is my output? I realize at least that I didn't call the multidimensional string array correctly, but why the strange number output? Is it because I'm multiplying the entire array?

    Currency Conversion

    1 Convert United Kingdom Pounds to US Dollars
    2 Convert Canadian Dollars to US Dollars
    3 Convert Mexican Pesos to US Dollars
    4 Convert Japanese Yen to US Dollars
    5 Convert Hong Kong Dollars to US Dollars
    6 Exit Currency Conversion Program

    Please make your selection now: 1

    You Selected Conversion from United Kingdom Pounds to US Dollars.
    Please Enter the Amount in x.xx h to Convert.
    $1.00

    $1.00 h is equal to $1149792686749713200000000000000000000000000000000 0000000000
    00000000000000000000000000000000000000000000.00 US Dollars.

    Code:
    //Currency Conversion Program
    //Written by ***********, University of Phoenix
    //Version 3 4/3/2006
    
    #include <stdio.h>
    #include <system.h>
    #include <stdlib.h>
    #include <ctype.h>
    
    //global variable declarations and initialization with foreign exchange rates from <http://www.xe.com/ucc.convert.cgi> as of 4/2/2006
    //these global variables are to remain constant throughout use in the program
    
    main(void)  //Main Program for Currency Conversion
    {
    	
    	//variable declaration for menu input, default is '0'
    	int i_menu_choice = 0;
    		
    	do  //Do while structure so program will continue until user selects 6 to exit
    	{
    			//create menu to choose currency conversion type
    			printf("\n\tCurrency Conversion\n");  //Title of Program
    			printf("\n1\tConvert United Kingdom Pounds to US Dollars");
    			printf("\n2\tConvert Canadian Dollars to US Dollars");
    			printf("\n3\tConvert Mexican Pesos to US Dollars");
    			printf("\n4\tConvert Japanese Yen to US Dollars");
    			printf("\n5\tConvert Hong Kong Dollars to US Dollars");
    			printf("\n6\tExit Currency Conversion Program\n\n");
    			//Accept input for menu selection
    			printf("Please make your selection now: ");
    			i_menu_choice = getchar();
    		
    	
    		//switch structure for menu selection
    		switch (i_menu_choice)
    		{
    		case '1':
    			printf("\nYou Selected Conversion from United Kingdom Pounds to US Dollars.");
    			getCurrencyValue(i_menu_choice);
    			break;
    		case '2':
    			printf("\nYou Selected Conversion from Canadian Dollars to US Dollars.");
    			getCurrencyValue(i_menu_choice);
    			break;
    		case '3':
    			printf("\nYou Selected Conversion from Mexican Pesos to US Dollars.");
    			getCurrencyValue(i_menu_choice);
    			break;
    		case '4':
    			printf("\nYou Selected Conversion from Japanese Yen to US Dollars.");
    			getCurrencyValue(i_menu_choice);
    			break;
    		case '5':
    			printf("\nYou Selected Conversion from Hong Kong Dollars to US Dollars.");
    			getCurrencyValue(i_menu_choice);
    			break;
    		case '6':
    			return 0;  //end program
    		default:
    			printf("\nYou Have Made and Invalid Selection.  Please Try Again.\n\n\n");
    			i_menu_choice = getchar();						
    		} //end switch		 
    	
    	} //end program run do while statement
    	while (i_menu_choice != '6');
    
    }  //end main program
    	
    getCurrencyValue(int i_menu_choice)
    {
    	//The following f_const array is for currency conversion use in the getCurrencyValue function
    	float f_const_CUR[6] = {1.00, 1.73710, 0.855872, 0.0919608, 0.00849675, 0.128871};
    	//These were the original constant declarations.  Will not remove until program coding verified as working correctly.
    	//#define f_const_AMT 1.00;		//1.00 USD = 1.00 USD		*United States Dollar*		 	
    	//#define f_const_GBP 1.73710;		//1.00 GBP = 1.73710 USD	*United Kingdom Pounds* 
    	//#define f_const_CAD 0.855872; 	//1.00 CAD = 0.855872 USD 	*Canadian Dollars*
    	//#define f_const_MXN 0.0919608; 	//1.00 MXN = 0.0919608 USD	*Mexican Pesos*
    	//#define f_const_JPY 0.00849675;	//1.00 JPY = 0.00849675 USD 	*Japanese Yen* 
    	//#define f_const_HKD 0.128871;		//1.00 HKD = 0.128871 USD	*Hong Kong Dollars*
    	
    	//The following f_input variable is for storing the AMT input from the user, declared initially as '0'
    	float f_input_AMT = 0.00;
    	
    	//The following f_result variables are for storing calculations within the program declared initially as '0'
    	float f_result_AMT = 0.00;
    	//These were all part of the original code, will not remove until program coding verified as working correctly.	
    	//float f_result_GBP = 0.00;
    	//float f_result_CAD = 0.00;
    	//float f_result_MXN = 0.00;
    	//float f_result_JPY = 0.00;
    	//float f_result_HKD = 0.00;
    	
    	//The following char array is to store the names of each of the currencies for use in the getCurrencyValue function
    	char currency_names[6][40] = {"United States Dollars", "United Kingdom Dollars", "Canadian Dollars", "Mexican Pesos", "Japanese Yen", "Hong Kong Dollars"};
    
    	do
    	{		
    	printf("\nPlease Enter the Amount in x.xx %c to Convert.\n$", currency_names[i_menu_choice]);
    	scanf("%f", &f_input_AMT);  //get input from User for conversion
    		do //begin do structure to error check f_input_AMT for digits
    		{
    			f_result_AMT = f_input_AMT * f_const_CUR[i_menu_choice];
    			printf("\n$%.2f %c is equal to $", f_input_AMT, currency_names[i_menu_choice]);
    			printf("%.2f US Dollars.\n\n", f_result_AMT);
    		}
    		while (isdigit (f_input_AMT));  //end do structure to error check f_input_AMT for digits
    		
    	} //end error check do while for menu selection criteria
    	while (!isdigit(i_menu_choice) || (i_menu_choice , '1') && (i_menu_choice > '6')); 
    	
    }  //end getCurrencyValue

  7. #7
    Registered User
    Join Date
    Mar 2005
    Posts
    140
    Code:
    i_menu_choice = getchar();
    getchar returns a char not an int
    you should you scanf with %d instead

    If you change that, these should become
    Code:
    		case 1:
    		case 2:
    instead of
    Code:
    		case '1':
    		case '2':
    Now you will be correctly indexing into your currency_names and f_const_CUR arrays
    Print the value of i_menu_choice in getCurrencyValue to see why what you are doing is wrong.

    Code:
    printf("\nPlease Enter the Amount in x.xx %s to Convert.\n$", currency_names[i_menu_choice]);
    Code:
    printf("\n$%.2f %s is equal to $", f_input_AMT, currency_names[i_menu_choice]);
    isdigit expects an int not a float


    What are you trying to do here?
    Code:
    (i_menu_choice , '1')
    Do you pay attention to compiler warnings at all?
    Last edited by spydoor; 04-03-2006 at 03:52 PM.

  8. #8
    Registered User
    Join Date
    Mar 2006
    Posts
    15

    Unhappy

    It's Miracle C, I don't get compiler warnings unless it flat out doesn't compile.

  9. #9
    Registered User
    Join Date
    Mar 2006
    Posts
    15
    Also, that is a typo.... thanks for pointing it out - I actually hadn't noticed it yet.

  10. #10
    Registered User
    Join Date
    Mar 2006
    Posts
    15
    Oh goodness, that sure did it. Now it just doesn't go back to the menu when done... I'll figure that part out. Thanks again, guys - like I said, I've learned a lot more here than I have in class. Thank you thank you thank you.

  11. #11
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,531
    > then when I move it to Miracle,
    Like I said before, you're simply wasting your time trying to get anything working with that crap.

    Unless you want a degree in frustration and futility, I suggest you start hammering this down the throats of those who insist on using this PoS.

    If they want a windows based compiler with an IDE, then get dev-c++ for heavens sake.
    Not only is it truly $0, it's also got the gcc compiler underneath it, so all your code compiled using gcc locally will work when compiled with dev-c++.

    It is NOT a C compiler, it is incapable of compiling even the simplest of programs which every other compiler has NO problem with at all.

    No wait, don't tell me the author of miracle C is also a prof at that college, that would be really sad.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  12. #12
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    don't tell me the author of miracle C is also a prof at that college
    Haha
    Bad luck then

  13. #13
    Registered User
    Join Date
    Mar 2006
    Posts
    15
    It's all good guys.... I write it in gcc first now and then backwards tweak it for this stupid compiler. I wrote one heck of a complaint to the board of UofP for requiring us to use this crap that doesn't work and doesn't teach.

    BTW - thanks to all of you for your help, I have a fully functioning program now, and I appreciate all of the input that you all gave during this long and tediuos process.

    Feel free to delete this entire post to keep homework-nabbing theives away

  14. #14
    Registered User
    Join Date
    Mar 2006
    Posts
    15
    FYI - I ended up using this to get the menu input

    i_menu_choice = getchar() - '0';

    Works like a charm now...

  15. #15
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,531
    > I wrote one heck of a complaint to the board of UofP for requiring us to use this crap
    A good start - a petition from all of the students (or those who are capable of writing an independent C program which gcc compiles OK and mc fails miserably on) would probably help.

    http://www.open-std.org/JTC1/SC22/WG14/www/docs/n869/
    This is the final draft (ie, costs $0) of the ANSI-C99 standard.
    If someone gets all uppity about mc being "good enough", you can start quoting chapter and verse at them, and showing how what they're teaching isn't really C at all.

    BTW, good job on getting the program running
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. newbie: array question :(
    By cstudent in forum C Programming
    Replies: 2
    Last Post: 04-09-2008, 06:46 AM
  2. getting to grips with allegro and ms vc++ (newbie)
    By jimjamjahaa in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2005, 06:49 PM
  3. Newbie in problem with looping
    By nrain in forum C Programming
    Replies: 6
    Last Post: 11-05-2005, 11:53 AM
  4. C++ newbie / linux not so newbie question
    By goldmonkey in forum C++ Programming
    Replies: 7
    Last Post: 12-13-2003, 11:27 AM
  5. Newbie Game Develpoers Unite!
    By Telenosis in forum Game Programming
    Replies: 10
    Last Post: 06-22-2002, 02:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21