9.字符串的一些简单操作

xiaoxiao2021-02-28  82

#include<iostream> #include<cstring> #include <iomanip> using namespace std; int main() { char str1[10]="Cyclone"; char str2[10]="Joker"; char str3[15]="Kaman Knight"; int len; cout<<str1<<"!"<<endl; cout<<str2<<"!"<<endl; strcat(str1,str2); cout<<str3<<setw(13)<<str1<<endl; len=strlen(str3); cout<<len<<endl; return 0; }

结果:Cyclone!

            Joker!

            Kaman Knight  CycloneJoker

            12

转载请注明原文地址: https://www.6miu.com/read-85643.html

最新回复(0)