Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.15 KB | None | 0 0
  1. int ergebnis;
  2.         int erste = (int) (string[7]- 0x30);
  3.         if((int) (string[8]- 0x30) >= 0 && (int) (string[8]- 0x30) <= 9) erste = (erste * 10) + (int) (string[8] - 0x30);
  4.         if((int) (string[9]- 0x30) >= 0 && (int) (string[9]- 0x30) <= 9 && string[8] < 10) erste = (erste * 10) + (int) (string[9] - 0x30);
  5.        
  6.         int zweite = 0;
  7.         if((int) (string[9]- 0x30) < 10 && (int) (string[8] > 10- 0x30)) zweite = (int) (string[9] - 0x30);
  8.         if((int) (string[10]- 0x30) >= 0 && (int) (string[10]- 0x30) <= 9) zweite = (zweite * 10) + (int) (string[10] - 0x30);
  9.         if((int) (string[11]- 0x30) >= 0 && (int) (string[11]- 0x30) <= 9) zweite = (zweite * 10) + (int) (string[11] - 0x30);
  10.        
  11.         if((char)string[8] == '+' || (char)string[9] == '+' || (char)string[10] == '+') ergebnis = erste + zweite;
  12.         if((char)string[8] == '-' || (char)string[9] == '-' || (char)string[10] == '-') ergebnis = erste - zweite;
  13.         if((char)string[8] == '/' || (char)string[9] == '/' || (char)string[10] == '/') ergebnis = erste / zweite;
  14.         if((char)string[8] == '*' || (char)string[9] == '*' || (char)string[10] == '*') ergebnis = erste * zweite;
  15.         kprintf("Das Ergebnis lautet: ");
  16.         kputx(ergebnis, 10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement