語言學習1:日期顯示,C

編寫一個函數,要求輸入年月日時分秒,輸出該年月日時分秒的下一秒。如輸入 2004 年 12 月 31 日 23  時59 分 59 秒,則輸出 2005 年 1 月 1 日 0 時 0 分 0 秒。//year.month.day.hour.minute.second#include <stdio.h>void Nexttime(int *year,int *month, int *data,int *hour,int *minute,int *second){ int day; (

棋盤類實現檔案C++

 //Chessboard.cpp#include "stdafx.h"#include "Chessboard.h"//private:int Chessboard ::m_weightValue (void){int weightValue = rand() % m_aLargeWeightValue - (m_aLargeWeightValue >> 1) ;return weightValue ;}int Chessboard ::m_absoluteValue

方程近似求解C++

    看數學書看到的.居然還是某年的軟考程式員下午題.很輕鬆地寫出來了,挺有意思.//solveEquation.cpp -- 2011-07-19-01.05#include <iostream>#include <cmath>double absoluteValue (const double valA, const double valB) ;double equation (const double x) ;double solveEquation

二叉搜尋樹中序線索化實現檔案C語言

/*threaded_tree.c -- 線索樹實現檔案*/#include <stdio.h>#include <stdlib.h>#include "threaded_tree.h"/*局部函式宣告*/static Node * Make_Node (const Item * const pitem) ;static int Left_Is_Greater_Than_Right (const Item left, const Item right) ;static

二項隊列實現檔案C語言

/*binomial-queue.c -- 二項隊列實現檔案*/#include "binomial-queue.h"/*局部函式宣告*/static SubTree Combine_Trees (SubTree t1, SubTree t2) ;static Node * Make_Node (const Item item) ;static void Recursively (const SubTree t, void (* pfun) (const Item item))

二叉搜尋樹實現檔案C語言(BinarySearchTree.c)

/* BinarySearchTree.c -- 二叉搜尋樹實現檔案 */#include <stdio.h>#include <stdlib.h>#include "BinarySearchTree.h"/* 局部函式宣告 */int Left_Is_Less_Than_Right (const Item left, const Item right) ;int Left_Is_More_Than_Right (const Item left, const Item

希爾排序C語言

/*7-4-11-19-19.58.c -- 第七章第四題*/#include <stdio.h>#include <stdlib.h>#define SIZE 9int main (void) ;void print_array (const int * array, const int size) ;void shell_sort (int * array, const int size) ;int main (void){int array[SIZE] = {9,

將圖讀進鄰接表實現檔案C語言

/*adjacenty_list.c -- 鄰接表實現檔案*/#include <stdio.h>#include <stdlib.h>#include "adjacenty_list.h"/*局部函式宣告*/Vertex * Make_Vertex (const Name vertex) ;/*介面函數定義*/int CreateAdjacent_List (Adjacent_List * const padj, const int capacity){int

最大產生樹演算法C語言

  只是將演算法的主常式邊的權值改為異號的,即可完成這個演算法.我的初衷是將最小堆改成最大堆.但事實證明,這是行不通的.貼代碼./*9-20-12-22-11.16.c -- 第九章第二十題*/#include <stdio.h>#include <stdlib.h>#include "binary_heap_for_kruskal.h"#include "disjiont_set.h"#define SIZE (10)int main (void) ;void

棧數組實現實現檔案C語言

/*stack.c -- 棧實現檔案*/#include <stdio.h>#include <stdlib.h>#include "stack.h"/*介面函數定義*/int Initialize_S (Stack * const pstack, const int capacity){if (capacity <= 0)return 0 ;*pstack = (struct stack *) malloc (sizeof (struct stack)) ;if

2-d樹標頭檔C語言

  2-d樹,昨天寫的.今天本想來好好玩會球,不想玩了一小會就散夥了.於是來上會網.  這個東西,支援二維的範圍尋找,十分有用.關於最佳化的部分,我並不承認.我覺得我所知的那種最佳化方式開銷太大,而且實現十分困難,於是沒有去實現.寫的這套ADT很不錯,關於範圍尋找非遞迴的實現,我想到了層序遍曆,這真是一個好主意,我都為自己高興,覺得自己的想法很到位.事實證明,問題也確實依次解決的,很不錯,很不錯.呵呵. 

