gpt4 book ai didi

c - 在 C 中如何 strcmp 只是开头的 2 个字符然后连接?

转载 作者:太空宇宙 更新时间:2023-11-04 05:08:11 25 4
gpt4 key购买 nike

<分区>

在 C 中,我如何 strcmp 只是开始的 2 个字符?然后与另一个字符串连接?像这样:

char s[10];
scanf("%s",s);

/* if i input "cs332" or "cs234", anything start with cs */

if (strcmp("cs",???)==0)
strcat(s,"by professor");

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com