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

ممكن تساعدوني في حل السؤال ع الماتركس؟

بدأه ab0od في 13 يونيو 2011 · 10 رد · 650 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

شركة مبيعاتِ لَها الفروعُ في كُلّ مِنْ المُدنِ الـ10: A, B, C, D, E, F, G, H, I, and J . اكتب برنامج لقِراءة كميةِ المبيعاتِ لكُلّ مِنْ الفروعِ الـ10 في أشهر السّنةِ الـ12 ويَخْزنُهم في10*12 مصفوفة. البرنامج يَجِبُ أَنْ يَقْرأَ مبيعاتَ كُلّ فرع على صف منفصل ويَجِبُ أَنْ يَخْزنَ مبيعاتَ كُلّ فرع في واحد مِنْ صفِّ المصفوفةِ. All sales amounts are in double values. البرنامج يَجِبُ أَنْ يُنتجَ التالي:

المبيعات الكليّة لكُلّ فرع.

المبيعات الكليّة لكُلّ مِنْ الشهورِ الـ12.

جِدْ الفرعَ الذي لَهُ المبيعاتُ القصوى الكليّةُ.

جِدْ الشهرَ الذي فيه الشركةَ لَها المبيعاتُ الكليّةُ الدنياُ إجمالاً فروعِها

#include <iostream.h>
void main()
{
	float sales[10][12];

int row,col;
float sum=0,total=0,max=0;
char ch;




         for(row=0;row<10;row++)
		 {

cout<<"Branch  ";cin>>ch;

sum=0;

			 for(col=0;col<12;col++)
			 {



				 cin>>sales[row][col];

			 sum+=sales[row][col];
			 total+=sum;
			 if(sum>max)
				 max=sum;



			 }
			 cout<<"the amount of sales branch "<<ch<<" is "<<sum<<endl;

		 }

cout<<"the total sales for each of 12 months is "<<total<<endl;
cout<<"the branch that has the total maximum sales is "<<max;


}

تم تعديل هذه المشاركة بواسطة ab0od في 13 يونيو 2011 في 00:36

1
#2

السلام عليكم

الكود ناقصو شوي من القياسات للغة ++C

ولكن وين المشكلة بالضبط؟

شكراً

تم تعديل هذه المشاركة بواسطة ♥ حُوريّة ♥ في 13 يونيو 2011 في 00:53

[وسط]

♥ Countess ♥

57899411.gif

♥

[/وسط]

#3
♥ حُوريّة ♥ كتب:

السلام عليكم

الكود ناقصو شوي من القياسات للغة ++C

ولكن وين المشكلة بالضبط؟

شكراً

يعني الحل صح ؟

#4
ab0od كتب:

يعني الحل صح ؟

يعني أنت عامل مراجعة واختبار للبرنامج لو كان صح ويعطي نتائج مضمونة ضمن السيناريو؟

وبتواجهك مشكلة معينة؟

آسفة للتقصير

Bye

[وسط]

♥ Countess ♥

57899411.gif

♥

[/وسط]

#5
♥ حُوريّة ♥ كتب:

يعني أنت عامل مراجعة واختبار للبرنامج لو كان صح ويعطي نتائج مضمونة ضمن السيناريو؟

وبتواجهك مشكلة معينة؟

آسفة للتقصير

Bye

انا مش متأكد من الحل ...واخر فرع مش محلول ...يا ريت تتأكديلي منو

شكرا

#6

تعديل على بعض الاخطاء في الكود الخاص بك

 #include <iostream>
    using namespace std;
    int main()
    {
            float sales[10][12];

            int row,col;
            float sum=0,total=0,max=0;
            char ch;

            for(row=0;row<10;row++)
            {

              cout<<"Branch  ";cin>>ch; 
              sum=0;

              for(col=0;col<12;col++)
              {                      
                   cout << "Sales for the " << col+1 << " month"<<endl;
                   cin>>sales[row][col];

                   sum+=sales[row][col];
                   total+=sales[row][col];


              }
              if(sum>max)
                   max=sum;
              cout << "total " << total<<endl;
              cout<<"the amount of sales branch "<<ch<<" is "<<sum<<endl;

    }

    cout<<"the total sales for each of 12 months is "<<total<<endl;
    cout<<"the branch that has the total maximum sales is "<<max;


    }

لاحظ انه كان لديك خطأ في حساب المجموع total في حساب القيمه القصوى max

بالنسبه للمطلوب الاخير اعمل متغير smallest بنفس طريقة max ولكن اعكس المنطق

تم تعديل هذه المشاركة بواسطة mental-driller في 13 يونيو 2011 في 17:55

No intellectual battle was ever won through retreat
You do not watch Gintama? Dude, you are missing a lot!


صورةmsrgb1485.gif ocajavase7programmerclr.gif

#7
mental-driller كتب:

تعديل على بعض الاخطاء في الكود الخاص بك

 #include <iostream>
    using namespace std;
    int main()
    {
            float sales[10][12];

            int row,col;
            float sum=0,total=0,max=0;
            char ch;

            for(row=0;row<10;row++)
            {

              cout<<"Branch  ";cin>>ch; 
              sum=0;

              for(col=0;col<12;col++)
              {                      
                   cout << "Sales for the " << col+1 << " month"<<endl;
                   cin>>sales[row][col];

                   sum+=sales[row][col];
                   total+=sales[row][col];


              }
              if(sum>max)
                   max=sum;
              cout << "total " << total<<endl;
              cout<<"the amount of sales branch "<<ch<<" is "<<sum<<endl;

    }

    cout<<"the total sales for each of 12 months is "<<total<<endl;
    cout<<"the branch that has the total maximum sales is "<<max;


    }

لاحظ انه كان لديك خطأ في حساب المجموع total في حساب القيمه القصوى max

بالنسبه للمطلوب الاخير اعمل متغير smallest بنفس طريقة max ولكن اعكس المنطق

اخي ممكن حل السؤال كامل...

وشكرا

#8

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

No intellectual battle was ever won through retreat
You do not watch Gintama? Dude, you are missing a lot!


صورةmsrgb1485.gif ocajavase7programmerclr.gif

#9
mental-driller كتب:

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

اخر فرع من السؤال Find the month in which the company has the minimum total sales in all of its branches مش عارف كيف احلو...ممكن تساعدني؟

#10

في المتغير smallest بدل ما تخزن قيمة المجموع اخزن رقم الشهر اللي هو رقم اللوب col بس بما انك تبدأ اللوب من 0 يعني col+1

No intellectual battle was ever won through retreat
You do not watch Gintama? Dude, you are missing a lot!


صورةmsrgb1485.gif ocajavase7programmerclr.gif

#11
mental-driller كتب:

في المتغير smallest بدل ما تخزن قيمة المجموع اخزن رقم الشهر اللي هو رقم اللوب col بس بما انك تبدأ اللوب من 0 يعني col+1

يعني هيك الحل الكامل يا ريت تتأكدلي منو بليزز

 /*A sales company has branches in each of the 10 cities: A, B, C, D, E, F, G, H, I, and J. 
Write a C program to read the amount of sales for each of the 10 branches in the 12 months of the year and store 
them in a 3x6 matrix. The program should read the sales of each branch on a separate row and should store the sales 
of each branch in one row of the matrix. All sales amounts are in double values. The program should output the following:

    The total sales for each branch.
    The total sales for each of the 12 months.
    Find the branch that has the total maximum sales.
    Find the month in which the company has the minimum total sales in all of its branches.*/
#include <iostream.h>
void main()
{

	float x[11][13];

	int i,j,n;

	float total=0,sum=0,max=0,min,t=0;


	for ( i=0;i<10;i++)
	{

sum=0;
t=0;

		for( j=0;j<12;j++)
		{

			cin>>x[j];


		sum+=x[j];
		x[5]=sum;

		t+=x[j];

		x[3]=t;
min=x[3][0];
		if(x[3]<min)
			min=x[3];



		if(x[5]>max)
			max=x[5];
		n=i+1;;


			;



		}
		total+=x[5];


		cout<<" The total sales for  branch is "<<x[5]<<endl;


	}




       cout<<" The total sales for each of the 12 months "<<total<<endl;
	   cout<<" the branch that has the total maximum sales "<<max<<endl;
	   cout<<" the month in which the company has the minimum total sales in all of its branches is "<<n<<endl;

















}

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

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…