编程菜鸟的日记-初学尝试编程-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 ...
随机推荐
- JAVA,字符串替换
package l515; //例5.15 //字符串替换 public class NewStr { public static void main(String[] args) { String ...
- SQL Server中Text和varchar(max) 区别
SQL Server 2005之后版本:请使用 varchar(max).nvarchar(max) 和 varbinary(max) 数据类型,而不要使用 text.ntext 和 image 数据 ...
- ORA-01536: 超出表空间 'tablespace_name' 的空间限额
表空间限额问题知识总结: 表空间的大小与用户的配额大小是两种不同的概念 表空间的大小是指实际的用户表空间的大小,而配额大小指的是用户指定使用表空间的的大小 把表空间文件增大,还是出现 ...
- CentOS升级glibc-2.14
升级glibc-2.14用到的rpm https://pan.baidu.com/s/1v-Uk579TGM6498cExst6ow 先要安装gcc yum -y install gcc 执行: rp ...
- 详解 Java 中的三种代理模式
代理模式 代理(Proxy)是一种设计模式,提供了对目标对象另外的访问方式;即通过代理对象访问目标对象.这样做的好处是:可以在目标对象实现的基础上,增强额外的功能操作,即扩展目标对象的功能. 这里使用 ...
- [转]Java Web笔记:搭建环境和项目配置(MyEclipse 2014 + Maven + Tomcat)
来源:http://www.jianshu.com/p/56caa738506a 0. 绪言 Java Web开发中,除了基础知识外,开发环境搭建,也是一项基本功.开发环境包括了IDE.项目管理.项目 ...
- ionic2/cordova自定义插件集成aar包
一.准备自定义插件 1. 准备:安装plugman npm install -g plugman 2. 新建组件 plugman create --name MyPlugin --plugin_id ...
- kudu的写数据流程
写入操作是指需进行插入.更新或删除操作的一组行.需要注意的事项是Kudu强制执行主关键字的唯一性,主关键字是可以更改行的唯一标识符.为了强制执行此约束条件,Kudu必须以不同的方式处理插入和更新操作, ...
- net core体系-web应用程序-3项目结构、配置文件详解
一.应用程序文件结构 如下图所示,相比于Asp.Net项目,在新建的Asp.Net Core项目中,没有了Global.asax以及Web.config这样的文件,但多了几个其他主要的文件,它们分别为 ...
- Python mysql sql基本操作
一.创建数据库,编码格式为utf-8 create database s12day9 charset utf8; 二.表操作 1.创建表 use s12day9; create table stude ...