编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第4章编程练习4
#include <iostream>
#include <string>
using namespace std;
int main()
{
string fname;
string lname;
string name;
cout<<"Enter your first name: ";
getline(cin,fname);
cout<<"Enter your last name: ";
getline(cin,lname);
name=lname+", "+fname;
cout<<"Here's the information in a single string: "<<name<<endl;
system("pause");
return 0;
}
与使用char数组和头文件cstring中的函数比较,string对象和string中函数,操作简单,尤其对复杂的问题优势更加明显。
编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第4章编程练习4的更多相关文章
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习9
#include <iostream> #include <fstream> #include <cstdlib> #include <string> ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习8
#include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习7
#include <iostream> #include <string> #include <cctype> using namespace std; int m ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习6
#include <iostream> #include <string> using namespace std; const int MSIZE=100; struct j ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习5
#include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习4
#include <iostream> using namespace std; const int strsize=30; const int BOPSIZE=5; void showm ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习3
#include <iostream> using namespace std; void showmenu(void) { cout<<"Please enter ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习2
#include <iostream> #include <cctype> using namespace std; const int MAXSIZE=10; int mai ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习1
#include <iostream>#include <cctype>using namespace std;int main(){ char ch; while((ch=c ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习9
#include <iostream>using namespace std;int main(){ int num; cout<<"Enter number of ...
随机推荐
- Update openssh7.9 on centos6
一.制作RPM安装包1)依赖安装yum install rpm-build gcc make wget openssl-devel krb5-devel pam-devel libX11-devel ...
- 实现虚拟机VMware上Centos操作系统与主机windows之间互相复制与粘贴
1.启动你的虚拟机,然后点击虚拟机,如下所示(未安装的话,显示的是安装VMware Tools): 2.点击安装Vmware tools以后显示如下所示: 3.VMwareTools-9.9.2-24 ...
- Delphi Setlength 内存释放总结
https://blog.csdn.net/lotusyangjun/article/details/8203521 一.在Setlength 被调用次数不多时,可直接使用以下代码进行释放var aa ...
- C 语言的 GCC 扩展
GNU 编译器(GCC)提供了很多 C 语言扩展,编译器会使用该信息生成更高效的机器代码. 内联函数 static inline __attribute__ ((always_inline)) int ...
- C#使用Emit生成构造函数和属性
假设我们需要一个名叫Kitty的类,其在Pets程序集下. 1 // specify a new assembly name 2 var assemblyName = new AssemblyName ...
- nginx 正则及rewrite常用规则实例
一.正则表达式匹配,其中:* ~ 为区分大小写匹配* ~* 为不区分大小写匹配* !~和!~*分别为区分大小写不匹配及不区分大小写不匹配二.文件及目录匹配,其中:* -f和!-f用来判断是否存在文件* ...
- 基于nopcommerce b2c开源项目的精简版开发框架Nop.Framework
http://www.17ky.net/soft/70612.html?v=1#0-sqq-1-39009-9737f6f9e09dfaf5d3fd14d775bfee85 项目详细介绍 该开源项目是 ...
- 【Android】Android 监听apk安装替换卸载广播
[Android]Android 监听apk安装替换卸载广播 首先是要获取应用的安装状态,通过广播的形式 以下是和应用程序相关的Broadcast Action ACTION_PACKAGE_ADDE ...
- BZOJ1433 [ZJOI2009]假期的宿舍 二分图匹配 匈牙利算法
原文链接http://www.cnblogs.com/zhouzhendong/p/8372785.html 题目传送门 - BZOJ1433 题解 我们理一理题目. 在校的学生,有自己的床,还可以睡 ...
- 20165235 祁瑛 2018-4 《Java程序设计》第七周学习总结
20165235 祁瑛 2018-4 <Java程序设计>第七周学习总结 教材学习内容总结 MySQL数据管理系统 MySQL数据管理系统,简称MySQL,是世界上流行的数据管理系统. M ...