5. ساخت تقویم
زبان نوشتاری PHP
سطح برنامه : متوسط
*********//*********
<style>
calendar { border-left:1px solid #999; width:100%;}
* html .day, * html .day-np { height:80px;}
.day:hover { background:#eceff5; }
.day-np { background:#ccc; min-height:80px; }
.day-head { background:#17a68a; color:#fff; font-weight:bold; text-align:center; padding:5px; width:80px; border-top:1px solid #636363; border-right:1px solid #636363; }
.day-num { background:#353632; padding:5px; color:#fff; font-weight:bold; float:right; margin:-5px -5px 0 0; width:20px; text-align:center; }
.day, .day-np { padding:5px; border-bottom:1px solid #636363; width:80px; border-right:1px solid #636363; }
.day { color:#353632; font-weight:bold; }
</style>
<?php
function draw_calendar($month, $year) {
$cal = '<table cellpadding="0" cellspacing="0" class="calendar" width="100%">';
$headings = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
$cal .= '<tr class="row">
<td class="day-head">'
.implode('</td><td class="day-head">',$headings).'
</td></tr>';
$running_day = date('w',mktime(0,0,0,$month,1,$year));
$days_in_month = date('t',mktime(0,0,0,$month,1,$year));
$days_in_this_week = 1;
$day_counter = 0;
$dates_array = array();
$cal .= '<tr class="row">';
for($x = 0; $x < $running_day; $x++) {
$cal .= '<td class="day-np"> </td>';
$days_in_this_week++;
}
for($list_day = 1; $list_day <= $days_in_month; $list_day++) {
$cal .= '<td class="day" align="center">';
$cal .= $list_day;
$cal .= str_repeat('<p> </p>', 2);
$cal.= '</td>';
if($running_day == 6) {
$cal .= '</tr>';
if(($day_counter+1) != $days_in_month) {
$cal .= '<tr class="row">';
}
$running_day = -1;
$days_in_this_week = 0;
}
$days_in_this_week++;
$running_day++;
$day_counter++;
};
if($days_in_this_week < 8) {
for($x = 1; $x <= (8 - $days_in_this_week); $x++) {
$cal .= '<td class="day-np"> </td>';
}
}
$cal .= '</tr>';
$cal .= '</table>';
return $cal;
}
//Draw calendar for the current month/year
echo draw_calendar(date("m"), date("Y"));
?>
@de_coder
زبان نوشتاری PHP
سطح برنامه : متوسط
*********//*********
<style>
calendar { border-left:1px solid #999; width:100%;}
* html .day, * html .day-np { height:80px;}
.day:hover { background:#eceff5; }
.day-np { background:#ccc; min-height:80px; }
.day-head { background:#17a68a; color:#fff; font-weight:bold; text-align:center; padding:5px; width:80px; border-top:1px solid #636363; border-right:1px solid #636363; }
.day-num { background:#353632; padding:5px; color:#fff; font-weight:bold; float:right; margin:-5px -5px 0 0; width:20px; text-align:center; }
.day, .day-np { padding:5px; border-bottom:1px solid #636363; width:80px; border-right:1px solid #636363; }
.day { color:#353632; font-weight:bold; }
</style>
<?php
function draw_calendar($month, $year) {
$cal = '<table cellpadding="0" cellspacing="0" class="calendar" width="100%">';
$headings = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
$cal .= '<tr class="row">
<td class="day-head">'
.implode('</td><td class="day-head">',$headings).'
</td></tr>';
$running_day = date('w',mktime(0,0,0,$month,1,$year));
$days_in_month = date('t',mktime(0,0,0,$month,1,$year));
$days_in_this_week = 1;
$day_counter = 0;
$dates_array = array();
$cal .= '<tr class="row">';
for($x = 0; $x < $running_day; $x++) {
$cal .= '<td class="day-np"> </td>';
$days_in_this_week++;
}
for($list_day = 1; $list_day <= $days_in_month; $list_day++) {
$cal .= '<td class="day" align="center">';
$cal .= $list_day;
$cal .= str_repeat('<p> </p>', 2);
$cal.= '</td>';
if($running_day == 6) {
$cal .= '</tr>';
if(($day_counter+1) != $days_in_month) {
$cal .= '<tr class="row">';
}
$running_day = -1;
$days_in_this_week = 0;
}
$days_in_this_week++;
$running_day++;
$day_counter++;
};
if($days_in_this_week < 8) {
for($x = 1; $x <= (8 - $days_in_this_week); $x++) {
$cal .= '<td class="day-np"> </td>';
}
}
$cal .= '</tr>';
$cal .= '</table>';
return $cal;
}
//Draw calendar for the current month/year
echo draw_calendar(date("m"), date("Y"));
?>
@de_coder
7. ساخت یک نبرد اتوماتیک
زبان نوشتاری #C
سطح برنامه : متوسط رو به بالا
*********//*********
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace de_coder
{
class Program
{
static void Main(string[] args)
{
int herohealth;
int monsterhealth;
string monstername;
int monsterhealthbegining;
Random healthgen = new Random();
herohealth = healthgen.Next(5, 21);
Console.WriteLine("you have " + herohealth + " health");
monsterhealth = healthgen.Next(5, 21);
monsterhealthbegining = monsterhealth;
if (monsterhealth <= 8)
{
monstername = "goblin";
Console.WriteLine("A simple goblin with " + monsterhealth + " health attacks!");
goto heroattack;
}
else if (monsterhealth >= 9 && 13 >= monsterhealth )
{
monstername = "owlbear";
Console.WriteLine("An owlbear with " + monsterhealth + " health attacks!");
goto heroattack;
}
else if (monsterhealth >= 14 && 17 >= monsterhealth)
{
monstername = "orc";
Console.WriteLine("An orc with " + monsterhealth + " health attacks!");
goto heroattack;
}
else
{
monstername = "dragon";
Console.WriteLine("A dragon with " + monsterhealth + " health attacks!");
goto heroattack;
}
heroattack:
System.Threading.Thread.Sleep(50);
if (herohealth >= 0)
{
Random roll = new Random();
int roll20;
int roll6;
int damage;
roll20 = roll.Next(1, 21);
if (roll20 >= 9)
{
Console.Write("You hit it for ");
roll6 = roll.Next(1, 7);
Console.WriteLine(roll6 + " damage!");
damage = roll6;
monsterhealth -= damage;
if (monsterhealth >= 0)
{
goto monsterattack;
}
else
{
Console.WriteLine("You win!");
}
}
else
{
Console.WriteLine("You missed!");
goto monsterattack;
}
}
else
{
Console.WriteLine("You loose!");
}
monsterattack:
System.Threading.Thread.Sleep(50);
if (monsterhealth >= 0)
{
Random roll = new Random();
int roll202;
int roll62;
int damage2;
roll202 = roll.Next(1, 21);
if (roll202 >= 9)
{
Console.Write("It hits you for ");
roll62 = roll.Next(1, 7);
Console.WriteLine(roll62 + " damage!");
damage2 = roll62;
herohealth -= damage2;
if (herohealth >= 0)
{
goto heroattack;
}
else
{
Console.WriteLine("You loose!");
}
}
else
{
Console.WriteLine("It missed!");
goto heroattack;
}
}
else
{
int reward;
reward = monsterhealthbegining * 10;
Console.WriteLine("You got " + reward + " silver for slaying the " + monstername + ".");
}
}
}
}
@de_coder
زبان نوشتاری #C
سطح برنامه : متوسط رو به بالا
*********//*********
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace de_coder
{
class Program
{
static void Main(string[] args)
{
int herohealth;
int monsterhealth;
string monstername;
int monsterhealthbegining;
Random healthgen = new Random();
herohealth = healthgen.Next(5, 21);
Console.WriteLine("you have " + herohealth + " health");
monsterhealth = healthgen.Next(5, 21);
monsterhealthbegining = monsterhealth;
if (monsterhealth <= 8)
{
monstername = "goblin";
Console.WriteLine("A simple goblin with " + monsterhealth + " health attacks!");
goto heroattack;
}
else if (monsterhealth >= 9 && 13 >= monsterhealth )
{
monstername = "owlbear";
Console.WriteLine("An owlbear with " + monsterhealth + " health attacks!");
goto heroattack;
}
else if (monsterhealth >= 14 && 17 >= monsterhealth)
{
monstername = "orc";
Console.WriteLine("An orc with " + monsterhealth + " health attacks!");
goto heroattack;
}
else
{
monstername = "dragon";
Console.WriteLine("A dragon with " + monsterhealth + " health attacks!");
goto heroattack;
}
heroattack:
System.Threading.Thread.Sleep(50);
if (herohealth >= 0)
{
Random roll = new Random();
int roll20;
int roll6;
int damage;
roll20 = roll.Next(1, 21);
if (roll20 >= 9)
{
Console.Write("You hit it for ");
roll6 = roll.Next(1, 7);
Console.WriteLine(roll6 + " damage!");
damage = roll6;
monsterhealth -= damage;
if (monsterhealth >= 0)
{
goto monsterattack;
}
else
{
Console.WriteLine("You win!");
}
}
else
{
Console.WriteLine("You missed!");
goto monsterattack;
}
}
else
{
Console.WriteLine("You loose!");
}
monsterattack:
System.Threading.Thread.Sleep(50);
if (monsterhealth >= 0)
{
Random roll = new Random();
int roll202;
int roll62;
int damage2;
roll202 = roll.Next(1, 21);
if (roll202 >= 9)
{
Console.Write("It hits you for ");
roll62 = roll.Next(1, 7);
Console.WriteLine(roll62 + " damage!");
damage2 = roll62;
herohealth -= damage2;
if (herohealth >= 0)
{
goto heroattack;
}
else
{
Console.WriteLine("You loose!");
}
}
else
{
Console.WriteLine("It missed!");
goto heroattack;
}
}
else
{
int reward;
reward = monsterhealthbegining * 10;
Console.WriteLine("You got " + reward + " silver for slaying the " + monstername + ".");
}
}
}
}
@de_coder
Forwarded from Deleted Account
کانالی درباره برنامه نویسی از هر زبانی ک فکرش را بکنید.
آموزش تمام زبان های برنامه نویسی دنیا
وبه همراه نمونه کار و خروجی برنامه.
ویژه رشته کامپیوتر.🆕
⬇️⬇️⬇️⬇️⬇️⬇️⬇️
DE.coder();
https://telegram.me/de_coder
آموزش تمام زبان های برنامه نویسی دنیا
وبه همراه نمونه کار و خروجی برنامه.
ویژه رشته کامپیوتر.🆕
⬇️⬇️⬇️⬇️⬇️⬇️⬇️
DE.coder();
https://telegram.me/de_coder