⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 f0304.cpp

📁 C++程序设计教程(第二版)源代码 钱能编著
💻 CPP
字号:
//=====================================
// 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")<<"equal\n";   // compare
  cout<<strcat(a, s2)<<endl;                          // concatenate
  cout<<strrev(a)<<endl;                              // modify
  cout<<strset(a, 'c')<<endl;                         // set
  cout<<(strstr(s1, "ell") ? "" : "not ")<<"found\n"; // find string
  cout<<(strchr(s1,'c') ? "": "not ")<<"found\n";     // find char
}//====================================

 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -