#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. javascript 正则表达式(十)

    一.什么是正则 在常见的字符串检索和替换中,我们需要提供一种模式表示检索或替换的规则.正则表达式使用单个字符串来描述.匹配一系列符合某个句法规则的字符串. abc [a-z]{4} \d\d\d 二. ...

  2. JS onclick跳转

    onclick="javascript:window.location.href='URL'" onclick="location='URL'" onclick ...

  3. 通过impala更改Kudu表属性

    开发人员可以通过更改表的属性来更改 Impala 与给定 Kudu 表相关的元数据.这些属性包括表名, Kudu 主地址列表,以及表是否由 Impala (内部)或外部管理. Rename an Im ...

  4. eclipse发布web

    elipse集成tomcat 在实际开发中通常在eclipse中集成tomcat,这样在开发中更方便一些.打开eclipse,选择界面下方的servers选项,点击no servers are ava ...

  5. BZOJ4802 欧拉函数 数论

    原文链接http://www.cnblogs.com/zhouzhendong/p/8117744.html 题目传送门 - BZOJ4802 题意概括 Description 已知N,求phi(N) ...

  6. day19 正则,re模块

    http://www.cnblogs.com/Eva-J/articles/7228075.html  所有常用模块的用法 正则的规则: 在一个字符组里面枚举合法的所有字符,字符组里面的任意一个字符和 ...

  7. sql的with as用法

    http://www.cnblogs.com/linjiqin/archive/2013/06/24/3152667.html

  8. TMS320DM642学习----第一篇(硬件连接)

    DSP设备型号:SEED-DTK-VPM642(目前实验室用途:视频处理,图像处理方向,预计搭载目标跟踪以及云台防抖等算法) 官网链接:http://www.seeddsp.com/index.php ...

  9. MYSQL总览

    第一,二,三范式解决的是非主属性的关系.BC 范式解决的是主属性的关系:第二范式:就是完全依赖,没有部分依赖([id,b]->c 即不能c即依赖id又依赖b):[非主属性不能依赖于主键的一部分, ...

  10. 开启vue源码的解析攻略---认识flow

    javascript 是动态类型的代码,有很多的写法很不容易报错,想引入静态类型检查的flow,之前做项目的时候用的typascript的,看的大概的写法和 typescript 类似,因为规范避免了 ...