new 1
2020-05-11 04:09
309 查看
1、
string str;
cin>>str;//直接输入,但是遇到空格自动结束。
2、利用cin.get()函数
1、 char c;
cin.get()//输入一个字符
2、
char str[50];
cin.get(str,20);//输入字符串,遇到空格不结束,且读入字符串
3、
cin.get(无参);弥补cin.get(str,n)中不需要的换行符
当使用
cin.get(str1,20)//输入一个字符串
cin.get();
cin.get(str2,20)//输入一个字符串
若中间不使用cin.get(),只能输入str1,一旦输入完str1换行之后,str2读取到换行自动结束输入。
3、cin.getline(str,20)//遇到空格不结束,且读入字符串
没有cin.get()函数中,换行符的问题,连续输入两个字符串时候,不需用使用cin.get()读取多余换行符
4、 string str;
getline(cin.str);//接收一个字符串输入,遇到空格不结束,且读入字符串
5、 char str[20];
gets(str)//遇到空格不结束,且读入字符串
1、cin.peek()函数是读取输入的字符串首个字符
2、strcmp(str1,str2);
如果str1==str2返回0
str1<str2返回-1 //以第一个不相等的字符的ASCII值为准
str2>str1返回1
2、sort(a,a+10,cmp).
铁柱铁柱 原创文章 8获赞 0访问量 235 关注 私信相关文章推荐
- Myeclipse2014找不到Help-->install new software
- New version of VS2005 extensions for SharePoint 3.0
- Detailed description of prosperous new sand making machine Features
- new和alloc
- Using the New MySQL Query Profiler
- python __new__ __init__
- CodeForces 500A New Year Transportation
- override 和 new 的区别
- 基础备忘:new\delete和malloc\free及memset
- New Year and Days
- 也说new
- Sealed,new,virtual,abstract与override的区别
- New package not yet registered with the system
- The new Microsoft Business Solutions Certificates
- 堆,栈,new/delete/malloc/free[zz]
- js中new 一个对象内部发生了什么?
- new、abstract、virtual、override关键字的使用
- 《Effective C++》读书笔记之item49:了解new-handler的行为
- 如何理解 List list = new ArrayList();
- WPF Unleashed Chapter 3:Important New Concepts in WPF ---Dependency Properties