#include <iostream>
#include <cstring>
using namespace std;
int main()
{
 char fname[20];
 char lname[20];
 char name[45];
 cout<<"Enter your first name: ";
 cin.getline(fname,20);
 cout<<"Enter your last name: ";
 cin.getline(lname,20);
 strcpy(name,lname);
 strcat(name,", ");
 strcat(name,fname);
 cout<<"Here's the information in a single string: "<<name<<endl;
 system("pause");
 return 0;
}

运行结果:

Enter your first name: Flip

Enter your last name: Fleming

Here's the information in a single string: Fleming, Flip

编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第4章编程练习3的更多相关文章

  1. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习9

    #include <iostream> #include <fstream> #include <cstdlib> #include <string> ...

  2. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习8

    #include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using ...

  3. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习7

    #include <iostream> #include <string> #include <cctype> using namespace std; int m ...

  4. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习6

    #include <iostream> #include <string> using namespace std; const int MSIZE=100; struct j ...

  5. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习5

    #include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int ...

  6. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习4

    #include <iostream> using namespace std; const int strsize=30; const int BOPSIZE=5; void showm ...

  7. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习3

    #include <iostream> using namespace std; void showmenu(void) { cout<<"Please enter ...

  8. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习2

    #include <iostream> #include <cctype> using namespace std; const int MAXSIZE=10; int mai ...

  9. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习1

    #include <iostream>#include <cctype>using namespace std;int main(){ char ch; while((ch=c ...

  10. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习9

    #include <iostream>using namespace std;int main(){ int num; cout<<"Enter number of ...

随机推荐

  1. 微信小程序--代码构成---JS 交互逻辑

    一个服务仅仅只有界面展示是不够的,还需要和用户做交互:响应用户的点击.获取用户的位置等等.在小程序里边,我们就通过编写 JS 脚本文件来处理用户的操作. <view>{{ msg }}&l ...

  2. hdfs数据到hbase过程

    需求:将HDFS上的文件中的数据导入到hbase中 实现上面的需求也有两种办法,一种是自定义mr,一种是使用hbase提供好的import工具 一.hdfs中的数据是这样的 hbase创建好表 cre ...

  3. webpack项目打包配置

    webpack.config.js 文件中,其中“plugins”最为重要 var path = require("path"); const webpack = require( ...

  4. std::string 是什么

    #include "stdafx.h" #include <iostream> #include <string> using std::cout; usi ...

  5. jloi2015

    题解: [JLOI2015]管道连接 这个很水 比较裸的斯坦纳树dp 斯坦纳树dp就是 g[i][j]表示当前在i点,状态为j 然后转移分为两种 g[i][j]=g[i][k]+g[i][k^j] 另 ...

  6. Python执行ImportError:No module named MySQLdb异常

  7. Codeforces Gym100187C Very Spacious Office 贪心 堆

    原文链接https://www.cnblogs.com/zhouzhendong/p/CF-Gym100187C.html 题目传送门 - CF-Gym100187C 题意 给定 $n$ 个房间以及 ...

  8. 2n的 位数

    len=())+,(2n−1同样适用)

  9. Cyclic Nacklace hdu3746 kmp 最小循环节

    题意:给出一段字符串  求最少在最右边补上多少个字符使得形成循环串(单个字符不是循环串) 自己乱搞居然搞出来了... 想法是:  如果nex[len]为0  那么答案显然是补len 否则  答案为循环 ...

  10. 05. Matplotlib 1 |图表基本元素| 样式参数| 刻度 注释| 子图

    1.Matplotlib简介及图表窗口 Matplotlib → 一个python版的matlab绘图接口,以2D为主,支持python.numpy.pandas基本数据结构,运营高效且有较丰富的图表 ...