Advertisement
orneto

Untitled

May 30th, 2023
744
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.37 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4.   GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
  5.   C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, COBOL, HTML, CSS, JS
  6.   Code, Compile, Run and Debug online from anywhere in world.
  7.  
  8. *******************************************************************************/
  9. #include <stdio.h>
  10. #include <string>
  11.  
  12. using namespace std;
  13. typedef unsigned char  uint8_t;
  14.  
  15. typedef struct {
  16.   uint8_t s;
  17.   uint8_t m;
  18.   uint8_t h;
  19.   uint8_t DW;
  20.   uint8_t D;
  21.   uint8_t M;
  22.   uint8_t Y;
  23.  
  24. }_ctime;
  25.  
  26. uint8_t DIASMES(uint8_t MES){
  27.   uint8_t meses[12] = {31 , 28, 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 ,31};
  28.   return meses[(MES+11)%12];
  29. }
  30.  
  31.  
  32. int main()
  33. {
  34.     string a = "12/05/85";
  35.     printf("%li",a.length());
  36.     uint8_t buff;
  37.     int vals = 8;
  38.     buff = 0;
  39.     for (int cont = 0 ; cont < a.length() ; cont++){
  40.         switch(a[cont]){
  41.             case '0':case '1':case '2':case '3':case '4':case '5':case '6':case '7':case '8':case '9':
  42.             buff = buff*10 +  a[cont];
  43.             break;
  44.             default:
  45.             vals += (buff<<(vals%0xFF));
  46.             printf(" %i ",(vals%0xFF));
  47.             vals += 8;
  48.         }
  49.         buff+= a[cont];
  50.     }
  51.    
  52.     printf("\n\n%8X",vals);
  53.     return 0;
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement