一個基于GTK+的單詞數值計算器,1、 按照規則計算單詞的值,如果 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 26個字母(全部用大寫)的值分別為 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26,如: WINJACK這個單詞的值就為:W+I+N+J+A+C+K=23+9+14+1+3+11=71% HARDWORK=H+A+R+D+W+O+R+D=8+1+18+4+23+15+18+11=98% LOVE=L+O+V+E=12+15+22+5=54% LUCK=L+U+C+K=12+21+3+11=47% ATTITUDE= A+T+T+I+T+U+D+E=1+20+20+9+20+24+4+5=100% 2、對程序的界面布局參考如下圖所示,在第一個單行文本框輸入一個單詞,點擊“計算”按鈕,按照以上算法計算出該單詞的值。 3、如果在最下面的單行文本框輸入一個文件路徑,此文件每行記錄一個單詞,那么經過程序計算出各個單詞的值,并把結果輸出到當前目錄下result.txt文件中。如果文件不存在,應該提示錯誤。
上傳時間: 2014-01-11
上傳用戶:康郎
一個能根據心電圖信號產生音樂的matlab程序,根據心電信號P, Q, R, S, 和 T的不同產生不同的音樂,用Midi with Piano tamber使產生的聲音更好聽
上傳時間: 2014-01-26
上傳用戶:日光微瀾
課程設計: 1.求出在一個n×n的棋盤上,放置n個不能互相捕捉的國際象棋“皇后”的所有布局。 2.設計一個利用哈夫曼算法的編碼和譯碼系統,重復地顯示并處理以下項目,直到選擇退出為止。 【基本要求】 1) 將權值數據存放在數據文件(文件名為data.txt,位于執行程序的當前目錄中) 2) 分別采用動態和靜態存儲結構 3) 初始化:鍵盤輸入字符集大小n、n個字符和n個權值,建立哈夫曼樹; 4) 編碼:利用建好的哈夫曼樹生成哈夫曼編碼; 5) 輸出編碼; 6) 設字符集及頻度如下表: 字符 空格 A B C D E F G H I J K L M 頻度 186 64 13 22 32 103 21 15 47 57 1 5 32 20 字符 N O P Q R S T U V W X Y Z 頻度 57 63 15 1 48 51 80 23 8 18 1 16 1
標簽:
上傳時間: 2017-04-24
上傳用戶:zhyiroy
The code performs a number (ITERS) of iterations of the Bailey s 6-step FFT algorithm (following the ideas in the CMU Task parallel suite). 1.- Generates an input signal vector (dgen) with size n=n1xn2 stored in row major order In this code the size of the input signal is NN=NxN (n=NN, n1=n2=N) 2.- Transpose (tpose) A to have it stored in column major order 3.- Perform independent FFTs on the rows (cffts) 4.- Scale each element of the resulting array by a factor of w[n]**(p*q) 5.- Transpose (tpose) to prepair it for the next step 6.- Perform independent FFTs on the rows (cffts) 7.- Transpose the resulting matrix The code requires nested Parallelism.
標簽: iterations performs Bailey number
上傳時間: 2014-01-05
上傳用戶:libenshu01
兩個鏈表的交集 #include<stdio.h> #include<stdlib.h> typedef struct Node{ int data; struct Node *next; }Node; void initpointer(struct Node *p){ p=NULL; } int printlist(struct Node* head){ int flag=1; head=head->next; /* 因為標記1的地方你用了頭結點,所以第一個數據域無效,應該從下一個頭元結點開始 */ if(head==NULL) printf("NULL\n"); else { while(head!=NULL) { if(flag==1) { printf("%d",head->data); flag=0; } else { printf(" %d",head->data); } head=head->next; } printf("\n"); } return 0; } struct Node *creatlist(struct Node *head) { int n; struct Node *p1=(struct Node *)malloc(sizeof(struct Node)); p1->next=NULL; while(scanf("%d",&n),n!=-1) { struct Node *pnode=(struct Node *)malloc(sizeof(struct Node)); pnode->next=NULL; pnode->data=n; if(head==NULL) head=pnode; p1->next=pnode; p1=pnode; } return head; } struct Node *Intersect(struct Node *head1, struct Node *head2) { struct Node *p1=head1,*p2=head2;/*我這里沒有用頭指針和頭結點,這里是首元結點head1里面就是第一個數據,一定要理解什么事頭指針, 頭結點,和首元結點 具體你一定要看這個博客:http://blog.sina.com.cn/s/blog_71e7e6fb0101lipz.html*/ struct Node *head,*p,*q; head = (struct Node *)malloc(sizeof(struct Node)); head->next = NULL; p = head; while( (p1!=NULL)&&(p2!=NULL) ) { if (p1->data == p2->data) { q = (struct Node *)malloc(sizeof(struct Node)); q->data = p1->data; q->next = NULL; p->next = q;//我可以認為你這里用了頭結點,也就是說第一個數據域無效 **標記1** p = q; p1 = p1->next; p2 = p2->next; } else if (p1->data < p2->data) { p1 = p1->next; } else { p2 = p2->next; } } return head; } int main() { struct Node *head=NULL,*headt=NULL,*t; //initpointer(head);//這里的函數相當于head=NULL; // initpointer(headt);//上面已經寫了headt=NULL那么這里可以不用調用這個函數 head=creatlist(head); headt=creatlist(headt); t=Intersect(head,headt); printlist(t); }
標簽: c語言編程
上傳時間: 2015-04-27
上傳用戶:coco2017co
1.Describe a Θ(n lg n)-time algorithm that, given a set S of n integers and another integer x, determines whether or not there exist two elements in S whose sum is exactly x. (Implement exercise 2.3-7.) #include<stdio.h> #include<stdlib.h> void merge(int arr[],int low,int mid,int high){ int i,k; int *tmp=(int*)malloc((high-low+1)*sizeof(int)); int left_low=low; int left_high=mid; int right_low=mid+1; int right_high=high; for(k=0;left_low<=left_high&&right_low<=right_high;k++) { if(arr[left_low]<=arr[right_low]){ tmp[k]=arr[left_low++]; } else{ tmp[k]=arr[right_low++]; } } if(left_low<=left_high){ for(i=left_low;i<=left_high;i++){ tmp[k++]=arr[i]; } } if(right_low<=right_high){ for(i=right_low;i<=right_high;i++) tmp[k++]=arr[i]; } for(i=0;i<high-low+1;i++) arr[low+i]=tmp[i]; } void merge_sort(int a[],int p,int r){ int q; if(p<r){ q=(p+r)/2; merge_sort(a,p,q); merge_sort(a,q+1,r); merge(a,p,q,r); } } int main(){ int a[8]={3,5,8,6,4,1,1}; int i,j; int x=10; merge_sort(a,0,6); printf("after Merging-Sort:\n"); for(i=0;i<7;i++){ printf("%d",a[i]); } printf("\n"); i=0;j=6; do{ if(a[i]+a[j]==x){ printf("exist"); break; } if(a[i]+a[j]>x) j--; if(a[i]+a[j]<x) i++; }while(i<=j); if(i>j) printf("not exist"); system("pause"); return 0; }
上傳時間: 2017-04-01
上傳用戶:糖兒水嘻嘻
本程序的功能是用P-Q分解法進行潮流計算 ,包括個節點電壓、個支路電流及輸送的有功無功,希望大家相互學習相互交流,對大家有幫助!
標簽: 流計算;c語言
上傳時間: 2017-06-09
上傳用戶:東北小妞
用FFT分別計算Xa(n) (p=8, q=2)與Xb(n) (a =0.1,f =0.0625)的16點循環卷積和線性卷積。
上傳時間: 2013-12-09
上傳用戶:lizhizheng88
1) 找出兩個相異的大素數P和Q,令N=P×Q,M=(P-1)(Q-1)。 2) 找出與M互素的大數E,用歐氏算法計算出大數D,使D×E≡1 MOD M。 3) 丟棄P和Q,公開E,D和N。E和N即加密密鑰,D和N即解密密鑰。
標簽: 大素數
上傳時間: 2017-02-05
上傳用戶:lhw888
給定兩個多項式P(x)與Q(x),通過鏈表實現它們的加法。ACM程序設計練習題。
標簽: 多項式
上傳時間: 2014-08-30
上傳用戶:zhuyibin