MSDS物质安全资料表查询系统

更新时间:2024-03-02 15:11:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

MSDS物質安全資料表查詢系統

應化二 91324006 林群欽 應化二 91324009 孫念祖 應化二 91324012 姚俊賓 應化二 91324024 蔡筱嬪 應化二 91324027 張哲瑋

前言

MSDS記錄了各種化學物質基本的物理化學性質及危險程度等各種資訊,在安全的考量下,每次實驗的藥品,都需查詢MSDS資料表。此系統的設計,用途是在於增加查詢的便利性。

系統簡介

主要功能分為兩部份 1. 查詢資料

? 依化合物名稱查詢 ? 依分子量查詢

依所含化學元素查詢

? 依基本化學實驗內容查詢 2. 系統管理

? 新增資料 ? 刪除資料

以下列出系統所處理的輸入及輸出檔案介紹及欄位說明: ? 化合物名稱 ? 所含元素1 ? 所含元素2

?

? ? ? ? ? ?

所含元素3 所含元素4 所含元素5 所含元素6 分子量

MSDS資料庫網址

例:含有5筆資料的資料檔(compounds.txt)

Hydrochloric_Acid H Cl X X X X 36.5

http://ptcl.chem.ox.ac.uk/MSDS/HY/hydrochloric_acid.html

Thioacetamide C H N S X X 75.13 http://www.jtbaker.com/msds/englishhtml/t2639.htm

Oxalic_Acid C H O X X X 90.03 http://www.jtbaker.com/msds/englishhtml/o6044.htm

Stannous_Chloride Cl Sn X X X X 189.62 http://www.jtbaker.com/msds/englishhtml/s6434.htm

Ammonium_Nitrate H N O X X X 80.04 http://ptcl.chem.ox.ac.uk/MSDS/AM/ammonium_nitrate.html 備註

元素1~6,這是化合物中所含的元素種類,在此系統中所含元素種類的

上限為6種,若不足6種,則以X表示之,因為化學元素之代號並無X。

使用說明

執行程式後

顯示下列選擇:

1.查詢藥品 2.藥品資料管理 3.結束

依使用需求選擇,以下依序介紹: 1.查詢藥品 進入此選項後會顯示下列選擇: 1.依全名查詢 2.依分子量查詢 3.依實驗內容查詢 4.依所含元素查詢 5.回 主選單 6.結束

依使用需求選擇,以下依序介紹 1.依全名查詢 請依照IUPAC命名法則輸入化合物名稱,空白則以 ” _ ” 代替。 2.依分子量查詢 請輸入分子量,由於不同週期表所標示之原子量有些微誤差,所以與 資料庫內資料,誤差正負0.5皆接受。 3.依實驗內容查詢 內建了幾個簡單實驗 會列出所需藥品及其網址。

4.依所含元素查詢

請輸入化合物所含元素的元素符號查詢。 5.回主選單 也就是回到上一層的選單。 6.結束 結束程式。

2.藥品資料管理: 進入此選項後會顯示下列選擇: 1.新增資料 2.刪除資料 3.結束 依使用需求選擇,以下依序介紹。

1.新增資料 先輸入化合物之名稱,確認沒有重複輸入後,接著輸入,所含元 素之化學符號,共六個,若未達六個則以X代替,再輸入分子量

及網址。

2.刪除資料 輸入欲刪除之資料名稱即可。 3.結束 結束程式。 3.結束: 結束程式。

資料結構說明 查詢資料庫 元素名稱 元素1 元素2 元素3 元素4 元素5 元素6 分子量 網址

char compound[40] char atom1[3] char atom2[3] char atom3[3] char atom4[3] char atom5[3] char atom6[3] float FM char link[100] 流程圖及程式碼

