الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مساعدة في برنامج ++cاليوم ضروري بلييييييييييييز

بدأه CuteAngel في 20 ديسمبر 2008 · 7 رد · 906 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

هذي أول مشاركة لي في المنتدى وأتمنى أحد يساعدني اليوم ضروري

عندي برنامج ومو عارفة كيف أحله

والله حاولت بس ما ضبط معي ياليت احد يساعدني

وهذا هو البرنامج

Write a program that asks the user's height, weight, and age, and the computes clothing

sizes according to the formulas:

1: Hat size = weight in pounds divided by height in inches and all that multiplied by 2.9.

2: Jacket size (chest in inches) = height times weight divided by 288 and the adjusted by adding 1/8 of an inch for each 10 years over age 30. (Note that the adjustment only takes place after a full 10 years, so there is no adjustment for ages 30 through 39, but 1/8 inch is added for age 40.)

3: Waist size = weight divided by 5.7 and then adjusted by adding 1/10 of an inch for each 2 years over age 28.(Note that the adjustment only takes place after full 2 years. So, there is no adjustment for age 29, but 1/10 of an inch is added for age 30.)

Use function for each calculation. The program should allow the user to repeat this calculation as often as the user wishes.

The out put should look like this: (this is an example)

Give me your height in inches, weight in pounds, and age in years

and I will give you your hat size, jacket size (inches at chest) and your waist size in inches.

69

185

50

Hat size= 7.78

Jacket size= 44.57

Waist size= 33.56

Enter y or Y to repeat, any other character ends.

Y

The out put should look like this : (this is an example)

Give me your height in inches, weight in pounds, and age in years

and I will give you your hat size, jacket size (inches at chest) and your waist size in inches.

ومشكورييييييين مقدما

تم تعديل هذه المشاركة بواسطة CuteAngel في 20 ديسمبر 2008 في 21:50

#2

ممتاز , حسنا ضع لنا محاولاتك حتى نتمكن من مساعدتك .

وحتى لايكون الموضوع مخالف :blush:

llback.jpg

اشهد ان لا إله إلا الله وان محمدا ً رسول الله

#3

مرحبااااا

هذه أحد محاولاتي

#include < iostream> 
using namespace std;

double hat_size(double weight, double height);

double jacket_size(double weight, double height);

double waist_size(double weight, int age);

int main()

{
char ans;

do
{ 

double weight, height, hat_size, jacket_size, waist_size;
int age;

cout <<"Give me your height in inches, weight in pounds,"
<<" and age in years\n"
<<"and I will give you your hat size, jacket size (inches at chest)\n"
<<"and your waist size in inches."
<< endl;

cin >> height >> weight >> age;

hat_size = hat_size(weight, height);

jacket_size = jacket_size(weight, height);

waist_size = waist_size(weight, age);


cout <<"Your Hat size is equal to " << hat_size << endl;
cout << endl; 
cout <<"Your jacket size is equal to " << jacket_size << endl;
cout << endl; 
cout <<"Your waist size is equal to " << waist_size << endl;


cout <<"Do you wish to repeat the program?"
<< endl;
cin >> ans;

} while ( ans == 'y'|| ans =='Y');

return 0;

}

double hat_size(double weight, double height);
{
return ((weight / height) * 2.9);
}

double jacket_size(double weight, double height);
{
if ( age < 40 )
{
jacket_size = (height * weight) / 288
}
else 
{
jacket_size = ((height * weight) / 288) + ((1.0/8.0) * ((age - 40)/10))
}
return ( jacket_size );
}

double waist_size(double weight, int age);
{ 
if ( age < 30 )
{
waist_size = weight / 5.7
}
else 
{
(weight / 5.7) + ((1.0/10.0) * ((age - 30) / 2 ))
}
return ( waist_size );
}

تم تعديل هذه المشاركة بواسطة time1 في 21 ديسمبر 2008 في 02:29 — السبب: تنسيق الكود

#4

