sl202.cpp

来自「Visual C++ 的学习资料一」· C++ 代码 · 共 26 行

CPP
26
字号
// sl202.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream.h"
#include "cstring"


int main()
{
	char str1[20],str2[10];
	cout<<"输入少于9个字符"<<'\n';
	cout<<"str1=";
	cin >>str1;
	cout<<"输入少于9个字符"<<'\n';
	cout<<"str2=";
	cin >>str2;
	cout<<"输出字符串"<<"\n";
	cout<<"str1="<<str1<<"\n";
	cout<<"str2="<<str2<<"\n";
	cout<<"计算str1的长度"<<"\n";
	cout<<"长度="<<strlen(str1)<<"\n";
	cout<<"把字符串str2衔接到字符串str1后面"<<"\n";
	cout<<strcat(str1,str2)<<"\n";
}

⌨️ 快捷键说明

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