اذهب إلى المحتوى
  • -1

حل لهذا البرنامج ب c++

Mohamed abdelaziz2

السؤال

.Assignment
 A sweatshirt manufacturer wants to take inventory of the college logo sweatshirts that it 
has in stock. The company makes sweatshirts for seven colleges. Refer to the colleges by 
number, 17. Sweatshirts come in four sizes: small, medium, large, and x-large. An 
employee gathers the inventory information by hand. Write a program that prompts the 
employee to enter the number of sweatshirts in stock for each of the seven colleges in 
each of the four sizes. Store the inventory information in a two dimensional array. After 
inputting the inventory data, the program should display an inventory report in the 
following format. 
Inventory Report College
 

 l   2 3  4  5  6  7    total
                                              Small 
                                           Medium 
                                              Large 
                                            XLarge
                                         College Total 
                         Total Quantity On Hand 
At the end of each row should be the total inventory for that size. At the bottom of each 
column should be total inventory of each college. The Total Quantity On Hand should be 
the total inventory of all sweatshirts.

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 0

ممكن بهذا الشكل.

 

#include <iostream>


using namespace std;

#define colleges 7
#define OtherOptionsRow 1
#define OtherOptionsCol 1

char size[4][25] = {
    "Small", "Medium", "Large", "XLarge"
};

unsigned int savedata[colleges + OtherOptionsRow][4 + OtherOptionsCol], TotalAll = 0;
int main(int c, char **g)
{
    // Input & Calc
    for (int college = 0; college < colleges; college++)
    {
        cout << endl << "College Details ( " << college+1 << " )" << endl;
        savedata[college][4] = 0;
        for (int sizeidx = 0; sizeidx < 4; sizeidx++)
        {
             cout << "\t" << "Count Size " << size[sizeidx] << " ";
            cin >> savedata[college][sizeidx];
            cout << savedata[college][sizeidx];
            savedata[college][4] += savedata[college][sizeidx];
        }

    }
    cout << endl << endl;

    // Output
    cout << "\t" << "\t" << "\t";
    for (int college = 1; college <= colleges; college++)
    {
        cout << college << "\t";
    }
    cout << "Total" << endl;
    
    int sizeidx = 0;
    for (; sizeidx < 4; sizeidx++)
    {
        cout << size[sizeidx] << "\t\t\t";
        savedata[colleges][sizeidx] = 0;
        for (int college = 0; college < colleges; college++)
        {
            savedata[colleges][sizeidx] += savedata[college][sizeidx];
            cout << savedata[college][sizeidx] << "\t";
        }
        cout << savedata[colleges][sizeidx] << endl;
    }
    cout << "College Total\t\t\t";
    for (int college = 0; college < colleges; college++)
        {
            TotalAll += savedata[college][sizeidx];
            cout << savedata[college][sizeidx] << "\t";
        }
    cout << endl << "Total Quantity On Hand  " << TotalAll << endl;

}


 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...