أعتذر عن اللخبطة في الكود ماادري ليش الأقواس تطلع معكوسة :( حاولت أضبطها ما ضبطت

#5

وينكم يا مبرمجين ليش مااحد ساعدني

ترى والله أبغاه ضروري :(

ومو عارفه كيف أضبطه لأني مبتدئة في ++C

تم تعديل هذه المشاركة بواسطة CuteAngel في 21 ديسمبر 2008 في 20:10

#6

حسنا ,

لديكي مجموعة من الاخطاء , وسأحاول ذكر بعضها

اولا انتي تسمي المتغيرات باسماء دوال ويجب التفرقة بينهم , مثل :

jacket_size = jacket_size(weight, height);

يوجد لديكي دالة اسمها jacket_size , لذلك حاولي تغيير اسم المتغير إلى jacket مثلا ,

double weight, height, hat, jacket, waist;
jacket = jacket_size(weight, height);

ثانيا , انتي قمتي بالتصريح عن الدالة في اعلى الكود , والان في اسفل الكود بعد الـ Main قمتي بكتابة تعريف كل دالة , وطالما انه تعريف دالة اذا يجب ان لاتنتهي بفاصلة منقوطة ,

double hat_size(double weight, double height)

بعد ذلك في الدالة Jacket_size

double jacket_size(double weight, double height)
{
if ( age < 40 )
{
jacket_size = (height * weight) / 288
}
else 
{
jacket_size = ((height * weight) / 288) + ((1.0/8.0) * ((age - 40)/10))
}
return ( jacket_size );
}

اين هو تعريف المتغير age ؟

ايضا بعد كل تعليمة يجب ان تنتهي بفاصلة منقوطة ,

ايضا يجب التفريق بين اسماء المتغيرات وبين اسماء الدوال ,

واخيرا , هذا البرنامج بعد تصحيح الاخطاء , جربته على المثال واعطى النتائج المطلوبة , جربيه وان شاء الله يطلع تمام ,

#include < iostream> 
using namespace std;

double hat_size(double weight, double height);

double jacket_size(double weight, double height,double age);

double waist_size(double weight, int age);

int main()

{
char ans;

do
{ 

double weight, height, hat, jacket, waist;
int age;

cout <<"Give me your height in inches, weight in pounds,"
<<" and age in years\n"
<<"and I will give you your hat size, jacket size (inches at chest)\n"
<<"and your waist size in inches."
<< endl;

cin >> height >> weight >> age;

hat = hat_size(weight, height);

jacket = jacket_size(weight, height,age);

waist = waist_size(weight, age);


cout <<"Your Hat size is equal to " << hat << endl;
cout << endl; 
cout <<"Your jacket size is equal to " << jacket << endl;
cout << endl; 
cout <<"Your waist size is equal to " << waist << endl;


cout <<"Do you wish to repeat the program?"
<< endl;
cin >> ans;

} while ( ans == 'y'|| ans =='Y');

return 0;

}

double hat_size(double weight, double height)
{
return ((weight / height) * 2.9);
}

double jacket_size(double weight, double height,double age)
{
	double jacket;
if ( age < 40 )
{
jacket = (height * weight) / 288;
}
else 
{
jacket = ((height * weight) / 288) + ((1.0/8.0) * ((age - 40)/10));
}
return ( jacket );
}

double waist_size(double weight, int age)
{ 
double waist;
	if ( age < 30 )
{
 waist = weight / 5.7;
}
else 
{
 waist=(weight / 5.7) + ((1.0/10.0) * ((age - 30) / 2 ));
}
return ( waist);
}
llback.jpg

اشهد ان لا إله إلا الله وان محمدا ً رسول الله

#7

مشكووور أخوي تسلم والله تعبتك معي و حاولت أشغل البرنامج بالكود اللي صححته لي بس ما يشتغل ويطلع لي هذه الأخطاء

error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

fatal error LNK1120: 1 unresolved externals

فما ادري إذا الخلل من نفس البرنامج عندي ولا كيف؟ :(

#8

لا اعلم ماهو المترجم , لكن على كل حال , جربي تعملي مشروع جديد وتجربي الكود من خلاله .

llback.jpg

اشهد ان لا إله إلا الله وان محمدا ً رسول الله

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…