Announcement

Collapse
No announcement yet.

For you programmer types...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    For you programmer types...

    Want to see a super annoying if, else statement?

    I r t3h sux at programming, lol.


    Code:
     if (tempStr == "OemTilde")
               {
                   hasBeenChecked = "~";
                   return hasBeenChecked;
               }
    
               else if (tempStr == "Capital")
               {
                   hasBeenChecked = " *Capslock* "; //I hate dealing with these...blah.
                   return hasBeenChecked;
               }
    
    
               if (tempStr == "Oem5") 
                    {
                        hasBeenChecked = "\\";
                        return hasBeenChecked;
                    }
    
               else if (tempStr == "Oemplus")
               {
                 //  bool shiftKeyDown = gkh.ShiftKeyDown; //bool operator used to determine 
                   if (shiftKeyDown == true)             //if the shift key is depressed (duh).
                   {
                       hasBeenChecked = "+";             //is depressed
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "=";             //is not depressed
                       return hasBeenChecked;
                   }
               }
    
               else if (tempStr == "OemMinus")
               {
                 //  bool shiftKeyDown = gkh.ShiftKeyDown; //bool for shift key depression
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = "_"; //depressed
                       return hasBeenChecked;
                   }
                   else
                   {
                        hasBeenChecked = "-"; //not depressed
                        return hasBeenChecked; 
                   }
               }
    
              
               else if (tempStr == "D0")
               {
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = ")";
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "0";
                       return hasBeenChecked;
                   }
               }
               else if (tempStr == "D9")
               {
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = "(";
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "9";
                       return hasBeenChecked;
                   }
               }
               else if (tempStr == "D8")
               {
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = "*";
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "8";
                       return hasBeenChecked;
                   }
               }
               else if(tempStr == "D7")
               {
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = "&";
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "7";
                       return hasBeenChecked;
                   }
               }
               else if (tempStr == "D6")
               {
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = "^";
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "6";
                       return hasBeenChecked;
                   }
               }
               else if(tempStr == "D5")
               {
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = "%";
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "5";
                       return hasBeenChecked;
                   }
               }
               else if(tempStr == "D4")
               {
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = "$";
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "4";
                       return hasBeenChecked;
                   }
               }
               else if(tempStr == "D3")
               {
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = "#";
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "3";
                       return hasBeenChecked;
                   }
               }
               else if (tempStr == "D2")
               {
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = "@";
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "2";
                       return hasBeenChecked;
                   }
               }
               else if (tempStr == "D1")
               {
                   if (shiftKeyDown == true)
                   {
                       hasBeenChecked = "!";
                       return hasBeenChecked;
                   }
                   else
                   {
                       hasBeenChecked = "1";
                       return hasBeenChecked;
                   }
               }
    Originally posted by sweet91accord
    if aredy time i need to put something in cb7tuner. you guy need to me a smart ass about and bust on my spelling,gramar and shit like that in so sorry.

    #2
    wtf man. Why did you do that?

    Well shit. I was going to copy it into my compiler and see wtf it does but I don't have any header statements or any definition to variables for a cin >>
    Gary A.K.A. Carter
    [sig killed by photobucket]

    Comment


      #3
      It's all in C# .NET. I'll copy all the code in here later.
      Originally posted by sweet91accord
      if aredy time i need to put something in cb7tuner. you guy need to me a smart ass about and bust on my spelling,gramar and shit like that in so sorry.

      Comment


        #4
        switch/case > you

        Owner of https://theclunkerjunker.com

        Comment


          #5
          Doesn't work in this particular case, at least very readily.
          Originally posted by sweet91accord
          if aredy time i need to put something in cb7tuner. you guy need to me a smart ass about and bust on my spelling,gramar and shit like that in so sorry.

          Comment


            #6
            Originally posted by foamypirate
            Doesn't work in this particular case, at least very readily.
            Why?

            Its definitely more elegant than if/else.

            Code:
            switch(tempStr){
            
            	case "OEMTilde":
            		do something'
            		break;
            	case "something else":
            
            		if (this){
            			do that;
            		}
            		else{
            			do the other thing;
            		}
            
            		break;
            	.
            	.
            	.
            	.
            	.
            
            	case "one more":
            		do this thing;
            		break;
            
            	default:
            		error;
            		break;
            }

            Owner of https://theclunkerjunker.com

            Comment


              #7
              when i grow up i wanna be a programmer

              Comment


                #8
                D'oh! For some reason I forgot about nesting if's in switch/cases. LOL.

                Being new at programming owns me.
                Originally posted by sweet91accord
                if aredy time i need to put something in cb7tuner. you guy need to me a smart ass about and bust on my spelling,gramar and shit like that in so sorry.

                Comment

                Working...
                X