文件的输入#include#includeusing namespace std;ifstream cin("B.txt");cin>>n;
分类:
其他好文 时间:
2014-09-18 20:36:54
阅读次数:
114
运算符重载(Operator overloading)是C++重要特性之一,本文通过列举标准库中的运算符重载实例,展示运算符重载在C++里的妙用。具体包括重载operator<>支持cin,cout输入输出;重载operator[],实现下标运算;重载operator+=实现元素追加;重载operator()实现函数调用。...
分类:
编程语言 时间:
2014-09-18 00:48:53
阅读次数:
261
#include#include#includeusing namespace std;int main(){ string str,p; cin>>str>>p; int n=str.length(); int m=p.length(); //compute ...
分类:
其他好文 时间:
2014-09-17 23:08:52
阅读次数:
248
用C++写二叉树时碰到的问题, C++中*&连用表示对指针的引用,比如在代码中的这类用法:void createTree(Node *&head){ TypeElement data; cin >> data; if (data == '#') { head =...
分类:
编程语言 时间:
2014-09-17 20:11:22
阅读次数:
287
1 #include 2 #include 3 using namespace std; 4 5 int main() 6 { 7 string input; 8 while (getline(cin, input)) 9 {10 int Quicks...
分类:
其他好文 时间:
2014-09-17 13:22:02
阅读次数:
156
1、标准库string类型:用户程序要使用string类型对象,必须包含相关头文件#include字符串字面值与标准库string类型不是同一种类型,字符串字面值是字符数组,而string是对象2、intmain(){strings;cin>>s;cout>s) result+=s;cout=[]其...
分类:
编程语言 时间:
2014-09-17 02:15:51
阅读次数:
423
/* 题意:Nim游戏! 思路:通过异或,判断将n个数表示成二进制的形式之后,是否对应位的数字1 的个数是偶数! */ #includeusing namespace std;int main(){ int n, x, s; while(cin>>n){ s=...
分类:
其他好文 时间:
2014-09-16 21:46:11
阅读次数:
219
【题意简述】:求由小正方体组成的大的长方体的表面积。
【分析】:注意边界。
// 268K 0Ms
#include
using namespace std;
int main()
{
int C;
int t;
int l,w;//底面的长和宽
int h;// 立方体的高
int s=0;//表面积
cin>>C;
int Min;
while(C--)
{
...
分类:
其他好文 时间:
2014-09-16 14:18:30
阅读次数:
265
瘋子C++笔记1.C++输入、输出、头文件解释#includeusing namespace std ;int mian(){ cout >"输入流对象。如(int a,b; cin >> a >> b;第一个输入赋给a,第二个输入赋给b)(6)cout using namespace std .....
分类:
编程语言 时间:
2014-09-16 14:09:40
阅读次数:
175
瘋子C++笔记1.C++输入、输出、头文件解释#includeusing namespace std ;int mian(){ cout >"输入流对象。如(int a,b; cin >> a >> b;第一个输入赋给a,第二个输入赋给b)(6)cout using namespace std .....
分类:
编程语言 时间:
2014-09-16 14:07:40
阅读次数:
200