ارجو مساعدتي في كتابة هذا البرنامج...
تاريخ التسجيل: 2008-05-16 مشاركات: 2
الجامعة: غير ذلك الكلية: غير ذلك المرحلة: السنة الأولى الاختصاص: غير ذلك
|
السلام عليكم ورحمة الله وبركاته..
لدي 3 برامج اتمنى مساعدتي بحلهم..
باقصى وقت ممكن..
الاول::
Q1)
Write a boolean function to check whether a number (passed to the function as a
parameter) is Perfect or not. A number is called Perfect if it is equal to the sum of its
divisors (including 1, excluding the number itself). (Example : 6 is perfect since it is
equal to 1 + 2 + 3)
Write a program that uses this function to discover the first 3 perfect numbers starting
with the number 2.
الثاني::
Q2)
Write a void function that reads a group of 4 positive integers (via a loop) and returns
their arithmetic and geometric means.
The main program will use this function to read N groups of 4 integers each and finds the
maximum arithmetic mean and the minimum geometric mean.
(Remark: the arithmetic mean of n numbers is their sum divided by n, and the geometric
mean of n numbers is the n-th root of their product)
الثالث::
Q3)
Write a void function that takes 3 floats A, B and C (representing the coefficients of the
quadratic equation Ax2 +Bx +C=0). The function will set a boolean flag to false if the
equation has no real roots. Otherwise flag will be set to true and the two solutions are
stored in S1 and S2. Here is its header:
void solve (float A, float B, float C, bool & flag, float & S1, float & S2)
The main program will read the coefficients of N quadratic equations (N is an input). For
each equation, the program should display either NO REAL SOLUTION or display the 2
real roots.
وشكرا انتظر الرد بفارق الصبر
|
| |
دخول أو تسجيل لإرسال التعليقات | قراءة: 169 |
تاريخ التسجيل: 2008-04-08 مشاركات: 15
الجامعة: دمشق الكلية: غير ذلك المرحلة: ماجستير الاختصاص: غير ذلك
|
وعليكم السلام ورحمة الله وبركاته
يا ليت يتم توضيح الطلب بالعربي وشو مطلوب تحديداً وبأ لغة برمجة؟
|
| |
دخول أو تسجيل لإرسال التعليقات |
تاريخ التسجيل: 2008-05-16 مشاركات: 2
الجامعة: غير ذلك الكلية: غير ذلك المرحلة: السنة الأولى الاختصاص: غير ذلك
|
صراحه انا مو فاهمه المطلوب بالضبط
لغة البرمجه سي بلس بلس
طريقة function
اتمنى يوجد من يساعدني...
|
| |
دخول أو تسجيل لإرسال التعليقات |
تاريخ التسجيل: 2008-03-05 مشاركات: 256
الجامعة: الافتراضية الكلية: تكنولوجيا المعلومات المرحلة: السنة الثالثة الاختصاص: غير ذلك
|
السلام عليكم أنا انكليزيتي على قدها
هذا جزء من الحل للسؤال الثاني على مافهمته
أعتقد أنه ناقص من أجل
geomtric
الحل هذا بالسي شارب ، و الآن سلام لم يعد معي المزيد من الوقت
static public void Bayrn()
{
int sum=0;
for (int i=0;i<4;i++)
{
console.WritLine("Enter the Number");
int i=Convert.ToInt(Console.Readline);
sum=sum+i;
}
Console.WriteLine(Sum/4);
}
ربنا لا تزغ قلوبنا بعد اذ هديتنا و هب لنا من لدّنك رحمة انك أنت الوهاب
|
| |
دخول أو تسجيل لإرسال التعليقات |
تاريخ التسجيل: 2007-12-04 مشاركات: 17
الجامعة: دمشق الكلية: الهندسة المعلوماتية المرحلة: متخرج الاختصاص: هندسة برمجيات
|
بالنسبة للسؤال الأول:
#include <iostream> using namespace std; bool perfTest(int Num); void factorPrint(int Num1); int main() { int num; int Fact; do { cout << "How Many Numbers Would You Like To Test? "; cin >> num; } while (num<=0); for(int a=1; a<=num; a++) { cout << "Please enter a possible perfect number: "; cin >> Fact; if(perfTest(Fact)==true) factorPrint(Fact); } return 0; } // First Function =============================== bool perfTest (int Num) { bool perfect; int B=0; for(int A=1; A!=Num; A++) { if(Num%A==0) { B+=A; } } if(B==Num) perfect=true; else perfect=false; return perfect; } //second function =============================== void factorPrint(int Num1) { for(int A=1; A!=Num1; A++) { if(Num1%A==0) { cout << Num1 << ":" << A << " "; } } return; }
|
| |
دخول أو تسجيل لإرسال التعليقات |
تاريخ التسجيل: 2006-05-22 مشاركات: 594
الجامعة: دمشق الكلية: الهندسة المعلوماتية المرحلة: السنة الخامسة الاختصاص: هندسة برمجيات
|
المفروض..هي يلي تحاول وتحط الكود..وبعدين..ممكن نطلع على الكود!
|
| |
دخول أو تسجيل لإرسال التعليقات |
تاريخ التسجيل: 2007-12-04 مشاركات: 17
الجامعة: دمشق الكلية: الهندسة المعلوماتية المرحلة: متخرج الاختصاص: هندسة برمجيات
|
كتب eng.samar: المفروض..هي يلي تحاول وتحط الكود..وبعدين..ممكن نطلع على الكود! فكرة الحل للسؤال الثالث (معادلة من الدرجة الثانية): void solve (float A, float B, float C, bool & flag, float & S1, float & S2){ if((b*b-4*a*c) <0 ) { flag = false; } else { // real solutions from quadratic equation s1=(-b+ sqrt(b*b-4*a*c)) /(2*a); s2=(-b- sqrt(b*b-4*a*c)) /(2*a); flag = true; }
|
| |
دخول أو تسجيل لإرسال التعليقات |
|