码迷,mamicode.com
首页 >  
搜索关键字:cin getline    ( 8174个结果
poj 3751 时间日期格式转换
题目链接:http://poj.org/problem?id=3751题目大意:按照要求的格式将输入的时间日期进行转化。 1 #include 2 #include 3 using namespace std; 4 int main () 5 { 6 int t; 7 cin>>...
分类:其他好文   时间:2014-07-16 21:37:33    阅读次数:153
字符串读取
有两种方法可以读C++字符串:使用提取操作符(>>)和getline函数。(1)字符串提取操作符: 首先,它跳过前导空白字符,然后提取所有邻近的非空白字符。当发现空白字符时, 它就停下来。终止空白字符被留在输入流中. 提取操作符可以用来从键盘(cin流)或者使用开放式文件流从文件读数据。例如,要把一...
分类:其他好文   时间:2014-07-16 21:28:15    阅读次数:183
HDU 3791 二叉搜索树 题解
Problem Description推断两序列是否为同一二叉搜索树序列Input開始一个数n,(1#include #include using std::string;using std::cin;const int SIZE = (1>root; for (int i = 0; i >chi....
分类:其他好文   时间:2014-07-11 18:44:26    阅读次数:205
HDU4847
一道简单的用getline带空格带回车的字符串输入处理问题还是WA了一次 orz。。。。#include#include#includeusing namespace std;int main(){ int i,j,len; string str; int count=0; while(getlin...
分类:其他好文   时间:2014-07-11 09:58:25    阅读次数:214
C++基础:输入与输出
在学习这部分的时候我总感觉这部分的知识点很杂,所以就学习一点写一点,这样不会到最后看完了书脑子里很乱。 1、C++的输入和输出 1.1 标准输入流对象cin cin是标准的输入流对象,在程序中用于代表标准输入设备,通常指键盘。运算符“>>”在C++中仍保持C语言的“右移”操作,但用于输入时扩充了其功能,表示将输入流对象cin读取的数值传送给右方指定的变量。cin必须与输入运算符">>"配套使...
分类:编程语言   时间:2014-07-10 22:16:42    阅读次数:315
C++ deepin
访问类成员函数(cin.getline())方式是从访问结构成员变量方式衍生而来;C++结构体变量申明 struct关键字可省略;c++结构体变量声明初始化, = 可省略;但此需用在c++,大家都知道C++ 11有很多的新 特性C++结构体可以讲String Object作为其成员;struct R...
分类:编程语言   时间:2014-07-10 14:46:04    阅读次数:327
华为测试 公共子串计算
题目标题: 计算两个字符串的最大公共字串的长度,字符不区分大小写 输入两个字符串 输出一个整数 案例输入:asdfas werasdfaswer 案例输出:6 #include #include using namespace std; int main() { string str1,str2,temp; int m,MaxNum=0,Len; cin>>str1>>str...
分类:其他好文   时间:2014-07-09 12:16:39    阅读次数:416
UVa 729 - The Hamming Distance Problem
题目:构造n位01串,其中有m个1的所有组合。 分析:搜索、枚举。可以利用库函数,求解,也可以利用dfs求解;我这里采用位运算计算组合数。 说明:注意库啊! #include #include #include using namespace std; int S[20]; int main() { int T,N,M; while ( cin >> T ) for ( i...
分类:其他好文   时间:2014-07-08 11:24:33    阅读次数:199
按字符出现频率对字符进行排序
#include<iostream> #include<string> #include<algorithm> usingnamespacestd; voidtongji() { stringinput; stringoutput; getline(cin,input);//读入带空格的字符串 intn; n=input.size();//求字符串的大小 inta[255]={0}; intb[255]={0}; bo..
分类:其他好文   时间:2014-07-08 09:16:59    阅读次数:218
建立单链表的方法
#include<iostream> usingnamespacestd; structnode{ intd; structnode*next; };//定义结点 node*build1()//头插法构造单链表 { node*p;//指向新建结点 node*head;//头指针 head=NULL; p=head; intx; cin>>x; while(x!=-1) { p=newnode; p->d=x; p-&g..
分类:其他好文   时间:2014-07-08 09:06:06    阅读次数:220
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!