Fotografiona

bsp10019.c

Sep 6th, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. bsp10019.c
  2.  
  3. #include <stdio.h>
  4. #include <ctype.h>
  5.  
  6. main ()
  7. {
  8. char eingabe;
  9. int zahl;
  10. printf("\nWaehlen sie (O)ktal, (H)ex oder (A)SCII > ");
  11. eingabe=getchar();
  12. printf("\nBitte Dezimalzahl eingeben: ");
  13. scanf("%i", &zahl);
  14. switch(toupper(eingabe))
  15. {
  16. case 'O':
  17. printf("Dezimal %i = Oktal %o \n", zahl, zahl);
  18. break;
  19. case 'H':
  20. printf("Dezimal %i = Hexadezimal %x \n", zahl, zahl);
  21. break;
  22. case 'A':
  23. if(zahl <= 255)
  24. printf("ASCII-Code %i entspricht %c \n", zahl, zahl);
  25. else
  26. printf("Diese Zahl ist zu gross ! \n\a");
  27. break;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment