Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///Admitere UVT 2017
- ///S3 a
- #include <iostream>
- #include <cstring>
- using namespace std;
- bool verif(char s[]) {
- char *p;
- int cnt = 0;
- p = strstr(s, ".pdf");
- if(s[0] != 'C' || s[1] != 'V') return false;
- if(p == NULL) return false;
- if(p != NULL && strlen(p) > 4) return false;
- for(int i = 2; i < strlen(s) - 4; i++) {
- if(s[i] == '_') {
- cnt++;
- }
- else {
- if(!(s[i] >= 'a' && s[i] <= 'z')) return false;
- }
- }
- if(cnt > 2) return false;
- return true;
- }
- void nume(char s[]){
- char *p, cuv[100];
- p=strtok(s, "_"); //CV
- p=strtok(NULL, "_");
- strcpy(cuv, p);
- cuv[0]=cuv[0]-('a'-'A');
- cout<<cuv<< " ";
- p=strtok(NULL, "_.");
- strcpy(cuv, p);
- cuv[0]=cuv[0]-('a'-'A');
- cout<<cuv;
- }
- int main() {
- char s[101] = {};
- int ok = 0;
- cin.getline(s, 100);
- if(verif(s)) ok = 1;
- nume(s);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement