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

محتاج مساعدة ضروري لتصحيح هذا البرنامج

بدأه D3bugger في 5 مارس 2012 · 7 رد · 373 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

هذا البرنامج مطلوب مني اني اسلمه بكره , و عندي مشكلة ميش عارف ايه هي , احتاج لمن يستطيع مساعدتي ضروري

البرنامج المطلوب في المرفقات , و ما توصلت إليه ايضآ في المرفقات

احتاج المساعدة في اسرع وقت ممكن

post-258566-010996600 1330965249_thumb.j

pro.txt

المرفقات
pro.jpg
#2

هناك تعديل يسيط ويعمل البرنامج راجعة

#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
    int type, vehicles_class;
    double registration_fee = 0, total_registration_fee = 0, surcharge = 0, additional_surcharge = 0;
    cout << "The DMV classifies automobiles as (type 1) for Luxury,or (type 2) for all others" << endl;
    cout << "For Luxury ,Please enter 1 ,or for others ,Please enter 2 :";
    cin >> type;
    cout << endl;
    if (type = 1)
    {
        registration_fee = 35;
        surcharge = 15;
        total_registration_fee = registration_fee + surcharge;
        cout << "The DMV also classifies automobiles as City vehicle (class 1) , or non-city vehicle (class 2). \n" << endl;
        cout << "An automobile that is registered in the city of Metropolis , must pay an additional surcharge of $20 .\n" << endl;
        cout << "For City vehicle ,Please enter 1 ,or for non-city vehicle ,Please enter 2 :";
        cin >> vehicles_class;
        cout << endl;
        if (vehicles_class = 1)
        {
            registration_fee = 35;
            additional_surcharge = 20;
            total_registration_fee = registration_fee + additional_surcharge;
        }
        else if (vehicles_class = 2);
        {
            registration_fee = 35;
            total_registration_fee += registration_fee;
        }
    }
    else (type = 2);
    {
        registration_fee = 35;
        total_registration_fee += registration_fee;
    }


    cout << "Total registration fees=" << " $ " << total_registration_fee << endl;

    system("pause");
    return 0;
}

والله ولى التوفيق

post-15367-027053900%201340345097.gifpost-15367-087183200%201340344597.gif
post-247365-0-10080400-1379403554_thumb.

#3

اخي الكريم محمد شكرآ لك علي مرورك

ولكني قد حاولات كثيرآ ولكني لم اصل لشئ , اعرف انها مشكلة if و else if ولكني لا اعرف حلها

فالو تكرمت اخي كتابة البرنامج مصحح و تفسر لي خطئ

#4

لست متأكده من الحل كثيرا ,و لكن جرب هذا ..:

#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
    int type, vehicles_class;
    double registration_fee = 0, total_registration_fee = 0, surcharge = 0, additional_surcharge = 0;
    cout << "The DMV classifies automobiles as (type 1) for Luxury,or (type 2) for all others" << endl;
    cout << "For Luxury ,Please enter 1 ,or for others ,Please enter 2 :";
    cin >> type;
    cout << endl;
    if (type == 1)
    {
        registration_fee = 35;
        surcharge = 15;
        total_registration_fee = registration_fee + surcharge;
        cout << "The DMV also classifies automobiles as City vehicle (class 1) , or non-city vehicle (class 2). \n" << endl;
        cout << "An automobile that is registered in the city of Metropolis , must pay an additional surcharge of $20 .\n" << endl;
        cout << "For City vehicle ,Please enter 1 ,or for non-city vehicle ,Please enter 2 :";
        cin >> vehicles_class;
        cout << endl;
        if (vehicles_class == 1)
        {
            registration_fee = 35;
            additional_surcharge = 20;
            total_registration_fee = registration_fee + additional_surcharge;
        }
        else if (vehicles_class == 2);
        {
            registration_fee = 35;
            total_registration_fee += registration_fee;
        }
    }
    else (type == 2);
    {
        registration_fee = 35;
        total_registration_fee += registration_fee;
    }


    cout << "Total registration fees=" << " $ " << total_registration_fee << endl;

    system("pause");
    return 0;
}
#5

البرنامج شغال و لكن في غلط في الحساب

أرجوا حل المشكلة

#6

أنا آسفه لكن لم افهم السؤال المطلوب منك جيدا بحكم اني مبتدئه :\ ..

بالتوفيق ..

#7

ولا يهمك اختي و شكرآ علي مساعدتك

#8

السلام عليكم أتمنى أن يكون هذا ما تريده

#include <iostream>
#include <cstdlib>
using namespace std;

int main(int argc, char * argv[]){
	int  vehicles_class = 0, city_class = 0;
	double registration_fee = 35.0;
	char check = 0;
	while(true){
    	cout << "The DMV classifies automobiles as (type 1) for Luxury,or (type 2) for all others" << endl;
    	cout << "For Luxury ,Please enter 1 ,or for others ,Please enter 2 :" << endl;
    	cin >> vehicles_class;
    	cout << "The DMV also classifies automobiles as city vehicles(class 1) or non-city vehicles(class 2)." << endl;
    	cin >> city_class;

    	if(vehicles_class == 1){
        	registration_fee += 15;
        	if(city_class == 1){
            	registration_fee += 20;
        	}
    	}
    	else{
        	if(city_class == 1){
            	registration_fee += 20;
        	}
    	}
    	cout << "Total registration fees = " << registration_fee << " $ " << endl;
    	cout << "\n\nif you want calculate another automoblies fee please type any key." << endl;
    	cout << "\nif you want to exit please type \"q \"." << endl;
    	cin >> check;
    	if(check == 'q'){
        	break;
    	}
    	registration_fee = 35;
	}
	system("pause");
	return 0;
}

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