dorbird

Hamster 2 Aufgabe 4

Oct 31st, 2013
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. void main() {
  2.     rechne();
  3. }
  4. int zaehle(){
  5.    int zaehler=0;
  6.    while(kornDa()){
  7.         nimm();
  8.         zaehler++;
  9.    }
  10.    return zaehler;
  11. }
  12. void rechne(){
  13.     int zahl1=0;
  14.     int zahl2=0;
  15.     int operator=0;
  16.     int i=0;
  17.     int o=0;
  18.  
  19.  
  20.     vor();
  21.     zahl1=zaehle();
  22.     vor();
  23.     operator=zaehle();
  24.     vor();
  25.     zahl2=zaehle();
  26.     vor();
  27.    
  28.     if(operator==1) {
  29.        o=zahl1+zahl2;
  30.        }
  31.     if(operator==2) {
  32.        o=zahl1-zahl2;
  33.        }
  34.     if(operator==3) {
  35.        o=zahl1*zahl2;
  36.        }
  37.     if(operator==4) {
  38.        o=zahl1/zahl2;
  39.        }
  40.     for (i=1;i<=o;i++){
  41.        gib();
  42.     }  
  43.     linksUm();
  44.     linksUm();
  45.     vor();
  46.    
  47.    
  48. }
Advertisement
Add Comment
Please, Sign In to add comment