پروژه های سی شارپ
namespace
WindowsApplication2{
public partial class Form1 : Form{
public class daneshju{
public string nam; public string lnam; public string shsh; public string shd; public string tt; public string reshte; public string moadel;}
daneshju list = new daneshju(); void main(){
Form frm = new Form(); Application.Run(frm);}
public Form1(){
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e){
}
private void button1_Click(object sender, EventArgs e){
list.nam = textBox1.Text;
list.lnam = textBox2.Text;
list.shsh = textBox3.Text;
list.shd = textBox4.Text;
list.tt = textBox5.Text;
list.reshte = textBox6.Text;
list.moadel = textBox7.Text;
textBox1.Text =
"";textBox2.Text =
"";textBox3.Text =
"";textBox4.Text =
"";textBox6.Text =
"";textBox5.Text =
"";textBox7.Text =
"";}
private void button2_Click(object sender, EventArgs e){
if (textBox1.Text != "")list.nam = textBox1.Text;
if (textBox2.Text != "")list.lnam = textBox2.Text;
if (textBox3.Text != "")list.shsh = textBox3.Text;
if (textBox4.Text != "")list.shd = textBox4.Text;
if (textBox5.Text != "")list.tt = textBox5.Text;
if (textBox6.Text != "")list.reshte = textBox6.Text;
if (textBox7.Text != "")list.moadel = textBox7.Text;
textBox1.Text =
"";textBox2.Text =
"";textBox3.Text =
"";textBox4.Text =
"";textBox6.Text =
"";textBox5.Text =
"";textBox7.Text =
"";}
private void button3_Click(object sender, EventArgs e){
textBox1.Text = list.nam;
textBox2.Text = list.lnam;
textBox3.Text = list.shsh;
textBox4.Text = list.shd;
textBox5.Text = list.tt;
textBox6.Text = list.reshte;
textBox7.Text = list.moadel;
}
private void button4_Click(object sender, EventArgs e){
MessageBox.Show("tamame dade ha pak shodand");list.nam =
"";list.lnam =
"";list.shsh =
"";list.shd =
"";list.tt =
"";list.reshte =
"";list.moadel =
"";textBox1.Text =
"";textBox2.Text =
"";textBox3.Text =
"";textBox4.Text =
"";textBox6.Text =
"";textBox5.Text =
"";textBox7.Text =
"";}
private void button5_Click(object sender, EventArgs e){
Application.Exit();}
}
}
این یکی کد پروژه دانشجو تو محیط کنسوله
using
System;using
System.Collections.Generic;using
System.Text;namespace
ConsoleApplication5{
class daneshju{
string name = ""; string fname = ""; int shomareshe=0 ; int shomareda=0; string tarikht=""; string reshte = ""; string moadel="0"; public void edt(){
Console.WriteLine("help:name=1 name khanevadegi=2 shomare shenasname=3 shomare daneshjuee=4 tarikh tavalod=5 reshte=6 moadel=7 exit=8"); int aa = Convert.ToInt32(Console.ReadLine()); if (aa != 8){
if (aa == 1){
Console.WriteLine("name daneshju ra vared konid");name =
Console.ReadLine();}
if (aa == 2){
Console.WriteLine("name khanevadegi daneshju ra vared konid");fname =
Console.ReadLine();}
if (aa == 3){
Console.WriteLine("shomare shenasname daneshju ra vared konid");shomareshe =
Convert.ToInt32(Console.ReadLine());}
if (aa == 4){
Console.WriteLine("shomare daneshjuee daneshju ra vared konid");shomareda =
Convert.ToInt32(Console.ReadLine());}
if (aa == 5){
Console.WriteLine("tarikhe tavalode daneshju ra vared konid");tarikht =
Console.ReadLine();}
if (aa == 6){
Console.WriteLine("reshte daneshju ra vared konid");reshte =
Console.ReadLine();}
if (aa == 7){
Console.WriteLine("moadele daneshju ra vared konid");moadel =
Console.ReadLine();}
}
Console.Clear();}
public void add(){
Console.WriteLine("name daneshju ra vared konid");name =
Console.ReadLine(); Console.WriteLine("name khanevadegi daneshju ra vared konid");fname =
Console.ReadLine(); Console.WriteLine("shomare shenasname daneshju ra vared konid");shomareshe =
Convert.ToInt32( Console.ReadLine()); Console.WriteLine("shomare daneshjuee daneshju ra vared konid");shomareda =
Convert.ToInt32(Console.ReadLine()); Console.WriteLine("tarikhe tavalode daneshju ra vared konid");tarikht =
Console.ReadLine(); Console.WriteLine("reshte daneshju ra vared konid");reshte =
Console.ReadLine(); Console.WriteLine("moadele daneshju ra vared konid");moadel =
Console.ReadLine(); Console.Clear();}
public void delet(){
Console.Clear(); Console.WriteLine("tamame dade ha pak shodand");fname =
"";moadel =
"";name =
"";reshte =
"";shomareda = 0;
shomareshe = 0;
tarikht =
"";
}
public void viw(){
Console.Clear(); Console.WriteLine("{0}", name); Console.WriteLine("{0}", fname); Console.WriteLine("{0}", shomareshe); Console.WriteLine("{0}", shomareda); Console.WriteLine("{0}", tarikht); Console.WriteLine("{0}", reshte); Console.WriteLine("{0}", moadel);
}
}
class Program{
static void Main(string[] args){
daneshju list = new daneshju(); Console.WriteLine("help:add=1 delete=2 edit=3 view=4 exit=5"); int aa = Convert.ToInt32(Console.ReadLine()); while (aa != 5){
if (aa == 1){
list.add();
Console.WriteLine("help:add=1 delete=2 edit=3 view=4 exit=5");aa =
Convert.ToInt32(Console.ReadLine());}
if (aa == 3){
list.edt();
Console.WriteLine("help:add=1 delete=2 edit=3 view=4 exit=5");aa =
Convert.ToInt32(Console.ReadLine());}
if (aa == 2){
list.delet();
Console.WriteLine("help:add=1 delete=2 edit=3 view=4 exit=5");aa =
Convert.ToInt32(Console.ReadLine());}
if (aa == 4){
list.viw();
Console.WriteLine("help:add=1 delete=2 edit=3 view=4 exit=5");aa =
Convert.ToInt32(Console.ReadLine());}
}
}
}
}
اینم کد پروژه تقویم تو محیط کنسولusing
System;using
System.Collections.Generic;using
System.Text;namespace
taghvim{
class Program{
static void Main(string[] args){
//taghvim miladi sale 2005 ruze aval shanbe ast int xx, nn, z; string sh = "", x, n; Console.WriteLine("lotfan yek adad az 0 ta 6 be in sharh :shanbe=0 yakshanbe=1 doshanbe=2 seshanbe=3 charshanbe=4 panjshanbe=5 jome=6 baraye moshakhas kardane ruze avale sal entekhab konid");x =
Console.ReadLine();xx =
Convert.ToInt32(x);//ruze avale hafte Console.WriteLine("lotfan adad mored nazare khod ra vared konid");n =
Console.ReadLine();nn =
Convert.ToInt32(n);//yek ruze tasadofi az salz = nn % 7;
z = z - 1;
//be dalile in ke 1 mode 7 mishe 1 bayad menhaye yek beshe ta ruze avale hafte ra neshan bede switch (z){
case 0:sh =
"satarday"; break; case 1:sh =
"sunday"; break; case 2:sh =
"monday"; break; case 3:sh =
"tuesday"; break; case 4:sh =
"wednesday"; break; case 5:sh =
"thursday"; break; case 6:sh =
"friday"; break;}
if (nn <=181){
if (nn <= 31) Console.WriteLine("{0},jan,{1}", sh, nn); if (nn > 31 && nn <= 59) Console.WriteLine("{0},feb,{1}", sh, nn % 31); if (nn > 59 && nn <= 90) Console.WriteLine("{0},mar,{1}", sh, nn % 59); if (nn > 90 && nn <= 120) Console.WriteLine("{0},apr,{1}", sh, nn % 90); if (nn > 120 && nn <= 151) Console.WriteLine("{0},may,{1}", sh, nn % 120); if (nn > 151 && nn <= 181) Console.WriteLine("{0},jun,{1}", sh, nn % 151);}
if (nn > 181 && nn <= 365){
if (nn > 181 && nn <= 212) Console.WriteLine("{0},jul,{1}", sh, nn % 181); if (nn > 212 && nn <= 243) Console.WriteLine("{0},aug,{1}", sh, nn % 212); if (nn > 243 && nn <= 273) Console.WriteLine("{0},sep,{1}", sh, nn % 243); if (nn > 273 && nn <= 304) Console.WriteLine("{0},oct,{1}", sh, nn % 273); if (nn > 304 && nn <= 334) Console.WriteLine("{0},nov,{1}", sh, nn % 304); if (nn > 334 && nn <= 365) Console.WriteLine("{0},dec,{1}", sh, nn % 334);}
Console.Read();}
}
}
