英语: fine 罚款 bowel dustbin prok incinerate salacity cone regent mitigant thug fealty loathe
分类:
其他好文 时间:
2014-07-16 19:29:22
阅读次数:
171
使用ifstream和getline读取文件内容[c++]
分类:
编程语言 时间:
2014-07-14 21:13:42
阅读次数:
213
曾在工作中遇见一个特别问题,就是在使用fstream中getline方法读数据读不出。如下: 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 int _tmain(int argc, _TC...
分类:
编程语言 时间:
2014-07-14 15:16:23
阅读次数:
184
0.不要试着从C++编译器的角度理解问题,而是从程序的语义着手。1.控制台标准输入输出流的使用1.1IO对象不可复制或者赋值。因此使用IO对象做参数必须使用非const 引用参数(非const因为对IO对象的读写会改变其状态)。1.2当cin输入非法数据时,fail置为1,当cin遇到文件结尾(ct...
分类:
编程语言 时间:
2014-07-13 23:37:17
阅读次数:
391
#includeusing namespace std;int main(){ int g,l,t; cin>>t; while(t--){ cin>>g>>l; if(l%g==0)//最大公约数一定是最小公倍数的因子 cout ...
分类:
其他好文 时间:
2014-07-13 21:34:46
阅读次数:
176
C++输入一行字符串的一点小结
原文链接:
http://www.wutianqi.com/?p=1181
大家在学习C++编程时,一般在输入方面都是使用的cin.
而cin是使用空白(空格,制表符和换行符)来定字符串的界的。
这就导致了对于带有空格的字符串,比如”I Love C++奋斗乐园论坛”
只能读入”I”,后面的都无法读入。
这时怎么办?...
分类:
编程语言 时间:
2014-07-13 18:33:33
阅读次数:
310
代码:
#include
#include
#include
#include
int main()
{
int num[100];
int odd = 0, even = 0;
std::string str;
getline(std::cin, str);
std::stringstream s(str);
int j = 0;
while(getline(s, s...
分类:
其他好文 时间:
2014-07-13 13:54:31
阅读次数:
280
1 #include 2 #define N 65 3 using namespace std; 4 5 const long long INF = 1LL>_;12 while(_--)13 {14 int n,i,j,k;15 cin>>n;...
分类:
其他好文 时间:
2014-07-12 15:03:45
阅读次数:
198
a+b: 1 import java.util.Scanner; 2 public class Main { 3 4 public static void main(String args[]){ 5 Scanner cin=new Scanner(System.in);...
分类:
编程语言 时间:
2014-07-12 13:40:17
阅读次数:
244