-
詞法分析程序,可對以下的C源程序進行分析:main() {int a[12] ,sum for(i=1 i<=12 i++) {for(j=1 j<=12 j++)scanf("%d",&a[i][j]) } for(i=12 i>=1 i--){ for(j=12 j>=1 j--){ if(i==j&&i+j==13)sum+=a[i][j] } } printf("%c",sum) }
標簽:
分
程序
上傳時間:
2013-12-26
上傳用戶:skhlm
-
迄今為止,本書已介紹了可在Microsoft Wi n d o w s操作系統中使用的全部網絡A P I函數。
利用這些函數,我們的應用程序可通過網絡,建立與其他程序的通信聯系。在那些討論中,
我們在很大程度上將重點放在七層O S I模型的應用層和表示層上面
標簽:
上傳時間:
2015-07-08
上傳用戶:royzhangsz
-
struts的詳細說明,是struts的經典經驗集合,對于做web開發的技術人員來說恨合適d o dio 哦!感覺寫的恨不錯就發上來了!
標簽:
struts
上傳時間:
2016-01-01
上傳用戶:懶龍1988
-
A salient-boundary extraction software package based on the paper: S. Wang, T. Kubota, J. M. Siskind, J. Wang. Salient Closed Boundary Extraction with Ratio Contour, IEEE Transactions on Pattern Analysis and Machine Intelligence, 27(4):546-561, 2005
標簽:
S.
J.
M.
T.
上傳時間:
2014-01-23
上傳用戶:gonuiln
-
遙控解碼通過電腦串口顯示
/* 晶振:11.0569MHz */
#include <REGX52.h>
#define uchar unsigned char
uchar data IRcode[4] //定義一個4字節的數組用來存儲代碼
uchar CodeTemp //編碼字節緩存變量
uchar i,j,k //延時用的循環變量
sbit IRsignal=P3^2 //HS0038接收頭OUT端直接連P3.2(INT0)
/**************************延時0.9ms子程序**********************/
void Delay0_9ms(void)
{uchar j,k
for(j=18 j>0 j--)
for(k=20 k>0 k--)
}
/***************************延時1ms子程序**********************/
void Delay1ms(void)
{uchar i,j
for(i=2 i>0 i--)
for(j=230 j>0 j--)
}
標簽:
uchar
unsigned
11.0569
include
上傳時間:
2013-12-12
上傳用戶:Breathe0125
-
//初始化
initscr()
//獲得屏幕尺寸
getmaxyx(stdscr, h, w)
//畫背景
for(i=0 i<h i++)
for(j=0 j<w j++){
mvaddch(i, j, ACS_CKBOARD)
}
refresh()
//建立窗口
pad = newpad(80, 128)
for(i=0 i<80 i++){
char line[128]
sprintf(line, "This line in pad is numbered d\n", i)
mvwprintw(pad, i, 0, line)
}
//刷新屏幕
refresh()
prefresh(pad, 0, 1, 5, 10, 20, 45)
for(i=0 i<50 i++){
prefresh(pad, i+1, 1, 5, 10, 20, 45)
usleep(30000)
}
//等待按鍵
getch()
標簽:
getmaxyx
initscr
stdscr
for
上傳時間:
2014-08-30
上傳用戶:龍飛艇
-
嚴格按照BP網絡計算公式來設計的一個matlab程序,對BP網絡進行了優化設計
優化1:設計了yyy,即在o(k)計算公式時,當網絡進入平坦區時(<0.0001)學習率加大,出來后學習率又還原
優化2:v(i,j)=v(i,j)+deltv(i,j)+a*dv(i,j)
標簽:
matlab
yyy
BP網絡
計算公式
上傳時間:
2014-11-30
上傳用戶:妄想演繹師
-
如何編寫讀/寫一個字節的函數呢?
1. 讀一個字節
uchar tmpread(void) //read a byte date 讀一個字節
{
uchar i,j,dat
dat=0
for(i=1 i<=8 i++)
{
j=tmpreadbit()
dat=(j<<7)|(dat>>1) //讀出的數據最低位在最前面,這樣剛好一個字節在DAT里
}
return(dat) //將一個字節數據返回
}
標簽:
uchar
dat
tmpread
read
上傳時間:
2017-09-06
上傳用戶:gengxiaochao
-
實驗源代碼
//Warshall.cpp #include<stdio.h> void warshall(int k,int n) { int i , j, t; int temp[20][20]; for(int a=0;a<k;a++) { printf("請輸入矩陣第%d 行元素:",a); for(int b=0;b<n;b++) { scanf ("%d",&temp[a][b]); } } for(i=0;i<k;i++){ for( j=0;j<k;j++){ if(temp[ j][i]==1) { for(t=0;t<n;t++) { temp[ j][t]=temp[i][t]||temp[ j][t]; } } } } printf("可傳遞閉包關系矩陣是:\n"); for(i=0;i<k;i++) { for( j=0;j<n;j++) { printf("%d", temp[i][ j]); } printf("\n"); } } void main() { printf("利用 Warshall 算法求二元關系的可傳遞閉包\n"); void warshall(int,int); int k , n; printf("請輸入矩陣的行數 i: "); scanf("%d",&k);
四川大學實驗報告 printf("請輸入矩陣的列數 j: "); scanf("%d",&n); warshall(k,n); }
標簽:
warshall
離散
實驗
上傳時間:
2016-06-27
上傳用戶:梁雪文以
-
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NULL 0
#define MaxSize 30
typedef struct athletestruct /*運動員*/
{
char name[20];
int score; /*分數*/
int range; /**/
int item; /*項目*/
}ATH;
typedef struct schoolstruct /*學校*/
{
int count; /*編號*/
int serial; /**/
int menscore; /*男選手分數*/
int womenscore; /*女選手分數*/
int totalscore; /*總分*/
ATH athlete[MaxSize]; /**/
struct schoolstruct *next;
}SCH;
int nsc,msp,wsp;
int ntsp;
int i,j;
int overgame;
int serial,range;
int n;
SCH *head,*pfirst,*psecond;
int *phead=NULL,*pafirst=NULL,*pasecond=NULL;
void create();
void input ()
{
char answer;
head = (SCH *)malloc(sizeof(SCH)); /**/
head->next = NULL;
pfirst = head;
answer = 'y';
while ( answer == 'y' )
{
Is_Game_DoMain:
printf("\nGET Top 5 when odd\nGET Top 3 when even");
printf("\n輸入運動項目序號 (x<=%d):",ntsp);
scanf("%d",pafirst);
overgame = *pafirst;
if ( pafirst != phead )
{
for ( pasecond = phead ; pasecond < pafirst ; pasecond ++ )
{
if ( overgame == *pasecond )
{
printf("\n這個項目已經存在請選擇其他的數字\n");
goto Is_Game_DoMain;
}
}
}
pafirst = pafirst + 1;
if ( overgame > ntsp )
{
printf("\n項目不存在");
printf("\n請重新輸入");
goto Is_Game_DoMain;
}
switch ( overgame%2 )
{
case 0: n = 3;break;
case 1: n = 5;break;
}
for ( i = 1 ; i <= n ; i++ )
{
Is_Serial_DoMain:
printf("\n輸入序號 of the NO.%d (0<x<=%d): ",i,nsc);
scanf("%d",&serial);
if ( serial > nsc )
{
printf("\n超過學校數目,請重新輸入");
goto Is_Serial_DoMain;
}
if ( head->next == NULL )
{
create();
}
psecond = head->next ;
while ( psecond != NULL )
{
if ( psecond->serial == serial )
{
pfirst = psecond;
pfirst->count = pfirst->count + 1;
goto Store_Data;
}
else
{
psecond = psecond->next;
}
}
create();
Store_Data:
pfirst->athlete[pfirst->count].item = overgame;
pfirst->athlete[pfirst->count].range = i;
pfirst->serial = serial;
printf("Input name:) : ");
scanf("%s",pfirst->athlete[pfirst->count].name);
}
printf("\n繼續輸入運動項目(y&n)?");
answer = getchar();
printf("\n");
}
}
void calculate() /**/
{
pfirst = head->next;
while ( pfirst->next != NULL )
{
for (i=1;i<=pfirst->count;i++)
{
if ( pfirst->athlete[i].item % 2 == 0 )
{
switch (pfirst->athlete[i].range)
{
case 1:pfirst->athlete[i].score = 5;break;
case 2:pfirst->athlete[i].score = 3;break;
case 3:pfirst->athlete[i].score = 2;break;
}
}
else
{
switch (pfirst->athlete[i].range)
{
case 1:pfirst->athlete[i].score = 7;break;
case 2:pfirst->athlete[i].score = 5;break;
case 3:pfirst->athlete[i].score = 3;break;
case 4:pfirst->athlete[i].score = 2;break;
case 5:pfirst->athlete[i].score = 1;break;
}
}
if ( pfirst->athlete[i].item <=msp )
{
pfirst->menscore = pfirst->menscore + pfirst->athlete[i].score;
}
else
{
pfirst->womenscore = pfirst->womenscore + pfirst->athlete[i].score;
}
}
pfirst->totalscore = pfirst->menscore + pfirst->womenscore;
pfirst = pfirst->next;
}
}
void output()
{
pfirst = head->next;
psecond = head->next;
while ( pfirst->next != NULL )
{
// clrscr();
printf("\n第%d號學校的結果成績:",pfirst->serial);
printf("\n\n項目的數目\t學校的名字\t分數");
for (i=1;i<=ntsp;i++)
{
for (j=1;j<=pfirst->count;j++)
{
if ( pfirst->athlete[j].item == i )
{
printf("\n %d\t\t\t\t\t\t%s\n %d",i,pfirst->athlete[j].name,pfirst->athlete[j].score);break;
}
}
}
printf("\n\n\n\t\t\t\t\t\t按任意建 進入下一頁");
getchar();
pfirst = pfirst->next;
}
// clrscr();
printf("\n運動會結果:\n\n學校編號\t男運動員成績\t女運動員成績\t總分");
pfirst = head->next;
while ( pfirst->next != NULL )
{
printf("\n %d\t\t %d\t\t %d\t\t %d",pfirst->serial,pfirst->menscore,pfirst->womenscore,pfirst->totalscore);
pfirst = pfirst->next;
}
printf("\n\n\n\t\t\t\t\t\t\t按任意建結束");
getchar();
}
void create()
{
pfirst = (struct schoolstruct *)malloc(sizeof(struct schoolstruct));
pfirst->next = head->next ;
head->next = pfirst ;
pfirst->count = 1;
pfirst->menscore = 0;
pfirst->womenscore = 0;
pfirst->totalscore = 0;
}
void Save()
{FILE *fp;
if((fp = fopen("school.dat","wb"))==NULL)
{printf("can't open school.dat\n");
fclose(fp);
return;
}
fwrite(pfirst,sizeof(SCH),10,fp);
fclose(fp);
printf("文件已經成功保存\n");
}
void main()
{
system("cls");
printf("\n\t\t\t 運動會分數統計\n");
printf("輸入學校數目 (x>= 5):");
scanf("%d",&nsc);
printf("輸入男選手的項目(x<=20):");
scanf("%d",&msp);
printf("輸入女選手項目(<=20):");
scanf("%d",&wsp);
ntsp = msp + wsp;
phead = (int *)calloc(ntsp,sizeof(int));
pafirst = phead;
pasecond = phead;
input();
calculate();
output();
Save();
}
標簽:
源代碼
上傳時間:
2016-12-28
上傳用戶:150501