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

ابغى فكره هالبرنامج الله يعافيكم ضروري

بدأه مريتعي في 3 نوفمبر 2008 · 4 رد · 559 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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

اخواني الاعزاء

ارجو مساعدتي في هذا البرنامج

انا لا اريد الحل بس ابغى الفكره وشي :blush:

يعني وش احط زي كذا

هذا البرنامج

Write aprogram that manges your cooking guid the cooking guid include many types of dishes each dish has name ingredients and procedure the program shouid give you the following services :add new dish ,view the names of dishes and view specific dish

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

جزاكم الله الفردوس الاعلى

والي بساعدني له دعوه في اخر الليل :wub:

#2

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

شباب انا حاولت احل وانتظركم تصححون اخطائي علما بان البرنامج بلغه سي بلس بلس

امانه انكم تساعدوني تراني مره متعقده من السي بلس بلس

ارجووووووووووووووووووووووووووووووووووووووووووووووووووووووووووووووووووووووووووووو

ووووووووووووووووووووووووووووووووووووووووووووكم لاتطنشوني

حلي

  1.  
  2. # include <iostream>
  3. #includ<string>
  4. using namespace std;
  5. class dish
  6. {
  7. private
  8. string name;
  9. string ingredients;
  10. string procedure;
  11. public:
  12. void setname(string n)
  13. {
  14. n=name;
  15. }
  16. string getname()
  17. {
  18. return name;
  19. }
  20. void set ingredients(string i))
  21. {
  22. i= ingredients}
  23. string get ingredients()
  24. {
  25. return ingredients;}
  26. void setprocedure(string p)
  27.  
  28. {
  29. p=procedure;
  30. }
  31. string getprocedure()
  32. {
  33. return p;
  34. }
  35. };
  36. class cookingguid
  37. {
  38. private:
  39. dishes;
  40. maxnumber of dishes;
  41. number of dish;
  42. cookingguid()//creat constructor defult
  43. {
  44. dishes=newdish[5];
  45. number of dish=0;
  46. maxnumber of dishes=5;
  47. }
  48. void addnewdish(string dish)
  49. {
  50. cout<<"Enter dishes for added:"
  51. cin>>dish;
  52. dishes+=dish;
  53. }
  54. void viewdishesname()
  55. {
  56. cout<<getname();
  57. }
  58. void viewspecificdish()
  59. {
  60. for(int i=0;i<maxnumber of dishes;i++)
  61. {
  62. cout<<"Enter number of dishes you whant view:";
  63. cin>>i;
  64. {
  65. if(i<=maxnumber of dishes)
  66. {
  67. cout<<"The spesific dishes is:'<<dish;
  68. else
  69. cout<<"sorry invild number:";
  70. }
  71. }
  72. }
  73. };
  74. int main()
  75. {
  76. string n;
  77. int x;
  78. dish d1;
  79. d1.setname;
  80. cout<<d1.getname;
  81. d1.setingredients;
  82. cout<<d1.getingredients;
  83. d1.setprocedure;
  84. cout<<d1.getprocedureك
  85. cookingguid d2;
  86. cout<<"Welcom in my cooking guid!";
  87. cout<<"************Enter 1 for add new dish**********n";
  88. cout<<"**************Enter 2 for veiw dish name*************n";
  89. cout<<"***************Enter 3 for view spacific dish**********n";
  90. cout<<"*************Enter -1 for exist***************"<<endl;
  91. do
  92. {
  93. switch(x)
  94. {
  95. case 1: d2.addnewdish(n);
  96. break;
  97. case 2:d2.viewdishesnam();
  98. break;
  99. case 3:d2.viewdishesname();
  100. defult;
  101. }
  102. while(x!=-1);
  103. cout<<"Thankyou for use my cooking guid and good buy:";
  104.  

تم تعديل هذه المشاركة بواسطة فهدالشلوي في 4 نوفمبر 2008 في 02:43

#3

الكود يحتوي أخطاء كثيرة في التسمية و تمرير القيم والنقاط.

مثلا لا يصلح الاسم ان يكتب من جزئين منفصله. set ingredients المفروض يكتب setingredients

هنا ايضا

  1. void setprocedure(string p)
  2. p=procedure;
  3. {}
  4.  

المفروض تكون

  1. void setprocedure(string p)
  2. procedure=p;
  3. {}
  4.  

راجع كودك وعدله وحاول فيه اكثر.

tvquran_6.gif

#4

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

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

شفت كودي ولقيت فيه اخطاء سخيفه وهذا انا عدلتها

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

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

# include <iostream>
using namespace std;
# include <string.h>

class dish
{
private:
string name;
string ingredients;
string procedure;
public:
void setname(string n)
{
name=n;
}
string getname()
{
return name;
}
void setingredients(string i)
{
 ingredients=i;}
string getingredients()
{
return ingredients;}
void setprocedure(string p) 
{
procedure=p;
}
string getprocedure()
{
return p;
}
};
class cookingguid
{
private:
string *dishes;
int maxnumberofdishes;
int numberofdish;
public:
cookingguid()//creat constructor defult
{
string *dishes=new string[5];
if(!dishes)
{cout<<"Allocation failure.\n";exit(1);}

int numberofdish=0;
int maxnumberofdishes=5;
}
~cookingguid()
{ delete [] dishes;
dishes=NULL;
}

string addnewdish(string dish)
{
cout<<"Enter dishes for added:";
cin>>dish;
 dishes+=dish;
 return dishes;
}
void viewdishesname()
{
cout<<getname();
}
void viewspecificdish()
{if(int j<=maxnumberofdishes)

for(int i=0;i<=maxnumberofdishes;i++)
{
cout<<"Enter number of dishes you whant view:";
cin>>i;
cout<<"The spesific dishes is:"<<dish;
else
cout<<"sorry invalid number:";
}
}
};
int main()
{
string n,i,p;
int x;
dish d1;
d1.setname(n);
cout<<d1.getname();
d1.setingredients(i);
cout<<d1.getingredients();
d1.setprocedure(p);
cout<<d1.getprocedure();
cookingguid d2;
cout<<"Welcom in my cooking guid!";
cout<<"************Enter 1 for add new dish**********\n";
cout<<"**************Enter 2 for veiw dish name*************\n";
cout<<"***************Enter 3 for view spacific dish**********\n";
cout<<"*************Enter -1 for exist***************"<<endl;
do
{
switch(x)
{
case 1: d2.addnewdish(n);
break;
case  2:d2.viewdishesnam();
break;
case 3:d2.viewdishesname();
defult;
}
while(x!=-1);
cout<<"Thankyou for use my cooking guid and good buy:";
return 0;
}

تم تعديل هذه المشاركة بواسطة time1 في 5 نوفمبر 2008 في 22:04

#5

في هذا السطر لديك خطاء

  1.  
  2. string getprocedure()
  3. {
  4. return p;
  5. }
  6.  

المتغير p ليس معرف اصلا ؟

عدل هذا الخطاء وابحث اكثر يجب ان تحاول اكثر.

tvquran_6.gif

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