السلام عليكم
الاخوه والاخوات الكرام
عندي هذا السؤال :
Write a C++ program to read price and number of item, and then calculate the total cost.
The output should be as following:
Enter the price: 50
Enter the number of item: 3
Do you want to enter another(Y/N: Y
Enter the price: 90
Enter the number of item: 1
Do you want to enter another(Y/N: N
The total cost is 240
^^ طبعا هذا اللي بيظهر على السكرين ..
بديت في كتابة الرنامج ولكن وصلت الى عباره:
Do you want to enter another(Y/N: Y
وتوقفت لم استطع الاكمال ..
هل هي جمله شرط واحلها بال IF او forاو bool او شي اخر ..
مع العلم بأني مبتدئه لم ندرس بعد الفور والوايل < اللوب بشكل عام..
حاولت اكتب الحل بأحدى الطرق وكل ماوسيت رن مايضبط معاي ..
اذا تكرمتوا ممكن مساعده ..
هذا البرنامج اللي كتبت
#include<iostream.h>
int main()
{
int x; //price1
int y; //number of item1
int z; //price2
int w; //number of item2
cout<<"Enter the price:"<<x<<endl;
cout<<"Enter tht number of item:"<<y<<endl;
cin>>x;
cin>>y;
cout<<"Enter the price:"<<z<<endl;
cout<<"Enter tht number of item:"<<w<<endl;
cin>>z;
cin>>w;
cout<<"Tht total cost is"<<(x*y)+(z*w)<<endl;
return 0;
}
طبعا التوتل بيكون حاصل جمع السعر في العدد مرتين ..
ممكن تفهموني واكون شاكرررررررررررررررررررره لكم/|/|/|/|/|/|
