Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <unistd.h>
  2. #include <stdio.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5. int calification(int note);
  6.  
  7. int show(char *msg);
  8.  
  9. int main(void)
  10. {
  11.  
  12. calification(77);
  13.  
  14. return 0;
  15. }
  16.  
  17. int calification(int note)
  18. {
  19. char *msg_dos= " ESTA MAL INTRODUCIDA LA NOTA";
  20. char *msg_three= " APROBADO/A";
  21. char *msg_four= " SUSPENSO/A";
  22.  
  23. if ((note >= 5) && (note <= 10))
  24. {
  25. show(msg_three+1);
  26. }
  27. else if (note >= 0 && note <= 4)
  28. {
  29. show(msg_four+1);
  30. }
  31. else if (note >10 || note < 0)
  32. {
  33. show(msg_dos+1);
  34. }
  35. return 0;
  36. }
  37.  
  38. int show(char *msg)
  39. {
  40. if(msg != "/n")
  41. {
  42. write(1, msg, 1);
  43. show(msg+1);
  44. }
  45. else
  46. {
  47. return 0;
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement