Advanced Search

المحرر موضوع: C++  (زيارة 563 مرات)

0 الأعضاء و 1 ضيف يشاهدون هذا الموضوع.

أبريل 07, 2003, 04:48:27 مساءاً
زيارة 563 مرات

linda

  • عضو مبتدى

  • *

  • 12
    مشاركة

    • مشاهدة الملف الشخصي
C++
« في: أبريل 07, 2003, 04:48:27 مساءاً »
السلام عليكم ورحمة الله وبركاته
If you have this table
The Car Model Price
BMW 300.000.00 S.R
GMC 200.000.00 S.R
Honda 70.000.00 S.R
Nissan 50.000.00 S.R
Mazda 35.000.00 S.R

write a program to ask the customer
Ask the customer,if he wants to buy a car with a price not less than a given car price ? if the custome ranswer Yes,display the list of car names and it's price as shown in the table
?
After he selects a car with a given car price,ask the user of which

color "Red,Black,Blue,White"he wants
?
Display the result of the car model,prices and color
(e.g:you buy(BMW)car,with(300.000.00 S.R
(it's coloris (Black



في بداية البرنامج يوجد شرط اذاكان يبغى يشترى سيارة أم لاولابد أن نسأل المستخدم عن المبلغ الذي في جيبه اذا كان لايناسب اسعار السيارات يخرج من البرنامج واذا كان يناسبها نسأله عن نوع السيارة ثم أعطيه قائمةبأنواع السيارات(switch)عند اختيار أي سيارة يقارن المبلغ يكفي أولايكفي اذا كان يكفي يرى لون السيارة.
مع ملاحظة لابد من استخدامswitch, if, Bolean.

#include
void main()
{
char color; // want رغبة المستخدم
double price;
int car,want;
cin>>want;
if(want!=0);
{
cin>>price;
if((price>35.000.00);
{
cout<<"\n1=BMW\n";
cout<<"\n2=GMC\n";
cout<<"\n3=Honda\n";
cout<<"\n4=Nissan\n";
cout<<"\n5=Mazda\n";
switch(car)
{
case 1:cout<<"BMW 3\n";
break;
case 2:
cout<<"GMC 2";
break;
case 3:
cout<<"zhonda 7\n";
break;
case 4:
cout<<"Nisan 5\n";
break;
case 5:
cout<<"Mazda35\n";
break;

cout<<"\nR=Red\n";
cout<<"\nb=black\n";
cout<<"\nB=blue\n";
cout<<"\nW=white\n";
}
switch(color)
{
case'R':cout<<"\nRed\n";
break;
case 'b':cout<<"\nblack\n";
break;
case'B':cout<<"\nblue\n";
break;
case 'w':cout<<"\nWhite\n";


}
cout<<"you buy"<}