#include #include #include #include struct Numbered{ //! for ex13.14 Numbered() { static unsigned i = 0; ++i; mySn = i; ...
分类:
其他好文 时间:
2014-08-20 21:01:32
阅读次数:
138
/**
* 功能:public的作用
* 时间:2014年8月20日16:11:23
* 作者:cutter_point
*/
struct A
{
int i;
float f;
char j;
void func();
};
void A::func() {}
struct B
{
public: //这里加和不加的结果是一样的,因为struct默...
分类:
编程语言 时间:
2014-08-20 16:20:22
阅读次数:
194
/**
* 功能:友元
* 时间:2014年8月20日16:13:42
* 作者:cutter_point
*/
/*
*编译器知道如何传递一个地址,这一个地址具有固定的大小,而不管被传递的是什么对象
*然而试图传递整个对象的话,那么编译器就必须知道X的全部定义以确定他的大小以及如何
*传递,所以程序就无法声明一个类似于Y::g(X)的函数,所以下面的f(X*)函数必须是指针
*/
struct...
分类:
编程语言 时间:
2014-08-20 16:20:12
阅读次数:
173
/**
* 功能:探讨private的作用
* 时间:2014年8月20日16:12:35
* 作者:cutter_point
*/
struct B
{
private:
char j;
float f;
public:
int i;
void func();
};
void B::func()
{
i=0;
j='0';
f=0.0;...
分类:
编程语言 时间:
2014-08-20 16:20:02
阅读次数:
196
public static T ObjectToEnum(object o) { try { return (T)Enum.Parse(typeof(T), o.ToString(), true)...
分类:
其他好文 时间:
2014-08-20 15:57:12
阅读次数:
179
题目:你能求得第n个斐波那契数吗?0using namespace std;//矩阵 struct Mta{ int a[2][2];};//矩阵相乘操作,a*b Mta mul(Mta a,Mta b){ Mta c; for(int i=0;i>n) { r...
分类:
其他好文 时间:
2014-08-20 14:05:32
阅读次数:
162
Sort a linked list using insertion sort.1st ( 3 tries)/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next...
分类:
其他好文 时间:
2014-08-20 14:03:52
阅读次数:
172
Sort a linked list inO(nlogn) time using constant space complexity.1st ( 7 tries)/** * Definition for singly-linked list. * struct ListNode { * in...
分类:
其他好文 时间:
2014-08-20 14:03:02
阅读次数:
198
前言:高精度运算,是指参与运算的数(加数,减数,因子……)范围大大超出了标准数据类型(整型,实型)能表示的范围的运算。
模板:包括大数加减乘除,大数与int数的乘法,模板可以不断扩充。
代码:/*
全部亲测可用
*/
const int ten[4]= {1,10,100,1000};
const int maxl = 300;
struct BigNumber
{
int d[max...
分类:
其他好文 时间:
2014-08-20 12:36:03
阅读次数:
290
题意:
给出平面上n个点,找一条直线,使得所有点在直线的同侧,且到直线的距离之平均值尽量小。
先求凸包
易知最优直线一定是凸包的某条边,然后利用点到直线距离公式进行计算。
#include
#include
#include
#include
#include
#include
using namespace std;
struct Point {
in...
分类:
其他好文 时间:
2014-08-20 01:25:55
阅读次数:
202