1.已给定字符串为:helloworld@itcast.cn,请编码实现helloworld输出和itcast.cn输出。
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void test11() {
char* str1 = "helloworld@itcast.cn";
char buf1[1024] = { 0 };
char buf2[1024] = { 0 };
sscanf(str1, "%[^@]@%s", buf1, buf2);
printf("%s\n%s", buf1, buf2);
}
int main()
{
test11();
system("pause");
return EXIT_SUCCESS;
}