المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : اريد المساعدة ضروري


soma ana
09 - 12 - 2010, 23:59
لو سمحتوا اريد حل هذه البرامج بلغه السي ضروري جدا
ارجوا المساعده لاتخذلوني

Write a program that reads a date of the format dd/mm/yyyy from standard input and returns it in the form Month Name dd, yyy. For example, the date 10/06/2010 should be converted to June 10, 2010.

Write a program that reads a temperature in degree Celsius from standard input and returns it equivalent in degree Fahrenheit.

Write a function that calculates the average of a set of n numbers stored in an array.

Write a function that returns the number of positive integers among n integers stored in an array.

الحسني
10 - 12 - 2010, 03:35
اهلا اخي ..
السؤال الاول :

string date =" ";
cout << "Enter your date of birth as : (dd/mm/yyyy)" << endl;
cin >> date;

string day = date.substr( 0, 2 );
string month = date.substr( 3, 2 );
string year = date.substr( 6, 10 );



بالنسبة للتحويل الاشهر من الارقام الى كتابة :

if( month == "01")
{
month = "January";
}
else if ........

الحسني
10 - 12 - 2010, 03:41
السؤال الثاني :
اول شي احسب الفرق بين درجة Celsius و Fahrenheit ..
وبعد ماتقرا من الinput من اليوزر .. ضيف له قيمة الفرق ..

السؤال الثالث :
الافرج = مجموع القيم على عددها ...
استخدم loop عشان تقرا جميع بيانات الاراي ..وبعدين اقسمهم على length of array

السؤال الرابع :
نفس السؤال الرابع بس استخدم if statment عشان تشيك اذا كان (<0) اكبر من صفر او لأ !!

جرب حل وبنساعدك !!

soma ana
10 - 12 - 2010, 04:01
# include <stdio.h>
int main(){
double c,f ;
printf("emperature in degree Celsius>>");
scanf("%lf",&c);
f=(c*1.8)+32;
printf("degree in fahrenheit is %.2f\n",f);
return( 0 );
}
دا اللي قدرت احله بالسؤال الثاني
________________________________________________
# include <stdio.h>
double avr (){
int x[10]={1,2,3,4,5,6,7,8,9,10};
double sum =0, av;
int i;
for ( i=0;i<10;i++ )
{
sum = sum + x[i];
}

av=sum/10;
return(av);
}
int main(){

printf("avrage is %f\n",avr());

return( 0 );
دا السؤال الثالث
___________________________________________
حقت positive ماعرفت احله صح

soma ana
10 - 12 - 2010, 04:04
ياليت تصححلي اخطائي ... وتقلي كيف اسوي السؤال الاخير
وشكرا جزيل الشكر على مساعدتك لي
جعلها الله في ميزان حسناتك
الله يوفقك يارب
شاكرة لك

الحسني
11 - 12 - 2010, 23:40
# include <stdio.h>
int main(){
double c,f ;
printf("emperature in degree Celsius>>");
scanf("%lf",&c);
f=(c*1.8)+32;
printf("degree in fahrenheit is %.2f\n",f);
return( 0 );
}
دا اللي قدرت احله بالسؤال الثاني
________________________________________________
# include <stdio.h>
double avr (){
int x[10]={1,2,3,4,5,6,7,8,9,10};
double sum =0, av;
int i;
for ( i=0;i<10;i++ )
{
sum = sum + x[i];
}

av=sum/10;
return(av);
}
int main(){

printf("avrage is %f\n",avr());

return( 0 );
دا السؤال الثالث
___________________________________________
حقت positive ماعرفت احله صح

حلك صحيح اختي ..

السؤال الثالث :
int main ()
{

int x[10]={1,-2,3,-4,5,6,-7,8,-9,10};
for (int i=0;i<10;i++ )
{
if (x[i]>=0)
cout <<x[i]<<endl;

}