21.04.23 Aufgabe 1+2
							parent
							
								
									f10f988806
								
							
						
					
					
						commit
						50086f4274
					
				|  | @ -40,9 +40,13 @@ public class ArrayExperimente | ||||||
|      */     |      */     | ||||||
|     public static boolean istEnthalten(int gesucht, int[] array) |     public static boolean istEnthalten(int gesucht, int[] array) | ||||||
|     { |     { | ||||||
|         // TODO...
 |         for(int i=0; i<array.length; i++) | ||||||
|          |         { | ||||||
|         // das return steht hier nur, damit der Compiler nicht meckert:
 |            if (array[i] == gesucht) | ||||||
|  |             { | ||||||
|  |                 return true; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|         return false; |         return false; | ||||||
|     }     |     }     | ||||||
| 
 | 
 | ||||||
|  | @ -55,10 +59,14 @@ public class ArrayExperimente | ||||||
|      */ |      */ | ||||||
|     public static int indexVon(int gesucht, int[] array) |     public static int indexVon(int gesucht, int[] array) | ||||||
|     { |     { | ||||||
|         // TODO...
 |         for(int i=0; i<array.length; i++) | ||||||
| 
 |         { | ||||||
|         // das return steht hier nur, damit der Compiler nicht meckert:
 |            if (array[i] == gesucht) | ||||||
|         return -3245646; |             { | ||||||
|  |                 return i; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return -1; | ||||||
|     }     |     }     | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue