#include
#include
#define INFINITY 32768
#define VERTEX_MAX 50
using namespace std;
typedef char VertexType; //顶点类型
typedef int AdjType; //边的关系类型
typedef struct {
VertexType...
分类:
编程语言 时间:
2015-06-23 21:35:35
阅读次数:
120
以下代码可能需要一定的c/c++基础。
common.h
#pragma once
typedef int (*pt)(void);
void init_2();
2.cpp
#include
#include "common.h"
using namespace std;
static pt next_pt;
extern pt top_pt;
int filter_2...
分类:
其他好文 时间:
2015-06-23 20:09:00
阅读次数:
137
问题描述:
【项目1-平方根中的异常】
编写一个程序,求输入数的平方根。设置异常处理,当输入负数时采用异常处理机制给出提示。
代码实现:
#include
#include
#include
using namespace std;
int main(){
double a;
try{
printf("请输入一个数:");
s...
分类:
编程语言 时间:
2015-06-23 20:08:53
阅读次数:
188
问题描述:
项目2-有些数的阶乘不算了
求n!的函数,当用户的输入为负数,以及输入数太大时(例如大于12),使用异常处理机制予以拒绝,并给出恰当的提示。
代码实现:
#include
#include
using namespace std;
int main(){
int n;
try{
printf("请输入一个数:");
...
分类:
编程语言 时间:
2015-06-23 20:07:10
阅读次数:
137
头文件:
#include
using namespace std;
#define MAX 10
typedef struct
{
int r[MAX+1];
}Sqlist;
// 比较大小并插入
void InsertSort(Sqlist &sl, int n)
{
int j;
for (int i = 2; i < 7; ++i)
{
if (sl.r[i...
分类:
编程语言 时间:
2015-06-23 20:06:28
阅读次数:
403
using UnityEngine;using System.Collections;public class TweenFlipCARDS : MonoBehaviour{ /// 牌正面 public GameObject positive; /// 牌背面 pu...
分类:
其他好文 时间:
2015-06-23 19:39:29
阅读次数:
116
首先添加 引用:using System.Data;using MySql.Data.MySqlClient;代码: 这里只写了 后台代码Mysql 连接和sql 连接代码几乎一样 只要把 MySqlCommand com = new MySqlCommand(sqlin,con); 类似的MySQ...
分类:
数据库 时间:
2015-06-23 19:37:58
阅读次数:
196
唉………………写的相当的乱,状态十分不好。
可以求每个数前面有多少个magic number,然后相减即可。
#include
#include
using namespace std;
int num(int x)
{
int sum=0;
while(x>0)
{
sum++;
x/=10;
}
return su...
分类:
其他好文 时间:
2015-06-23 18:06:47
阅读次数:
92
最小生成树kruscal算法
#include
#include
#include
#define maxn 10005
using namespace std;
struct stu
{
int x,y;
int t;
};
stu mapp[maxn];
int f[1005];
int n,m,k,sum,flag;
bool cmp(stu x,stu y)
{
return x....
分类:
其他好文 时间:
2015-06-23 18:02:53
阅读次数:
81
头文件:
#include
using namespace std;
#define MAX 10
typedef struct
{
int r[MAX];
}Sqlist;
// 交换两个数
void swap(int &a, int &b)
{
int temp = a;
a = b;
b = temp;
return;
}
// 比较大小
void Inser...
分类:
编程语言 时间:
2015-06-23 17:51:43
阅读次数:
106