توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : برنامه نویسی سوکت لینوکس
Victor007
26th December 2010, 10:58 AM
نام کتاب: Linux Socket Programming
نویسنده: Brain Hall
مترجم: غلامرضا صابری تبریزی
زبان : فارسی
نوع فایل: PDF
تعداد صفحات: 47 صفحه
حجم:381(کیلوبایت)
دانلود از سرور سایت (http://uc-njavan.ir/file/do.php?id=1432)
uody
1st April 2011, 02:06 PM
این برنامه عمل شمارش حروف را در یک رشته را نشان می دهد
Program :- To count the number of character in a given string.
echo Enter a string
read str
nc=`expr $str | wc -c`
n=`expr $nc - 1`
echo Number of character in $str is : $n
خروجی برنامه
Enter a string
network
Number of character in network is : 7
uody
1st April 2011, 02:07 PM
برنامه ای برای شمارش حروف صدا دار
Program :- To count number of vowels.
echo Enter a string
read str
nc=`expr $str | wc -c`
i=1
n=0
while [ $i -le $nc ]
do
ch=`echo $str | cut -c $i`
case $ch in
[aeiouAEIOU])
n=`expr $n + 1`;;
esac
i=`expr $i + 1`
done
echo Number of vowels is : $n
خروجی برنامه
Enter a string
gopinath
Number of vowels is : 3
uody
1st April 2011, 02:10 PM
چاپ تمامی اعداد اول بین دو بازه عددی
.
echo Enter the limits
read ll ul
echo prime numbers in between $ll and $ul
while [ $ll -lt $ul ]
do
n=`expr $ll - 1`
m=2
flag=1
while [ $m -le $n ]
do
k=`expr $ll % $m`
if [ $k -eq 0 ]
then
flag=0
break
fi
m=`expr $m + 1`
done
if [ $flag -eq 1 ]
then
echo $ll
fi
ll=`expr $ll + 1`
done
خروجی:
Enter the limits
5 21
Prime numbers in between 5 and 21
5
7
11
13
17
19
uody
1st April 2011, 02:13 PM
آیا سال معین شده سال کبیسه است یا خیر
echo Enter the year
read yy
a=`expr $yy % 4`
b=`expr $yy % 100`
c=`expr $yy % 400`
if [ $a -eq 0 -a $b -ne 0 -o $c -eq 0 ]
then
echo $yy is leap year
else
echo $yy is not a leap year
fi
خروجی 1:
Enter the year
2004
2004 is leap year
خروجی 2:
Enter the year
2006
2006 is not a leap year
uody
1st April 2011, 02:15 PM
برنامه ای به منظور چک کردن اینکه آیا رشته کلمه داده شده از دو سو یکی است یا خیر
echo Enter a string
read str1
str2=$str1
nc=`expr $str1 | wc -c`
i=`expr $nc - 1`
j=1
while [ $i -gt 0 ]
do
ch1=`echo $str1 | cut -c $j`
ch2=`echo $str2 | cut -c $i`
if [ $ch1 != $ch2 ]
then
echo $str1 is not palindrome
exit
fi
j=`expr $j + 1`
i=`expr $i - 1`
done
echo $str1 is palindrome
خروجی 1:
Enter a string
malayalam
malayalam is palindrome
خروجی2:
Enter a string
subnetwork
subnetwork is not palindrome
uody
1st April 2011, 02:18 PM
برنامه برای بررسی اینکه عدد موردنظر زوج و یا فرد است
echo Enter a number
read n
m=`expr $n % 2`
if [ $m -eq 0 ]
then
echo Given number is even
else
echo Given number is odd
fi
خروجی1:
Enter a number
123
Given number is odd
خروجی2:
Enter a number
122
Given number is even
منبع:www.subnet.ir
استفاده از تمامی مطالب سایت تنها با ذکر منبع آن به نام سایت علمی نخبگان جوان و ذکر آدرس سایت مجاز است
استفاده از نام و برند نخبگان جوان به هر نحو توسط سایر سایت ها ممنوع بوده و پیگرد قانونی دارد
vBulletin® v4.2.5, Copyright ©2000-2025, Jelsoft Enterprises Ltd.