cin流的状态和缓存刷新问题
来源:互联网 发布:微盘程序源码 编辑:程序博客网 时间:2024/05/25 08:15
#include "stdafx.h"
#include <iostream>
#include <list>
#include <vector>
#include <limits>
using namespace std;
int main(void)
...{
vector <int> ivec;
list <int> ilst;
int ival;
cout << "the vetor's numbers" << endl;
while(cin >> ival)
ivec.push_back(ival);
cin.clear(); //注意此处
cin.ignore(std::numeric_limits<streamsize>::max(),' ');//此处关键
cout << "the list's numbers" << endl;
while(cin >> ival)
ilst.push_back(ival);
vector <int> ::const_iterator vecit = ivec.begin();
list <int> ::const_iterator lstit = ilst.begin();
if(ilst.size() != ivec.size())
...{
cout << "they are not same" << endl;
return 0;
}
else
...{
for( ; vecit != ivec.end(), lstit != ilst.end(); ++vecit, ++lstit)
...{
if(*vecit != *lstit)
...{
cout << "they are not same" << endl;
return 0;
}
}
cout << "they are same!" << endl;
}
return 0;
}
#include <iostream>
#include <list>
#include <vector>
#include <limits>
using namespace std;
int main(void)
...{
vector <int> ivec;
list <int> ilst;
int ival;
cout << "the vetor's numbers" << endl;
while(cin >> ival)
ivec.push_back(ival);
cin.clear(); //注意此处
cin.ignore(std::numeric_limits<streamsize>::max(),' ');//此处关键
cout << "the list's numbers" << endl;
while(cin >> ival)
ilst.push_back(ival);
vector <int> ::const_iterator vecit = ivec.begin();
list <int> ::const_iterator lstit = ilst.begin();
if(ilst.size() != ivec.size())
...{
cout << "they are not same" << endl;
return 0;
}
else
...{
for( ; vecit != ivec.end(), lstit != ilst.end(); ++vecit, ++lstit)
...{
if(*vecit != *lstit)
...{
cout << "they are not same" << endl;
return 0;
}
}
cout << "they are same!" << endl;
}
return 0;
}
- cin流的状态和缓存刷新问题
- 对象的状态和缓存的关系
- showModalDialog的一些用法和缓存问题
- hibernate(实体bean和缓存的问题)
- cin 流的状态
- 深入剖析hibernate的N+1问题和缓存问题
- UI019---ITableviewcell的性能问题和缓存优化
- linux--kvm--关于kvm的磁盘格式和缓存问题
- Java多线程里总线锁定和缓存一致性的问题
- 关于输入流状态函数cin.eof()的问题
- 输入流cin的状态
- hibernate的session和缓存
- 内存和缓存的区别!
- 分布式和缓存的思考
- Bitmap的加载和缓存
- 内存和缓存的区别
- 内存和缓存的区别
- shiro的注解和缓存
- 故障智能诊断读书笔记(一)
- Java中的”推”技术
- 我一直用nokia的手机
- 随便记录一下
- onunload在Maxthon(傲游)中的问题
- cin流的状态和缓存刷新问题
- nice batch
- 基于DM642的JPEG压缩初步设计
- 58种网页常用小技巧(javascript)
- 2004 Java 官方开发工具总览
- DirectShow开发环境配置
- 用POI的HSSF来控制EXCEL的研究
- 平静的生活,有时候也很小资.
- Let's learn from each other!