Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- int identyf( char *napis);
- int main()
- {
- char napis[10];
- if(identyf(napis)) printf("OK!");
- else printf(":(");
- return 0;
- }
- int identyf( char *napis)
- {
- if(((napis[0]=getchar())>= 'a' && napis[0]<= 'z') || (napis[0]>='A' && napis[0]<='Z') || (napis[0] == '_'))
- {
- int i =1;
- while( (napis[i])!=0)
- {
- if( !((napis[i]>='a' && napis[i] <= 'z') || (napis[i] >='A' && napis[i] <='Z') || (napis[i] >='0' && napis[i] <='9') || napis[i] == '_'))
- {
- return 0;
- }
- i=i+1;
- }
- return 1;
- }
- else return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement