




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、輸入a,b求c = a + busing System;using ; namespace Proj2_1一class Programstatic void Main( string 口 args) int a, b, c;("a:");a =();("b:");b =();c = a + b;("a+b=0" , c);:4 Fermi0回-using System;using ;using ;using ;using ;using Proj2_2public partial class Form1 : Form public Fo
2、rm1() InitializeComponent();private void button1_Click( object sender, EventArgs e)一int a, b, c;a =; b =;c = a + b;=(c); private void Form1_Load( object sender, EventArgs e)一private void textBox2_TextChanged( object sender, EventArgs e) 強制轉(zhuǎn)換P38using System;using ;namespace Proj3_1一class Program stat
3、ic void Main( string 口 args) int i=65,i1,i2;double d = ,d1,d2;char c = 'A' ,c1,c2;("i=0:d5,d=1:f,c=2", i, d, c);i1 = (int )d;MainMainMainMainMainMainMainMainMainMainMainMainMainMainMainMainMainoString(); break ; case "button14" :oString();break ;case "button15"
4、:oString();break ;I JellZOE BSZOIZI SScase "button16" : oString(); break ; =; 模式窗體,無模式窗體調(diào)用using System;using ;using ; using ; using ;using Proj8_1public partial class Forml : Form public Form1()InitializeComponent();private void button1_Click( object sender, EventArgs e)Form myform = new F
5、orm1_1();();o = 1; ="王華";stud.sex ="男";stud0.rq =new DateTime(1980,2,10);stud0.sclass ="99091"stud1.no = 2; ="李強stud1.sex ="男";stud1.rq =new DateTime(1981,10,4);stud1.sclass ="99101"stud2.no = 3; ="張麗stud2.s
6、ex ="女"stud2.rq =new DateTime(1980,3,2);stud2.sclass ="99091"stud3.no = 4; ="汪洋stud3.sex ="男";stud3.rq =new DateTime(1980,1,5);stud3.sclass ="99101"stud4.no = 5; ="江華stud4.sex ="男";I -|Z=1 |1:&皿工IllLalloKSLiJstud4.
7、rq =new DateTime(1980,3,10); stud4.sclass =stud5.no = 6; ="李英" ;stud5.sex =stud5.rq =new DateTime(1980,6,2); stud5.sclass =stud6.no = 7; ="胡軍"stud6.sex =stud6.rq =new DateTime(1981,10,9); stud6.sclass =stud7.no = 8; ="劉馳"stud7.sex =stud7
8、.rq =new DateTime(1982,5,2); stud7.sclass =stud8.no = 9; ="宋仁"stud8.sex =stud8.rq =new DateTime(1980,8,3); stud8.sclass =stud9.no = 10; ="許兵"stud9.sex =stud9.rq =new DateTime(1980,11,8); stud9.sclass =o)i = i + 1; if (i >= 10) ("沒有該學號的記錄");else&
9、quot;99091""女";"99101""男";"99091""女";"99101""男";"99101""男";"99091"=studi.(); ame;=studi.sex;=studi.sclass;=studi.(); private void groupBox2_Enter( object sender, EventArgs e) 設(shè)計下拉菜單實現(xiàn)兩個數(shù)的加,減,乘,除。
10、P207using System;using ;using ;using ;using ;using Proj9_1 public partial class Form2 : Form public Form2() InitializeComponent();private void addop_Click( object sender, EventArgs e) int n;n = + ;=();privatevoid subop_Click(object sender,EventArgs e)int n;=();object sender,EventArgs e)private void
11、mulop_Click(一int n; n = * ; =();privatevoid divop_Click(object sender,EventArgs e)int n;n = / ;= ();private void op_Click( object sender, EventArgs e) if ="" | = 0)=false ;else=true ;private void menuStrip1_ItemClicked( object sender, ToolStripItemClickedEventArgs e) 以下是彈出式菜單實現(xiàn)上題using Syst
12、em;using ;using ;using ;using ;using Proj9_1public partial class Form4 : Formpublic Form4()InitializeComponent();private void addop_Click( object sender, int n;n = +EventArgs e)J= ();private void subop_Click( object sender, int n;n = -EventArgs e)J= ();privatevoidmulop_Click(objectsender,EventArgse)
13、int n = *n;= ();private void divop_Click( object sender, EventArgs e)一int n; n = / ; =(); private void op_Opened( object sender, EventArgs e)一if ="" | = 0)=false ;else =true ;private void Form4_Load( object sender, EventArgs e) P215設(shè)計一個窗體,用于打開用戶指定文件,并將其放到另外的同類文using System;using ;using ; u
14、sing ; using ; using Proj9_1 public partial class Form5 : Form public Form5() InitializeComponent();private void button1_Click( object sender, EventArgs e)一="» ;="RTF File(*.rtf)|*.RTF|TXT FILE(*.txt)|*.txt"();if !="") switchcase 1:tf類型break ;case 2:xt 類型,;break ;= true
15、 ;private void button2_Click( object sender, EventArgs e) = "RTF File(*.rtf)|*.RTF|TXT FILE(*.txt)|*.txt"if () =switchcase 1: tf 類型,;break ;case 2: xt 類型,;break ; private void Form5_Load( object sender, EventArgs e) =true ;=false ;設(shè)計一個窗體,顯示節(jié)點及子節(jié)點功能P224using System;using ;using ;using ;usin
16、g ;using Proj9_1public partial class Form6 : Form public Form6()InitializeComponent();private void Form6_Load( object sender, EventArgs e)=imageListl; mageindex = 0;0.SelectedImageIndex = 0;0.("一年級");0.Nodes0.ImageIndex = 1;0.Nodes0.SelectedImageIndex = 1;0.Nodes0.("0701 班");0.No
17、des0.Nodes0.ImageIndex = 2;0.Nodes0.Nodes0.SelectedImageIndex = 2;0.Nodes0.("0702 班");0.Nodes0.Nodes1.ImageIndex = 2;0.Nodes0.Nodes1.SelectedImageIndex = 2;0.("二年級");0.Nodes1.ImageIndex = 1;0.Nodes1.SelectedImageIndex = 1;0.Nodes1.("0601 班");0.Nodes1.Nodes0.ImageIndex =
18、 2;0.Nodes1.Nodes0.SelectedImageIndex = 2;0.Nodes1.("0602 班");0.Nodes1.Nodes1.ImageIndex = 2;0.Nodes1.Nodes1.SelectedImageIndex = 2;"電子工程系");();"豹子);0.(0.(0.(0.(0.("老虎");"北極熊”);"狼");"大象");"犀牛");"魚類" );1.("鯊魚");
19、1 .("熱帶魚");1 .("金魚");"鳥類" );2 .("天鵝");2 .("貓頭鷹");2 .("翠鳥");private void treeView1_AfterSelect( object sender, TreeViewEventArgs e) string s;5 = imageList1;= imageList2;switch (s)case " 哺乳動物" :" 豹子" , 0);" 老虎" ,
20、 0);" 北極熊 " , 0);"狼 ", 0);" 大象" , 0);" 犀牛" , 0);break ;case " 魚類 " :" 鯊魚" , 0);" 熱帶魚 " , 0);" 金魚" , 0);break ;case " 鳥類 " :" 天鵝" , 0);" 貓頭鷹 " , 0);" 翠鳥" , 0);break ;privatevoidmenu
21、1_Click(objectsender,EventArgse)privatevoidmenu2_Click(objectsender,EventArgse)privatevoidmenu3_Click(objectsender,EventArgse)private void menu4_Click( object sender, EventArgs e)繪制兩個矩形,一個藍色邊框,一個紅色邊框。P254using System;using ;using ;using ;using ;using Proj10_2public partial class Form1 : Formpublic F
22、orm1()InitializeComponent();private void Form1_Paint( object sender, PaintEventArgs e) Graphics gobj=();Pen bluePen = new Pen, 5);Pen redPen = new Pen, 5);Rectangle myRectangle = new Rectangle (50, 50, 100, 80);(bluePen, 30, 20, 100, 80);(redPen, myRectangle);private void Form1_Load( object sender,
23、EventArgs e) 繪制兩個填充餅形構(gòu)成的橢圓。P254using System;using ;using ;using ;using ;using Proj10_2public partial class Form2 : Formpublic Form2()InitializeComponent();private void Form2_Paint( object sender, PaintEventArgs e) Graphics gobj = ();double PI = ;, 30, 30, 130, 80, 0, 300);, 30, 30, 130, 80, 0, -60);
24、private void Form2_Load( object sender, EventArgs e)繪制一個帶邊的填充橢圓P254using System;using ;using ;using ;usingusing ;using Proj10_2public partial class Form3 : Formpublic Form3()InitializeComponent();private void Form3_Paint( object sender, PaintEventArgs e) Graphics gobj = ();HatchBrush myBrush = new H
25、atchBrush , ;Pen myPen = new Pen, 8);(myPen, 20, 20, 150, 100);(myBrush, 20, 20, 150, 100);private void Form3_Load( object sender, EventArgs e)分別在窗體上畫一個直線,一個圓,一個文本P254using System; using ; using ; using ; using ;using Proj10_2FormI畫施1 畫形狀 畫文本一public partial class Form5 :public Form5() InitializeComp
26、onent(); object sender,EventArgs e)Graphics gobj =();object sender,EventArgs e)Graphics gobj =();(30, 30, 100, 100);object sender, EventArgs e)private void button1_Click(一Pen myPen = new Pen (myPen, 30, 30, 120, 120);private void button2_Click( Pen myPen = new Pen (myPen,new Rectangleprivate void bu
27、tton3_Click(一Graphics gobj =();string drawString ="使用 DrawString 方法";Font myFont = new Font ("黑體",16);Brush b = new SolidBrushfloat x =;float y =;StringFormat myFormat = new StringFormat ();(drawString, myFont, b, x, y, myFormat); private void Form5_Load( object sender, EventArgs
28、 e) 在列表框中顯示所有學生的學號,姓名,課程名和分數(shù)。按學號次序排歹限P349using System;using ; using ; using ; using ; using Proj13_2一public partial class Forml : Form public Form1() InitializeComponent();private void button1_Click( object sender, EventArgs e)string mystr,mysql;OleDbConnection myconn = new OleDbConnection (); mystr
29、 ="Provider = "+"Data Source = H:C#2005"=mystr;();OleDbCommanmycmd = new OleDbCommaind;mysql ="SELECT student.學號,student. 姓名,score.課程名,score.分數(shù) FROM student,scoreWHERE student.學號=score.學號 ORDER BY student.學號”;=mysql;=myconn;OleDbDataReader myreader =();"學號t姓名t課程名t分數(shù)&quo
30、t;);"="與textBox1文本框綁定起來Binding mybinding2 = new Binding ("Text", mybs,"課程名");Binding ("Text" , mybs,();Binding mybinding3 = new"分數(shù)");private voidEventArgs e)button1_Click( object sender,if != 0)();utoSizeMode =11.AutoSizeMode =12.AutoSizeMode =();設(shè)計窗
31、體實現(xiàn)對score表所有記錄通用查找和排序。P350using System;using using ;using ;using ;using ;using Proj13_2 public partial class Form5 : FormInitializeComponent();private void Form5_Load( object sender, EventArgs e)DataView mydv = new DataView(); public Form5()string mystr;OleDbConnection myconn = new OleDbConnection (
32、);DataSet myds = new DataSet ();DataSet myds1 = new DataSet ();DataSet myds2 = new DataSet ();DataSet myds3 = new DataSet ();mystr ="Provider = "+"Data Source = H:C#2005"=mystr;();OleDbDataAdapter myda = new OleDbDataAdapter ("SELECT * FROM score" , myconn);(myds,"
33、score");mydv = "score" .DefaultView;utoSizeMode =11 .AutoSizeMode =;2 .AutoSizeMode =;();"學號");"課程名");"分數(shù)");=true; =false=""“private void button1_Click( object sender, EventArgs e) string condstr ="" ;/ 以下根據(jù)用戶輸入求得條件表達式condstrif !="
34、;" )condstr =" 學號 Like '"+ +"%'" ;if !="" )if (condstr !="" )condstr = condstr +" AND 課程名 = '"+ +elsecondstr =" 課程名 = '" + +"'" ;=condstr;/ 過濾 DataView 中的記錄private void button2_Click( object sender, EventA
35、rgs e) =""=""=""private void button3_Click( object sender, EventArgs e) string orderstr ="" ;/ 以下根據(jù)用戶輸入求得排序條件表達式orderstrif !="" )iforderstr = +" ASC" ;elseorderstr = +" DESC" ;=orderstr;/ X:'DataView中記錄排序(1) |輸入 a,b 求 c = a +
36、b固強制轉(zhuǎn)換P38回賦值兩同學信息數(shù)據(jù),并在圖中輸出結(jié)果 P44(3) |聲明枚舉類型 color ,給兩成員賦值,定 義三個變量,賦值運算輸出相應(yīng)值。P47(4) |位運算符運用P50回輸出常用數(shù)據(jù)類型所用字節(jié)數(shù)P52回求字符串子串在主串的位置P56函ataTime 結(jié)構(gòu)的使用 P59回設(shè)計一個控制臺程序, 定義變量int a, b; float x , y。并求表達式(float ) ( a+b) /+(int)x%(int)y P60團設(shè)計一個控制臺程序,定義變量 int a , b, c;并求表達式(+c-1 ) &b+c/2 P60回聲明一個學生結(jié)構(gòu)類型Stud ,包含學號,姓名,出生日期成員,定義 Stud結(jié)構(gòu)的兩個 學生變量S1, S2并賦值,求他們出售在星期 幾及其相差天數(shù)P60回用if/if else語句顯示用戶輸入數(shù)值的絕對值P62劍判斷年份是否為閏年p63(9) |將用戶輸入的分數(shù)轉(zhuǎn)換為等級ABCD輸出P64恒口編寫程序要求輸入課程后顯示相應(yīng)學分 P65(12)判斷輸入的大于3的正整數(shù)是否為素數(shù)P70(12)用continue 語句對輸入的正數(shù)求和,輸入的負數(shù)忽略,每輸入一個數(shù),判斷其正負, 負則結(jié)束循環(huán),進入下一個數(shù),正數(shù)則加到 總數(shù)上去P71 (13) |滿足12 +22 +n2 <1000的最大的n
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 體育個人課題申報書范例
- 課題申報書點評模板
- 兵團立項課題申報書
- 課題申報書格式
- 陜西課題申報書范文樣本
- 烏魯木齊供用熱合同范本
- 怎么填課題申報書
- 品牌專利持有合同范本
- 會展場館租賃合同范本
- 科學技術(shù)課題申報書
- 膿毒血癥護理查房
- 蘇科版七年級數(shù)學下冊期末復(fù)習+10(專題-幾何圖形的證明)
- 西方經(jīng)濟學(第二版)完整整套教學課件
- 《零基礎(chǔ)玩轉(zhuǎn)小紅書:吃透爆款邏輯漲粉、變現(xiàn)不再難》
- 圍術(shù)期下肢深靜脈血栓預(yù)防的術(shù)中護理
- 《云南瀾滄鉛礦有限公司勐濱煤礦采礦權(quán)價款退還計算說明》
- GB/T 9113.1-2000平面、突面整體鋼制管法蘭
- GB/T 2423.18-2021環(huán)境試驗第2部分:試驗方法試驗Kb:鹽霧,交變(氯化鈉溶液)
- 2021年湖北師范學院專升本C語言程序設(shè)計試卷
- CB/T 3136-1995船體建造精度標準
- 疫苗冰箱溫度記錄表
評論
0/150
提交評論