總流程圖 #include #include #include struct compounds { char compound[40]; 開始 a=1 refer() 查詢藥品 輸入選項a 輸入選項a If 1<=a<=6 If 1<=a<=3 no yes no a=1 searchcompound() yes 依化合物名稱查詢 a=2 searchFM() 依分子量查詢 a=3 結束 a=3 experiment() 依實驗內容查詢 a=4 meterial() 依所含元素查詢 a=6 a=5 a=2 control() 資料管理 做不出來XD char atom1[3]; char atom2[3]; char atom3[3]; char atom4[3]; char atom5[3]; char atom6[3]; float FM; char link[100]; }; int p; char outlink[100]; int strcmp(const char *s1, const char *s2); int ReadFile(struct compounds thecompound[]); void searchFM(void); int searchcompound(void); void experiment(void); void meterial(void); void refer(void); void control(void); void addcompound(void); int delcompound(void); int main() { int a; while( a != 3 ) { printf(\歡迎使用MSDS資料查詢系統\\n\\n\\n\\n\\n\\n\ printf(\請輸入指令\\n\ printf(\查詢藥品 2.藥品資料管理 3.結束\\n\ printf(\請輸入選項:\ scanf(\ if(1<=a&&a<=3) { switch(a)

{ int n; struct compounds thecompound[256]; FILE* compoundsfile; compoundsfile=fopen(\ ReadFile(thecompound); printf(\下列為目前已建檔的實驗名稱及編號:\\n\ printf(\化合物化學式之決定\\n\ printf(\溫度計校正及可溶性物質分子量之測定\\n\ printf(\反應熱之測定\\n\ printf(\亨利定律常數之測定\\n\printf(\維生素C之定量\\n\printf(\請輸入欲查詢之實驗編號:\scanf(\if( n>=1 && n<=5) { printf(\本實驗所用之藥品如下:\\n\ switch(n) { case 1: printf(\ 抱歉!本資料尚未建檔\\n\ printf(\ http://ptcl.chem.ox.ac.uk/MSDS/HY/hydrochloric_acid.html\\n\ printf(\ 抱歉!本資料尚未建檔\\n\ printf(\抱歉!本資料尚未建檔\\n\ printf(\ 抱歉!本資料尚未建檔\\n\ break; case 2: printf(\ 抱歉!本資料尚未建檔\\n\ printf(\ 抱歉!本資料尚未建檔\\n\ break; case 3: printf(\ http://ptcl.chem.ox.ac.uk/MSDS/SO/sodium_hydroxide.html\\n\ printf(\ http://ptcl.chem.ox.ac.uk/MSDS/HY/hydrochloric_acid.html\\n\ printf(\ 抱歉!本資料尚未建檔\\n\ printf(\ 抱歉!本資料尚未建檔\\n\ printf(\ 抱歉!本資料尚未建檔\\n\ printf(\ 抱歉!本資料尚未建檔\\n\ printf(\ 抱歉!本資料尚未建檔\\n\ printf(\ 抱歉!本資料尚未建檔\\n\ break; case 4: printf(\ 抱歉!本資料尚未建檔\\n\ break; case 5: printf(\ 抱歉!本資料尚未建檔\\n\ printf(\ http://ptcl.chem.ox.ac.uk/MSDS/HY/hydrochloric_acid.html\\n\ printf(\ http://www.chem.tamu.edu/class/majors/msdsfiles/msdspotassiumiodate.htm\\n\ printf(\ http://www.jtbaker.com/msds/englishhtml/p5895.htm\\n\ printf(\ 抱歉!本資料尚未建檔\\n\ break; } } else { printf(\沒有此筆資料請重新查詢\\n\ } } void meterial() { int i,n, m1, m2, m3, m4, m5, m6; struct compounds thecompound[256]; char B[40]; FILE* compoundsfile; int no = 0; compoundsfile=fopen(\ n=ReadFile(thecompound); printf(\請輸入化合物所含之元素:\ scanf(\ for(i=0;i<=n;i++) { m1=strcmp((thecompound[i].atom1), B); m2=strcmp((thecompound[i].atom2), B); m3=strcmp((thecompound[i].atom3), B); m4=strcmp((thecompound[i].atom4), B); m5=strcmp((thecompound[i].atom5), B); m6=strcmp((thecompound[i].atom6), B); if( m1 == 0 ) { printf(\ %s\\n\ no = 1; } else if( m2 == 0 ) { printf(\ %s\\n\ no = 1; } else if( m3 == 0 ) { printf(\ %s\\n\ no = 1; } else if( m4 == 0 ) { printf(\ %s\\n\ no = 1; } else if( m5 == 0 ) { printf(\ %s\\n\ no = 1; } else if( m6 == 0 ) { printf(\ %s\\n\ no = 1; } } if( no == 0 ) { printf(\沒有此筆資料請重新查詢\\n\ } } void addcompound() { int i,n,m = 1,p; int match = 0; struct compounds thecompound[256]; char B[40]; FILE* compoundsfile; fprintf(stderr,\ compoundsfile = fopen(\ n=ReadFile(thecompound); fclose(compoundsfile); p=n; printf(\請輸入化合物名稱:\ scanf(\ for(i=0;i

printf(\請輸入化合物MSDS資料表之聯結:\ scanf(\ compoundsfile=fopen(\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fclose(compoundsfile); } } int delcompound() { int i,n,m,k; struct compounds thecompound[256]; char B[40]; FILE* compoundsfile; n=ReadFile(thecompound); compoundsfile=fopen(\ printf(\請輸入欲刪除之化合物名稱:\ bzero(B,40); scanf(\ i = 0; for(i = 0; i < n; i++) { fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ } fclose(compoundsfile); compoundsfile=fopen(\ for(k = 0;k < i;k++) { if( (m = strcmp((thecompound[k].compound),B)) != 0) { fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ fprintf(compoundsfile,\ } else { fprintf(stderr,\已將此化合物刪除\\n\ } } fclose(compoundsfile); return 0; }

main()流程圖 int main() { int a; while( a != 3 ) { printf(\歡迎使用MSDS資料查詢系統\\n\\n\\n\\n\\n\\n\ printf(\請輸入指令\\n\ printf(\查詢藥品 2.藥品資料管理 3.結束\\n\ printf(\請輸入選項:\開始 a=1 refer() 查詢藥品 輸入選項 a=2 control() 資料管理 If 1

refer()流程圖 void refer() { int a = 1,n; struct compounds thecompound[256]; while( a >= 1 && a <= 6 ) { 開始 a=1 searchcompound() 依化合物名稱查詢 searchFM() 依分子量查詢 experiment() 依實驗內容查詢 meterial() 依所含元素查詢 main() 回主選單 結束 輸入選項 a=2 a=3 If 1

printf(\請輸入指令\\n\ printf(\依全名查詢 2.依分子量查詢 3.依實驗內容查詢 4.依所含元素查詢 5.\\n\\t\\t回主選單 6.結束\\n\ printf(\請輸入選項:\ scanf(\ if( a>=1 && a<=6 ) { switch (a) { case 1: searchcompound(); break; case 2: searchFM(); break; case 3: experiment(); break; case 4: meterial(); break; case 5: a = 0; break; case 6: exit(0); break; } } else { printf(\類別錯誤!\\n\ } } }

control()流程圖 void control() { int a = 1; while( a != 4 ) { printf(\增加資料 2.刪除資料 3.回主選單 4.結束\\n\ printf(\請輸入選項:\ a = 0; scanf(\ if(( a >= 1) && ( a <= 4 )) { switch(a) 開始 此功能開發中 敬請期待唷 乖...不要哭^^ main() 回主選單 { case 1: addcompound(); break; case 2: delcompound(); printf(\ break; case 3: a =4; break; case 4: exit(0); break; } } else { printf(\類別錯誤!\\n\ a = 0; } } }

ReadFile流程圖 int ReadFile(struct compounds thecompound[]) { int i = 0; FILE* compoundsfile; compoundsfile = fopen(\ 判斷檔案裡是否還有未讀入之資料 開始 i=0,fileend=0 no

yes i = i+1 讀入檔案資料自compounds.txt return i 傳回共有幾組數量 while(feof(compoundsfile) == 0) { fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ fscanf(compoundsfile,\ }

i++; } fclose(compoundsfile); return i;

for(i=0;i

本文来源:https://www.bwwdw.com/article/7ifa.html

Top