計算有向非循環圖中兩個結點的路徑數C++

   路徑搜尋,搜尋到目標結點的時候算作一條路徑.不會有兩條一致的路徑,但兩條不同的路徑可以有相同的部分.  同樣只是給出了函數定義,貼.//2011-08-19-21.14 -- 2011-08-19-21.36 by Golden_Shadow.//------------------------------------------------------------------------------------int graphRepresentAsAdjacentMatrix ::m_

所有頂點間最短路徑FloydWarshall演算法主常式C++

   這個東西,是新學的.上一本書雖然有學過圖,但是,這個問題還是沒有學到,這一次,學到了.前前後後2天,寫出來了.  最近的主要精力在C++與<<Windows via>> 還有 線性代數,演算法的東西實在是前進得不多.  還好,通過今天上午的努力,知道自己的腦袋,還沒有退化.真的,每次實現了一個演算法,都興奮得不得了,確實啊,呵呵.//graph.cpp#include "stdafx.h"#include

區間樹標頭檔C++

  區間樹.同樣是一種在二叉樹的基礎上擴充出來的資料結構.每個結點儲存了區間資訊.  這個常式,主要是為了接下來的東西而寫的.當然了,它本身也是很久價值的.//intervalTree.h -- 區間樹標頭檔#include <iostream>namespace tree{typedef int Item ;typedef struct node{Item min, max ;Item maxOfAll ;int number ;struct node * left, *

有向非循環圖單源點最短路徑C++

   有向非循環圖上的單源點最短路徑演算法,用到了拓撲排序,很好的思想.  給出了用到的函數,貼出來咯.//DAGShortestPathCalculate.cpp -- 2011-09-05-18.35//private methods declare.void m_initializeSingleSource (int sourceVertex) ;int m_distanceBetweenTwoVertexes (int startVertex, int endVertex) ;void

泛型隊列驅動常式C++

   看<<C++ Primer>>看到的,這東西,內容是真多,慢慢看吧,也快看完了.最近兩天籌備一周年的文章了,希望能有些技術含量,期待吧.都要我去做,呵呵,我完全可以.// testMyself.cpp -- 2011-09-24-15.19#include "stdafx.h"#include "queue.h"const int Size = 10 ;int _tmain(int argc, _TCHAR* argv[]){int arr[Size] = {1,

棋盤類標頭檔C++

//Chessboard.h#include <iostream>#include <cstdlib>#include <ctime>#include "Chessman.h"//Ignore examining parameter and error.class Chessboard: private Chessman{private:Chessman * * m_chessboard ;m_Direction * *

K個有序鏈表共N個結點在O(NlgK)時間合并為一個新的有序鏈表標頭檔C語言

  <<演算法導論>>上的一道思考題,昨天實現的.用到了優先隊列.鏈表我給實現成了隊列的方式,比較習慣這樣.呵呵.  在這個標頭檔中,定義了兩個資料結構的資料類型和宏,這是第一次嘗試.中途遇到過問題,

全排列列印C++

   這個東西,實在實在是說不好.在前一段的時候,考慮別的問題的時候想到這個問題.自己研究了下,又上網看了一下,總算是有了個結果.至於更深入的,也沒有去考慮.這個死角,觸到了就好.  最近重點Win32API,演算法方面內容不多.不過,過一陣應該會多起來吧.  貼.// wholePermutation.cpp -- 2011-07-16-13.43#include "stdafx.h"#include <iostream>const int SIZE = 4 ;//Use

C# Action 委託 + lambda 運算式

using System;using System.Collections;public class Test{ static public Action A; static public Action<int> B; static public Action<int, string> C; static public Action<int, string, int> D; static public Action<int,

總頁數: 4314 1 .... 2008 2009 2010 2011 2012 .... 4314 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.