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

كود بلغه c++واستخدام الفنكشن

بدأه سرمد الليل في 18 مارس 2010 · 10 رد · 1,882 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمته الله وبركاته

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

وهذا السوال:

Write a program that compute and display the suitable size of clothing (Hat , Jacket

chest, and waist) by asking the user about his weight, height, and age.

Hint :- your program should contain these three functions:-

Hat_size() that calculate the hat size by using this equation

• Hat size =(weight/height)*2.9

Jacket_chest_size() that calculate the Jacket chest size by using this equation

• Jacket chest size ={[(weight*height)/288]+1/8} *(ageOver30/10)

Waist_size() that calculate the waist size by using this equation

• Hat size =[(weight/5.7)+(1/10) ]*(ageOver28/2)

وهذا جوابى :

#include<iostream>

using namespace std ;

double weight;

double height;

int ageOver ;

double Hat_size;

double Jacket_chest_size ;

double Waist_size ;

void Hat_size(){

Hat_size =(weight/height)*2.9 ;

}

void Jacket_chest_size(){

Jacket_chest_size ={[(weight*height)/288]+1/8} *(ageOver30/10) ;

}

void Waist_size(){

Hat_size =[(weight/5.7)+(1/10) ]*(ageOver28/2);

}

int main ()

{

cout<<"plass Enter the age:\n" ;

cin>> ageOver ;

cout<<"plass Enter the weight: \n" ;

cin>> weight ;

cout<<"plass Enter the hight:\n" ;

cin>> height ;

Hat_size();

Jacket_chest_size();

Waist_size();

return 0;

}

ياليت اى احط يعرف الجواب الصحيح يحط الكود علشان نستفيد ونتجنب هذه الاخطا بالمستقبل

#2

في الصيغ الرياضه يجب تبديل الأقواس جميعا الي () فقط.

مثلا :

Jacket chest size ={[(weight*height)/288]+1/8} *(ageOver30/10)

تكتب:

Jacket chest size =(((weight*height)/288)+1/8) *(ageOver30/10)
tvquran_6.gif

#3

لديك مشكل ايضا في الدوال يجب ان يكون الاسم مختلف عن اسم المتغيرات

tvquran_6.gif

#4

مافهمت ياليت توضح لى اكثر او تكتب لى الكود الصيحيح

#5

هذا تعديل على الكود:

#include<iostream>
using namespace std ;

double weight;
double height;
int ageOver ;

double Hat_size(){
return (weight/height)*2.9 ;
}
double Jacket_chest_size(){
return (((weight*height)/288.0)+1/8.0) *(ageOver*30/10.0);
}
double Waist_size(){
return (((weight/5.7)+(1/10) ))*(ageOver*28/2);
}

int main ()
{

cout<<"plass Enter the age:\n" ;
cin>> ageOver ;

cout<<"plass Enter the weight: \n" ;
cin>> weight ;

cout<<"plass Enter the hight:\n" ;
cin>> height ;

cout<<Hat_size()<<endl;
cout<<Jacket_chest_size()<<endl;
cout<<Waist_size()<<endl;

return 0;
}
tvquran_6.gif

#6

بس مو لازم احط بالكود جمله شرط اذا عمره اكبر من 30 واذا اصغر والالا

#7

نعم يحتاج الي ذلك فقط تعديل بسيط في الدوال يفي بالغرض.

tvquran_6.gif

#8

طيب ممكن تحط لى الكود بعد التعديل لان بصراحه احط جمله الشرط ويطلع لى ارور

#9

بالله ابى الكوووووووووووود الصيحيح لهذا السواااال

#10

انتظررررررررررررررررر احد يحط لى الكود الصحيح ضرووووووووووووورى

#11

انتظررررررررررررررررر

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