-
برامج في c & ++c
السلام عليكم.....
كيف حالكم يا اعضاء.....نظراً لعدم توفر قسم البرمجة فسوف انزل موضوع في الكمبيوتر.....
و لكن لانشغالي الشديد و عدم توفر الوقت فلن اقدر ان البي الطلبات و انما انزل البرنامج و اكتب عليه اسم البرنامج فقط....
و لكن قد يكون البرنامج في بعض غلط......
اتفقنا ان شاء الله خير..... :36_3_12: :36_3_12:
-
برنامج تذخل فية قيمة الزاوية ويقوم هو بإيجاد جيب الزاوية Sin
Code:
#include <iostream.h>
#include <math.h>
#include <conio.h>
#define PI 3.14159
main()
{
clrscr();
float degree, sine ;
cout << "\t\tSIN\nPlease enter the angle in degrees " ;
cin >> degree ;
sine = sin(degree* PI/ 180) ;
cout << " SIN " << degree <<" = " << sine ;
getch();
}
-
برنامج تذخل فية قيمة الزاوية ويقوم هو بإيجاد جيب تمام الزاوية Cos
Code:
#include <iostream.h>
#include <math.h>
#include <conio.h>
#define PI 3.14159
main()
{
clrscr();
float degree, cose ;
cout << "\t\tCOS\nPlease enter the angle in degrees " ;
cin >> degree ;
cose = cos(degree* PI/ 180) ;
cout << " COS " << degree <<" = " << cose ;
getch();
}
-
برنامج تذخل فية قيمة الزاوية ويقوم هو بإيجاد ظل الزاوية tan
Code:
#include <iostream.h>
#include <math.h>
#include <conio.h>
#define PI 3.14159
main()
{
clrscr();
float degree, tane ;
cout << "\t\tTAN\nPlease enter the angle in degrees " ;
cin >> degree ;
tane = tan(degree* PI/ 180) ;
cout << " TAN " << degree <<" = " << tane ;
getch();
}
-
برنامج يعطيك الأعداد الفردية التي تقع بين الواحد والرقم الذي يطلبة منك في بداية البرنامج
Code:
#include <iostream.h>
main();
{
int i,n ;
cout << "Enter number you want find EVEN to it:\n ";
cin >> n ;
for ( i=1; i<=n; i++ )
{
if (i%2) ;
cout << i << "\t " ;
else continue ;
}
}
-
برنامج يعطيك الأعداد الزوجية التي تقع بين الواحد والرقم الذي يطلبة منك في بداية البرنامج
Code:
#include <iostream.h>
main()
{
int i,n ;
cout << "Enter number you want find EVEN to it:\n" ;
cin >> n ;
for ( i=1; i<=n; i++)
{
if (i%2) continue ;
cout << i << "\t" ;
}
}
-
برنامج يعطيك حجم الدائرة بدلالة قطرها
Code:
#include <iostream.h>
main()
{
float r,area ;
cout << " Enter the radius " ;
cin >> r ;
area =3.14*r*r ;
cout <<'\n'<<"Area = " << area <<" squared unit" ;
}
-
هذا البرنامج يحول الدرجات من سلسيوسي الى فهرينهايت
Code:
#include <iostream.h>
#include <math.h>
main()
{
float celsius,fahrenheit ;
cout << " Please enter the temperature in fahrenheit degrees\n" ;
cin >> fahrenheit ;
celsius = (5.0/9.0)* (fahrenheit -32) ;
cout << "The temperature in celsius = " <<celsius << " Degree" ;
}
-
البرنامج التالي يسمح لك بإذخال كلمة من 10 أحرف ويستخرج لك الحرف الهجائي الأخير من حيت الترتيب الهجائي........ مثل ( hotmail ) الأخير من حيت الترتيب الهجائي هو ( T )
Code:
#include <iostream.h>
main()
{
char c ;
int i, big ;
cout << "Enter your character " ;
cin >> c ;
big = int(c) ;
for(i=1; i<=10; i++)
{
cin >> c ;
if(int(c)>big)
big = int(c) ;
}
cout << "\nThe character that is alphabitically last: " << char(big) ;
}
-
لإيجاد عوامل العدد بمعنى الأعداد التي يقبل العدد القسمة عليها
Code:
#include<iostream.h>
main()
{
int number, counter ;
cout << "PLAESE ENTER A NUMBER " ;
cin >> number ;
if (number<0)
cout << "NEGATIVE NUMBER " ;
else
cout << "THE DIVISIORS OF THE NUMBER ARE: " ;
for (counter=1; counter <= number; counter++)
{
if(number%counter==0)
cout << "\t" << counter ;
}
}
-
برنامج يحسب الـ average
Code:
#include <iostream.h>
main()
{
float *a ;
float sum, average ;
int i, n ;
a = & average ;
cout << "\n \a Please enter the total number of elements: " ;
cin >> n ;
for(i=0; i<n; i++)
{
cout << "a["<< i+1<< "]= " ;
cin >> *(a+i) ;
}
for(i=0; i<n; i++)
sum += *(a+i) ;
average = sum / n ;
cout << "\n Average = "<< average ;
}
-
يحسب أصغر عدد ثم إذخاله
Code:
#include <iostream.h>
#include <conio.h>
main()
{
clrscr();
int x1, x2, x3 ;
cout << "Enter three different integers:\n " ;
cin >> x1>> x2>> x3 ;
if((x1<x2) && (x1<x3))
cout << "The smaller number is " << x1 ;
else if((x2<x1) && (x2<x3))
cout << "The smaller number is " << x2 ;
else if((x3<x1) && (x3<x2))
cout << "The smaller number is " << x3 ;
else cout << "THERE ARE ERROR " ;
getch();
}