Guest User

Untitled

a guest
Nov 28th, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.36 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4. #include<math.h>
  5.  
  6. void Menu()
  7. {
  8.     system("cls");
  9.     printf(" 1. Tekst zadachi \n");
  10.     printf(" 2. Vvod dannih v minutah \n");
  11.     printf(" 3. Pereschet v sekundy \n");
  12.     printf(" 4. Pereschet v chasy i minuty ( HH : MM ) \n");
  13.     printf(" 5. Pereschet v sutki, chasy i minuty ( DD : HH : MM ) \n");
  14.     printf(" 6. Exit \n");
  15. }
  16.  
  17. void Tekst (int a)
  18. {
  19.         system("cls");
  20.         printf(" Napisat' programmu perescheta yedinits vremeni. \n Programma dolzhna upravlyat'sya s pomoshch'yu menyu iz shesti punktov .\n");
  21. }
  22.  
  23. void Vvod (int a)
  24. {
  25.     printf("Input time in minutes: ");
  26.     scanf_s("%d /n", a);
  27. }
  28.  
  29. void SS (int a)
  30. {
  31.     printf("Time in seconds is %d ", a*60, "s");
  32. }
  33.  
  34. void HHMM (int a)
  35. {
  36.     int b = 0, c = a;
  37.     while (c >= 60)
  38.         {
  39.             b = b+1; c = c-60;
  40.         }
  41.     printf("Time HH:MM = %d:%d", b, c);
  42. }
  43.  
  44. void DDHHMM (int a)
  45. {
  46.     int b = 0, c = a, d =0;
  47.     while (c >= 60)
  48.         {
  49.             b = b+1; c = c-60;
  50.         }
  51.     while (b >= 24)
  52.         {
  53.             d = d+1; b = b-1;
  54.         }
  55. }
  56.    
  57. int main()
  58. {
  59.     int a = 0, k=15, p;
  60.     void (*f[5])(int a) = {Tekst, Vvod, SS, HHMM, DDHHMM };
  61.     Menu();
  62.     scanf_s("%d", &p);
  63. while (p != 6)
  64. {
  65.        if ((p<1)||(p>6)) {
  66. printf("INPUT ERROR! Vvedite chislo ot 1 do 6 \n"); getchar();
  67. }
  68.     while ((p>0)&&(p<6))
  69.     {
  70.             (*f[p-1])(a);
  71.             getchar();
  72.             Menu();
  73.             scanf_s("%d", &p);
  74.     }
  75. }
  76.  
  77.  
  78.     return 0;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment