Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <math.h>
  4.  
  5. main(){
  6.  
  7. int h, m, s, x, i;
  8. char cidade[3][20]={{"Paris"},{"Rio de Janeiro"},{"Sydney"}};
  9. char nome[20];
  10.  
  11.  
  12. printf("Indique a cidade desejada: ");
  13. gets(nome);
  14.  
  15. for(i=0;i<3;i++)
  16. {
  17. if(!strcmp(cidade[i],nome))
  18. break;
  19. }
  20.  
  21. printf("Indique as Horas:");
  22. scanf("%d",&h);
  23. printf("Indique os Minutos:");
  24. scanf("%d",&m);
  25. printf("Indique os Segundos:");
  26. scanf("%d",&s);
  27.  
  28.  
  29.  
  30. if(!strcmp(cidade[0],nome)){
  31.  
  32. h=h+1;
  33. printf("Fuso da cidade de Paris e: GMT+1 \n");
  34.  
  35. do
  36. {
  37. system("cls"); //Apaga a última instrução
  38. printf("horas da cidade: %d - %d - %d \n", h,m,s);
  39.  
  40. if(h>23)
  41. h=h-24;
  42. if(h>24)
  43. h=0;
  44. if(s>59)
  45. {
  46. s=0;
  47. m++;
  48. }
  49. if(m>59)
  50. {
  51. m=0;
  52. h++;
  53. }
  54.  
  55. Sleep(1000); //1000 microsecond= 1 second delay...
  56. s++;
  57. }while(s>=0&&h>=0&&m>=0);
  58. }
  59.  
  60.  
  61.  
  62. /* //h=horas
  63. //m=minutos
  64. //s=segundos
  65. do
  66. {
  67. if(i=0)
  68. {
  69. printf("Fuso da cidade de Paris e: GMT+1 \n");
  70. system("cls"); //Apaga a última instrução
  71. printf("horas da cidade: %d - %d - %d \n", h,m,s);
  72. }
  73. Sleep(1000); //1000 microsecond= 1 second delay...
  74. s++;
  75. }while(s>=0&&h>=0&&m>=0);*/
  76.  
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement