#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
char input[100];
NSLog(@"输入身份证号码>>>");
scanf("%s",input);
NSMutableString *str=[NSMutableString stringWithFormat:@"%s",input];
BOOL wh = [str hasPrefix:@"4201"];
if (wh) {
NSLog(@"武汉人");
}else{
NSLog(@"不是武汉人");
}
BOOL gender1 = [str hasSuffix:@"1"];
BOOL gender2 = [str hasSuffix:@"3"];
if (gender1||gender2) {
NSLog(@"男人");
}else{
NSLog(@"女人");
}
}
return 0;
} |