f0304.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:1k
源码类别:
C#编程
开发平台:
Visual C++
- //=====================================
- // f0304.cpp
- // C串操作
- //=====================================
- #include<iostream>
- using namespace std;
- //-------------------------------------
- int main(){
- char* s1 = "Hello ";
- char* s2 = "123";
- char a[20];
- strcpy(a, s1); // copy
- cout<<(strcmp(a,s1)==0 ? "" : " not")<<"equaln"; // compare
- cout<<strcat(a, s2)<<endl; // concatenate
- cout<<strrev(a)<<endl; // modify
- cout<<strset(a, 'c')<<endl; // set
- cout<<(strstr(s1, "ell") ? "" : "not ")<<"foundn"; // find string
- cout<<(strchr(s1,'c') ? "": "not ")<<"foundn"; // find char
- }//====================================