strcmp

    2热度

    1回答

    我知道MATLAB可以方便地得到所有行从具有字符串(在这种情况下)的表desired_a在“A”柱像这样: refs_found = refs(strcmp(refs.a,desired_a),:); 不过,我想在desired_a不是字符串的情况下执行此操作,而是使用字符串的矢量,refs_found返回refs.a中的字符串也都在desired_a中的所有行。 当我试图做到这一点勿庸置疑我

    -3热度

    2回答

    卡在数组和字符串比较与strcmp c 为什么它工作? 编译器卡住在if(strcmp(c,ch[i]) == 0){ #include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ char ch[]="asdfghjkl"; char c; int n=sizeof(ch)/si

    -2热度

    2回答

    我正在使用在文件中搜索字符串(本例中为名称)的程序。我希望程序不要区分大小写,但strcmp是。我正在考虑将bot文件和用户输入转换为小写。但这样做效率不高。任何其他的建议来克服这一点? 这是代码的一小部分只得到程序 cout << "\n Enter the Guests name: "; cin.getline(look_4_person, 256); //name that is

    1热度

    2回答

    我从数据库中得到一个字符串,它使用utf8_unicode_ci进行编码。它可能包含中间点字符(⋅),我必须找出使用strcmp。如果我直接在HTML中显示字符串,则字符显示没有问题,但是当我进行比较时,结果不是我所期望的。 例如: $string = "⋅⋅⋅ This string starts with middle dots"; $result = strcmp(substr($stri

    0热度

    1回答

    我正在从C Programming for the Absolute Beginner 2nd Edition开始第8章挑战3。该程序应该按字母顺序对一组名称进行排序。 我的程序不工作。主要功能没有sort()工作,但排序功能搞砸了;根据警告消息,strcmp()似乎也被错误地使用。 我使用的编译器是gcc,我用nano写了代码。 /* Uses strcmp() in a different f

    -3热度

    1回答

    我想了解当我指定“strx”的值超过10个字符时,它总是会导致strcmp显示-1的值,而当我指定strx的值小于10个字符时,则strcmp会显示正确的值为0. 我的具体问题是:如果我们指定的strx的值大于str1的大小,为什么strcmp会放弃-1的错误结果? PS:我试图在复制后打印str1和strx,并显示相同的输出。 #include <stdio.h> #include <stri

    1热度

    2回答

    我有这个应该是'聊天模拟器'的程序,它现在唯一要做的就是回复'你好!'当用户输入'Hello'时。 #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <string.h> int main() { printf("Chat simulator!\n"); do { c

    -3热度

    1回答

    这是检查给定字符串的代码是identifier或keyword。下面是代码: #include<stdio.h> #include<conio.h> #include<string.h> #include<ctype.h> int main(){ int i = 0, flag = 0; char a[10][10] = {"int", "float", "bre

    0热度

    1回答

    我试图测试出包含在此SQL语句随机的电子邮件地址字符串 判断strcmp()函数: INSERT IGNORE INTO possible_duplicate_email -> (human_id, email_address_1, email_address_2, entry_date) -> VALUES(LAST_INSERT_ID(), '[email protected]',

    1热度

    1回答

    如果我使用比较运算符比较字符串而不是strcmp在C中会发生什么?它会比较它的ASCII值和返回结果吗?