مشاهدة النسخة كاملة : مبتدئة في البرمجة واطلب المساعدة


jerusalem rose's
02-06-2006, 07:00 PM
السلام عليكم ورحمة الله وبركاته


انا جديدة في المنتدى
ومبتدئة في البرمجة


وارجو المساعدة

عندي مجموعة من الاسئلة ولكن لم استتطع حلهم
وارجو المساعدة

Q1- Write a function with three input parameter and one output parameter ,the output parameter should be set the smallest of the input parameters.

Q2- Write a function with two floating point input parameter and three output parameters .set the output parameter to the sum, product, and quotient of the input parameters. If the second input parameter equals 0 , do not compute the quotient . The function should return an int error status that is set to TRUE if the second input is 0 and otherwise set to FALSE.

Q3- Write a function that takes an array and its size as input parameter and has an output parameter that is computed to be the product of all of the elements in the array.

Q4- Write a function that has a floating point input parameter representing an amount of money and four output parameter that are computed as the number of quarters , dimes ,nickels ,and pennies in the original amount.

Q5- Write a function named array_sorting, that takes an array and its size as input parameter and has an output parameter that sort the elements of the array .

Q6- Write a function that take a string, and has an output parameter that count the number of word in this string, and output each word of the string on a separate line. "Hint: assume that the words are separated by a single blank, or comma or with a period at the end of the string."

jerusalem rose's
02-06-2006, 08:03 PM
لو سمحتو ساعدوني بسرعةةة



اذا كان هادا بالامكان

jerusalem rose's
02-06-2006, 08:45 PM
السلام عليكم


الى اعضاء المنتدى الكرام


اني في امس الحاجة اليكم الان


ارجو ان تساعدوني


من فرج عن مؤمن كربه فرج الله له كربه

محمد عصام الدين
03-06-2006, 08:14 AM
لا أعرف بالضبط اللغه التى تستخدمينها فلست خبير برمجه و أعتقد ان ما تطلبينه ليس معقدا و يمكنك المحاوله و ستستطيع

مثلا أول برنامج ال input مثلا هم A,B,C و ال output هو smallest

A=input(' value of'); ---- take input
B=input(' value of'); ---- take input
c=input(' value of'); ---- take input
if A < B ;----- compare first two input
small = A ;----- mean A < B
else ;----- mean that A is not < B
small= B ;----- so B< A
end ;-----
if small > c ;----- if the smaller one if bigger than c
small =c ;----- so c is the smallest one
end ;----- if not the smaller one will remain
fprintf('smallest = %f ',small) ;--------- print the smaller one

مع العلم انه بالمتلاب و لو أستخدمت أى برنامج اخر قد تختلف الصيغه و لكن الطريقه ثابته ( يعنى اللى حيختلف طريقه كتابه الأمر

محمد عصام الدين
03-06-2006, 08:36 AM
أما بالنسبه لل
Q3- Write a function that takes an array and its size as input parameter and has an output parameter that is computed to be the product of all of the elements in the array

الإجابه هى

n=input(' input the colume of the matrix '); enter the number of matrix element
for i=1:n ; for loop
fprintf('The value of %d element = ',i ) ; to take
x(i)=input('') ; the inputs
end ; end for loop
product = x(1); ; put the fist element in product
for i = 2:n ; for loop to
product = product * x(i); ; get the product value
end ; end for loop
fprintf('product = %f ',product) ; Display the result

مع العلم انه بالمتلاب و لو أستخدمت أى برنامج اخر قد تختلف الصيغه و لكن الطريقه ثابته ( يعنى اللى حيختلف طريقه كتابه الأمر

jerusalem rose's
03-06-2006, 07:25 PM
السلام عليكم ورحمة الله وبركاته




شكرا جريلا لك اخي الكريم

jerusalem rose's
03-06-2006, 11:08 PM
السلام عليكم

ممكن تقولولي

وين الخطا في هادا البرنامج

#include <stdio.h>
double product(float a[],int size);
#define size 100
main()
**

int f;
float a[];

printf("please enter size you want ");
scanf("%d", &size );
product ( a[], size );
printf("the product is %d",f);
return 0;
}



double product(float a[],int size )
**
double f=1;
int i;
for (i=0;i<size ;i++)
f*=a[i];
return f;
}

محمد عصام الدين
03-06-2006, 11:30 PM
السلام عليكم

أنا مش عارف أقرا أى سطر من هذا البرنامج لأن الكلام دخل فى بعض يا ريت لو تضعيه عل هيئه ملف word و لو قدرت أساعد ححاول و ياريت تذكرى اسم اللغه و إذا كان الخطأ هو أن البرنامج بيطلع output غير اللى عايزاه لأم خطأ فى صيغه الأمر

jerusalem rose's
04-06-2006, 12:18 AM
السلام عليكم شكرا كتير
بس عنجد انا مش قادرة اوجد الخطا
وهي الحل في المرفقات

محمد عصام الدين
04-06-2006, 06:20 PM
السلام عليكم

فى الواقع لا أعرف الكثير عن لغه ال ++C و لكنى لاحظت الاتى ( أتمنى أن أكون محقا )

#include <stdio.h>
double product(float a[],int size);

main()
**
const int size = 100; identify size as constant integer -----------1
int f; identify f as a float
float a[]; identify a[] as a float
printf("please enter size you want ");
2------------scanf("%d", &size ); take the size !!!!
product(a[],size ); Call function product
printf("the product is %d",f);
return 0;
}



double product(float a[],int size )
**
double f=1;
int i;
for (i=0;i<size ;i++)
f*=a[i]; get the product
return f; return to main function
}


لا أعرف أولا لماذا قمت بتعريف ال size على أنه ثابت مع أن المفروض أنه متغير و يقوم المستخدم بإدخاله ؟ ( سطر 1 ------- و 2 ------------ )

ثانيا لا أعلاف أن السطر الخاص بإدخال عناصر المصفوقه []a حيث لم ألاحظ و جود هذا الامر !!

و أخير أعتقد أن البرنامج يقوم بإخراج رقم ثابت كل مره عباره عن حاصل ضرب الأعداد من 1 إلى 100 !!
( و الله أعلم !! )

و للأسف ليس عندى اللغه لأجربها

و شكرا أتمنى أن أكون محقا و وفقك الله

jerusalem rose's
04-06-2006, 08:50 PM
السلام عليكم


اول شي شكرا كتير


ثاني شي اسفة على الازعاج باسئلتي الكثيرة

محمد عصام الدين
04-06-2006, 11:24 PM
أول شي العفو

ثانى شي لا يوجد إزعاج