原创 JAVA面向對象程序設計,董小園 清華大學出版社 課後上機實驗題代碼 第2章

2.1package test;public class Java2_1 { public static void main(String[] args) { Box myBox=new Box(); double myVol,myAre

原创 C語言利用鏈表計算k^N 1

#include "stdafx.h" #include<stdlib.h> struct number{  int num;  struct number *next; }; int _tmain(int argc, _TCHAR* a

原创 出隨機數利用rand函數與延遲時間函數

#include<stdio.h>#include<stdlib.h> #include<windows.h> void main() {  while(true)  {   Sleep(500);           /*暫停5s  S

原创 a c d…… AA AC AD 數據處理

#include "stdafx.h" #include<string.h> int _tmain(int argc, _TCHAR* argv[]) {  char s[21]={"ACDEFGHIKLMNPQRSTVWY"},s1[4

原创 數據處理(蛋白質序列)

#include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) {  int i,j,h;  char str[5000];  FILE *readfile=fopen("F:\\風

原创 利用結構體計算班級平均分,最高分,最低分,不及格等等

#include "stdafx.h" #include <io.h> #include <stdlib.h> struct student{  int num;  int score; }; struct student stus[47

原创 學生成績計算修訂

#include "stdafx.h" #include <io.h> #include <stdlib.h> struct student{  int num;  int score; }; int sign[47]; struct s

原创 C語言從文本文件中用字符串讀取一行數據,然後再依次遍歷字符串將字符串中數據分配。

#include "stdafx.h" #include<string.h> #include<stdlib.h> #include<math.h> FILE *rfile=fopen("D:\\風中追風\\工作量表計算.csv","r"

原创 小球隨機出現在屏幕

#include<stdio.h> #include<stdlib.h> #include<windows.h> void main() {  int i,posX,posY;  while(true)  {   system("cls"

原创 跳動的字符 C

#include<stdio.h> #include<stdlib.h> int main() {   int i,posX=0,posY=0,dirX=1,dirY=1;   while(1)   {    posX=posX+dirX

原创 C語言 產生隨機數

需添加頭文件stdlib.h。隨機函數 int rand(void)。隨機數範圍0<rand()<RAND_MAX(RAND_MAX根據不同的計算機系統值不同)。使用rand()前,需先使用隨機種子數函數 srand()設置隨機數種子,若

原创 實數編碼遺傳算法求解函數最優值

目標函數:JAVA實現,定義了3個類:染色體類,GA類,測試類package test;import java.util.Random;public class Chrome { double[] genes; double fitnes

原创 秦九韶算法

運行環境maltab 2015a clc clear n=4;%表達式最高次數 a=zeros(n+1,1); b=zeros(n+1,1); c=zeros(n,1); a=[2,0,-3,3,-4];%表達式係數 x=-2;%未知量x

原创 銀行家算法

運行環境VS 2010 // banker.cpp : 定義控制檯應用程序的入口點。 // #include "stdafx.h" #include<string.h> typedef struct Max1         // 資源的

原创 C語言實現遺傳算法

算法框架:1. GenerateInitialPopulation();//生成初代種羣2. EvaluatePopulation();//評估種羣3. GenerateNextPopulation();//產生下一代       1).