Thread: Noob Help......If/Else :S

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    54

    Noob Help......If/Else :S

    Thought I had it all figured out, but i can't get it to compile properly!! grrrrrrrr!!


    Basically everything is good, it compiles, but then it crashes and says that either 'meter', 'inlet', or 'pressure' is being USED WITHOUT BEING INITIALIZED. So annoying, what does that even mean??


    Code:
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    
    int main (void)
    
    {
        char lights, inlet, pressure;
        int meter;
    	
          
        printf ("\nCheck Your Status Lights, are they Green, Amber, or Red?");
        printf ("\nEnter 'G' for GREEN, 'A' for AMBER, or 'R' for RED ==> \n");
        scanf("%c", &lights);
    
        if (lights == 'G' || lights == 'g')
        {               
            printf ("\nDo Restart Procedure!\n" ); 
        }
        else if (lights == 'A' || lights == 'a')
        {
            printf( "\nCheck Fuel line Service routine\n" );       
        }
        else 
        {
            printf ("\nShut off all input lines and check meter #3\n" );   
            printf ("\n\nPlease Enter the ammount on meter, to the nearest whole number ");
            scanf ("%i", &meter);
        }
        if (meter >= 50)
        {
            printf ("\n\nMeasure Flow Velocity in inlet 2-B");
            printf ("\nIs inlet volocity High, Low or Normal?");
            printf ("\n\n PRESS 'H' for HIGH, 'L' for LOW, or 'N' for NORMAL==> ");
            scanf ("%i", &inlet);
    	  
            if (inlet == 'H' || inlet == 'h' || inlet == 'L' || inlet == 'l')
            {
                printf ("\nREFER UNIT FOR FACTORY SERVICE");
            }
        } 
        else if (inlet == 'N' || 'n')
        {
            printf ("\nRefer to Inlet Service Manual");
        }
    
    	else
        {
            printf ("\n\ncheck main line for test pressure");
            printf ("\nIs main line pressure High, Low or Normal?");
            printf ("\n\n PRESS 'H' for HIGH, 'L' for LOW, or 'N' for NORMAL==> ");
            scanf ("%i", &pressure);
    	  
            if (pressure == 'H' || pressure == 'h' || pressure == 'L' || pressure == 'l')
            {
                printf ("\nREFER TO MAIN LINE MANUEL");
    			_getch();
    			printf("\n\n\nPRESS ANY KEY TO EXIT");
            }
    		
            else
            {
                printf ("\nREFER TO MOTOR SERVICE MANUEL");
    			_getch();
    			printf("\n\n\nPRESS ANY KEY TO EXIT");
            }
        }
    
    }
    Last edited by matt.s; 03-19-2010 at 08:35 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with if/else and switch commands please
    By masterofwar14 in forum C++ Programming
    Replies: 4
    Last Post: 09-29-2009, 12:28 AM
  2. Noob to programming need help with a project
    By Wheelsonbus in forum C Programming
    Replies: 6
    Last Post: 02-25-2009, 03:46 AM
  3. Noob in need of help.
    By gec5741 in forum C++ Programming
    Replies: 18
    Last Post: 01-23-2009, 03:25 PM
  4. noob needs help!!!!:(
    By tykenfitz in forum C Programming
    Replies: 1
    Last Post: 07-10-2005, 08:49 AM
  5. noob: compiling error... plz help!
    By chosii in forum C Programming
    Replies: 2
    Last Post: 05-10-2002, 05:53 AM