我有一个文件,其中包含以下格式的员工信息:
名称:Belal Kassem
服务:安全性
生日:1995年
薪水:500名称:Abdallah Yasser
服务:市场营销
生日:1954年
薪水:500名称:Hend Elkarmouty
服务:牙医
生日:1990年
薪水:800
我希望程序搜索用户指示的员工姓名,然后返回+ newWithName:(NSString *)printerName { ... }
或true
(已找到/未找到)。
但是,现在,我的程序仅询问我要删除的员工人数及其姓名。
false
我还想使用NameFinder变量打印出所有被删除的员工。
答案 0 :(得分:3)
使用strcmp
比较字符串,如下所示:
if(!strcmp(NameFinder, Name[i]))
{ //This is not the official code.
printf("%s", NameFinder); //Just to check if it is working or not.
}