fork download
  1. #include <stdio.h>
  2. #define N 20
  3. #include <string.h>
  4. int main(void) {
  5. char str[N],substr[N];
  6. int i=0,start=6,len=8;
  7. printf("\n请输入身份证号:");
  8. fgets (str, sizeof(str), stdin);
  9. for(;i<len;i++)
  10. substr[i]=str[start+i];
  11. substr[len]='\0';
  12. printf("对应出生日期为%s\n",substr);
  13. // your code goes here
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 5316KB
stdin
526775200709040311
stdout
请输入身份证号:对应出生日期为20070904