Advertisement
rotti321

CV UVT 2017

Nov 30th, 2021
839
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.   int ceve(char s[]){
  5.       char *p;
  6.       if(s[0]!='C'||s[1]!='V')
  7.         return 0;
  8.     p=strstr(s,".pdf");
  9.     if(!(p!=NULL && strcmp(p,".pdf")==0))
  10.         return 0;
  11.     p=strtok(s,"_"); //p=CV
  12.     if(p==NULL){
  13.         return 0;
  14.     }
  15.     p=strtok(NULL,"_"); //p=prenume
  16.     for(int i=0; i<strlen(p); i++){
  17.         if(p[i]<'a'|| p[i]>'z')
  18.         return 0;
  19.     }
  20.     p=strtok(NULL,"."); //p=nume
  21.         if(p==NULL){
  22.         return 0;
  23.     }
  24.     for(int i=0; i<strlen(p); i++){
  25.         if(p[i]<'a'|| p[i]>'z')
  26.         return 0;
  27.     }
  28.     return 1;
  29.   }
  30.  
  31.  
  32. int main() {
  33.     char s[100];
  34.     cin.getline(s,100);
  35.     cout<<ceve(s);
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement