Advertisement
Johnqc

FECHA Y DIAS

Apr 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. // ConsoleApplication1.cpp : Defines the entry point for the console application.
  2. //
  3. #include "stdafx.h"
  4. #include <iostream>
  5. #include <conio.h>
  6. #include <locale.h>
  7. using namespace std;
  8.  
  9. short uninum(long long fecha) {
  10. short UUU = (fecha / pow(10, 13));
  11. return UUU;
  12. }
  13. char fragil(long long fecha) {
  14. char F = (fecha % int(pow(10,13))) / pow(10, 12);
  15. return F;
  16. }
  17. char pais(long long fecha) {
  18. short PPPP=(fecha % int(pow(10, 12))) / pow(10, 8);
  19. return PPPP;
  20. }
  21. short dia(long long fecha) {
  22. short DD = (fecha % int(pow(10, 8))) / pow(10, 6);
  23. return DD;
  24. }
  25. short mes(long long fecha) {
  26. short MM = (fecha % int(pow(10, 6))) / pow(10, 4);
  27. return MM;
  28. }
  29. short año(long long fecha) {
  30. short AAAA = fecha % int(pow(10, 4));
  31. return AAAA;
  32. }
  33.  
  34. int main()
  35. {
  36. setlocale(LC_CTYPE, "Spanish");
  37. long long fecha=0;
  38. char frg,frg2;
  39. cout << "Ingrese una fecha en el siguiente formato; UUUFPPPPDDMMAAA: "; cin >> fecha;
  40.  
  41. frg = fragil(fecha);
  42. frg2 = (frg !=0)+'S';
  43. cout << "------------------------------------------------------------------------------------" << endl;
  44. cout << "Número único : " << uninum(fecha) << endl;
  45. cout << "Frágil(N : No; S: Sí) : " << frg2 << endl;
  46. cout << "País de procedencia : " << pais(fecha) << endl;
  47. cout << "Día, mes y año de vencimiento : ";
  48. cout << "Bien se encuentra vencido al día de hoy(N : No; S: Sí) : ";
  49.  
  50.  
  51. _getch();
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement