码迷,mamicode.com
首页 >  
搜索关键字:using    ( 53562个结果
第十五周 阅读项目
2、查看下面程序的输出,解释为什么会有这样的输出。 #include #include using namespace std; int main( ) { unsigned char a[] = {0x32,0x30,0x31,0x35,0xA3,0xAC,0xCE,0xD2,0xC3,0xC7,0xB3,0xD4, 0xC1,...
分类:其他好文   时间:2015-06-21 18:37:59    阅读次数:108
第16周上机实践项目1——平方根中的异常
编写一个程序,求输入数的平方根。设置异常处理,当输入负数时采用异常处理机制给出提示。 代码 #include #include using namespace std; double sqrt1(double n) { if(n<0) throw n; else return sqrt(n); } int main() { doubl...
分类:其他好文   时间:2015-06-21 18:32:48    阅读次数:128
第16周上机实践项目2——有些数的阶乘不算了
求n!的函数,当用户的输入为负数,以及输入数太大时(例如大于12),使用异常处理机制予以拒绝,并给出恰当的提示。代码#include #include using namespace std; int fun(int n) { int i,sum=1; if(n12) throw n; else {...
分类:其他好文   时间:2015-06-21 18:31:37    阅读次数:118
第16周上机实践项目3——max带来的冲突
分析下面程序出现的编译错误,给出解决的方案。#include using namespace std; //定义函数模板 template T max(T a, T b) { return (a>b)?a:b; }int main() { int x=2,y=6; double x1=9.123,y1=12.6543; cout<...
分类:其他好文   时间:2015-06-21 18:30:40    阅读次数:123
Linked List Cycle
Description:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Code: 1 bool hasCycle(ListNo.....
分类:其他好文   时间:2015-06-21 18:25:08    阅读次数:116
C++ 文件逐行读入 并按空格分割
#include #include #include using namespace std;int main(){ ifstream in("in.txt"); string line; while (getline(in, line)) { stringstream ss(line); stri...
分类:编程语言   时间:2015-06-21 18:22:28    阅读次数:110
hdu1827Summer Holiday tarjan缩点
//给一个有向图,每个点都有权值,问最少需要几个起点和最少花费多少能将整个图遍历完 //用tarjan缩点,然后找出所有入度为0的点 #include #include #include #include using namespace std ; const int maxn = 1010 ; const int inf = 0x7fffffff ; vector vec[ma...
分类:其他好文   时间:2015-06-21 15:51:30    阅读次数:140
c++学习-虚函数
#include using namespace std;class common{public: virtual void hello(){couthello(); return 0;}
分类:编程语言   时间:2015-06-21 15:48:53    阅读次数:158
hdu 5274 水题
内你n个数 让你求区间倒置数的对数(就是前面大后面小) 看到Q次询问  想到线段树 感觉不好实现    !! pre【i】  表示i前面与i有关的倒置数的个数    ans【i】【j】表示区间i-j倒置数的个数      这样就实现了O(1)查询    整体时间复杂度为O(n^2); #include #include #include using namespace std; ...
分类:其他好文   时间:2015-06-21 15:47:07    阅读次数:116
Unity3D__协同程序
废话不多说直接上代码using UnityEngine;using System.Collections;public class CoroutineDemos : MonoBehaviour { public Transform targetts; public bool ki...
分类:编程语言   时间:2015-06-21 14:20:39    阅读次数:172
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!