موقع طلبة جامعة البحرين

يمكنك تصفح الموقع كزائر ولكن ندعوك لتسجيل عضوية خاصة بك لتحصل على كافة الصلاحيات مثل تنزيل ملفات المكتبة وقراءة تعليقات هيئة التدريس وغيرها. يمكنك الحصول على عضوية مجانية بالضغط على زر تسجيل. إذا قمت بالتسجيل مسبقا فيمكنك الضغط على زر دخول.

تسجيل دخول
  • قسم المكتبة الجامعية مغلق مؤقتا بعد الاستهداف التي تعرضت له بعض خدمات أمازون في البحرين، جاري استرجاع الملفات ونقلها إلى سيرفرات جديدة وسيتم بعدها اعادة افتتاح المكتبة

ITCS103 -CSC103-ITCS111-ITCS101 للدراسة و المناقشة الجماعيه 2014-2015

ما هو رأيك في الحصة و بشكل عام ( الشرح - المواضيع -الأسلوب )؟

  • سيئ ، لم أفهم شيئا .

    الأصوات: 9 28.1%
  • جيد ، فهمت نص و نص .

    الأصوات: 10 31.3%
  • ممتاز ، واضح و مقبول .

    الأصوات: 13 40.6%

  • مجموع المصوتين
    32
please check my solution ?
أختي الحل شبه صحيح بس فيه أغلاط بسيطة using namespace std; أنتي كتبتيها Using namespace std; ثاني شي الفنكشن الي سويتيهم الأفضل انش تكملينهم قبل المين و ما تحطينهم عقب الفاريبل و الستوتش المفروض قبل ، و الأفضل أنش تستخدمين الاف ستيتمنت بدل لسوتش في هذا النوع من الأسئلة الا أذا السوال نفسه طالب تستخدمين لستوتش يحتاج تعدليات بسيطة
 
ممكن حل ذي

Write the following functions:
Main: declare an array of size 7 with random numbers, call the following functions.
* PrintArray: prints the elements of the array.
* SumArray: Return the sum of elements of the array
 
سلام اخواني

ممكن المساعدة في حل هذا الاسايمنت مع الشرح والتوضيح ...وشكرا:RpS_lol:

PART A
One week temperature data has been recorded for 6 different cities. Write a function named findFreezingCitites(), that takes as parameters, a two-dimensional array of size 6 X 7, that contains cities temperatures in which each row represents a city and each column represents one-day temperature. The function should find and display the weekly average temperature for each freezing city. A city is considered freezing if the temperature is below 0 for at least four days in one week. Format the weekly average to 2 decimal places. For example, if the array temperatures, contains the following data: [TABLE="class: MsoTableMediumShading2Accent1"]
[TR]
[TD="width: 68"] [/TD]
[TD="width: 68"] 0 [/TD]
[TD="width: 68"] 1 [/TD]
[TD="width: 68"] 2 [/TD]
[TD="width: 68"] 3 [/TD]
[TD="width: 68"] 4 [/TD]
[TD="width: 68"] 5 [/TD]
[TD="width: 68"] 6 [/TD]
[/TR]
[TR]
[TD="width: 68"] 0 [/TD]
[TD="width: 68"] 5 [/TD]
[TD="width: 68"] 11 [/TD]
[TD="width: 68"] -1 [/TD]
[TD="width: 68"] -3 [/TD]
[TD="width: 68"] 0 [/TD]
[TD="width: 68"] 2 [/TD]
[TD="width: 68"] -2 [/TD]
[/TR]
[TR]
[TD="width: 68"] 1 [/TD]
[TD="width: 68"] 7 [/TD]
[TD="width: 68"] -4 [/TD]
[TD="width: 68"] 0 [/TD]
[TD="width: 68"] -2 [/TD]
[TD="width: 68"] 1 [/TD]
[TD="width: 68"] -5 [/TD]
[TD="width: 68"] -4 [/TD]
[/TR]
[TR]
[TD="width: 68"] 2 [/TD]
[TD="width: 68"] -2 [/TD]
[TD="width: 68"] -5 [/TD]
[TD="width: 68"] -5 [/TD]
[TD="width: 68"] -4 [/TD]
[TD="width: 68"] 3 [/TD]
[TD="width: 68"] 1 [/TD]
[TD="width: 68"] -1 [/TD]
[/TR]
[TR]
[TD="width: 68"] 3 [/TD]
[TD="width: 68"] 7 [/TD]
[TD="width: 68"] -4 [/TD]
[TD="width: 68"] -2 [/TD]
[TD="width: 68"] 0 [/TD]
[TD="width: 68"] 1 [/TD]
[TD="width: 68"] 4 [/TD]
[TD="width: 68"] 7 [/TD]
[/TR]
[TR]
[TD="width: 68"] 4 [/TD]
[TD="width: 68"] 2 [/TD]
[TD="width: 68"] 0 [/TD]
[TD="width: 68"] -1 [/TD]
[TD="width: 68"] -3 [/TD]
[TD="width: 68"] -5 [/TD]
[TD="width: 68"] -7 [/TD]
[TD="width: 68"] -7 [/TD]
[/TR]
[TR]
[TD="width: 68"] 5 [/TD]
[TD="width: 68"] -2 [/TD]
[TD="width: 68"] 0 [/TD]
[TD="width: 68"] 1 [/TD]
[TD="width: 68"] 2 [/TD]
[TD="width: 68"] 5 [/TD]
[TD="width: 68"] 4 [/TD]
[TD="width: 68"] 3 [/TD]
[/TR]
[/TABLE]
Then the output of the function should be: Freezing Cities Weekly Averages: City Average 2 -1.00 3 -1.85 5 -3.00 PART B Include the function read2d from the practical tutorial 4 to read the array data. PART 3 Write a main function to create the 2d array, read the data, and call the function findfreezingCities().
 
السلام عليكم ,
الصراحة تعبت وانا احاول احله , اللي يقدر يطلع لي الحل ضروري :RpS_crying: ,,


Assume that charges for delivering and handling packages for University of Success is as follow:
Weight in Kg Charge in BD
Less or equal to 5 5
Greater than 5 and Less or equal to 10 8 plus 10% of weight
Greater than 10 and Less than or equal to 30 12 plus 15% of weight
Greater than 30 20 plus 25% of weight
University of Success has four departments. Each department receives five packages of books. Write a C++ program that will ask the user for the weight of each package in Kg for each department. The program should then compute the total weight and the net charge for all the packages for each department according to the table above. Your program should print a table showing the weight, total weight, and the charge for each department as shown below.
Use a two-dimensional array to store the weights.
The PROGRAM RUN should be:
Enter the weights for department # 1 : 2 3 2 1 2
Enter the weights for department # 2 : 5 8 2 9 3
Enter the weights for department # 3 : 7 2 4 1 2
Enter the weights for department # 4 : 3 4 6 8 1

Pakages 1 2 3 4 5 Total Charge
Department 1 2 3 2 1 2 10 9
Department 2 5 8 2 9 3 27 16.05
Department 3 7 2 4 1 2 16 14.4
Department 4 3 4 6 8 1 22 15.3
​
 

​
كود:
[LEFT]#include <iostream> 

using namespace std;

int main()
{ 
    int w[4][5];

     for (int r=0 ; r<=3 ; r++ ) [B]// reading the array[/B]
    {cout << "Enter the weights for department # "<< r+1 <<":";
    
    for (int c=0 ; c<=4 ; c++)
    { cin >> w[r][c]; }}
    cout <<endl; 
    
[B]    //print the first line[/B]
   cout << "Packages\t 1 2 3 4 5\tTotal\tCharge"<<endl; 
       

    for (int r=0 ; r<=3 ; r++ ) [B]// print the array[/B]
    {cout << "Department" << r+1 <<"\t";
    int sum =0 ;
    for (int c=0 ; c<=4 ; c++)
    {cout << " " <<w[r][c];
    sum += w[r][c]; [B]// finding the sum for each array[/B]
    }
    float charge=0; // count the charge
    if (sum <=5)
    charge = 5 ;
    else if (sum >5 && sum <=10)
    charge = 8 + (sum*0.1) ;
    else if (sum >10 && sum <=30)
    charge = 12 + (sum*0.15) ;
    else if (sum > 30)
    charge = 20 + (sum*0.25) ;
    
  [B]   // print the sum and the charge[/B]
     cout << "\t" << sum <<"\t"<< charge ;
     
    cout << endl;} 
    
    
    
system ("pause");
return 0;   
}
[/LEFT]
[RIGHT] 
[/RIGHT]
Output

​
 

المرفقات

  • Two-Dimensional Array.webp
    Two-Dimensional Array.webp
    13.6 KB · المشاهدات: 33
(A)
The rainfall figures in mm are available for each day of the past four weeks. Write a function generateReport() that displays the maximum rainfall for each week. The function takes as parameter a two-dimensional array named, figures of size 4 x 7, that contains rainfall figures in which each row represent a week and each column represent a day.

For example, if the array contains the following rainfall data:
​
[TABLE="align: center"]
[TR]
[TD="align: left"][/TD]
[TD="colspan: 7, align: left"]Days[/TD]
[/TR]
[TR]
[TD="align: left"][/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]1[/TD]
[TD="align: left"]2[/TD]
[TD="align: left"]3[/TD]
[TD="align: left"]4[/TD]
[TD="align: left"]5[/TD]
[TD="align: left"]6[/TD]
[/TR]
[TR]
[TD="align: left"]Week 0[/TD]
[TD="align: left"]3[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]7[/TD]
[TD="align: left"]8[/TD]
[TD="align: left"]21[/TD]
[TD="align: left"]0[/TD]
[/TR]
[TR]
[TD="align: left"]Week 1[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]1[/TD]
[TD="align: left"]1[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]4[/TD]
[/TR]
[TR]
[TD="align: left"]Week 2[/TD]
[TD="align: left"]9[/TD]
[TD="align: left"]6[/TD]
[TD="align: left"]7[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[/TR]
[TR]
[TD="align: left"]Week 3[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]0[/TD]
[TD="align: left"]1[/TD]
[/TR]
[/TABLE]


Then the output of the function should be displayed as follows:


1401199534351.png




(B)


Write A program (The main) that use the above function for output.


​
في احد يعرف يحله ضروري
 
في احد يعرف يحله ضروري

كود:
#include<iostream>
using namespace std;
void generatereport (int x[][7],int row)
{
     int wet=0;
     cout<<"Week    Rainfall        Maximam"<<endl;
     for (int i=0;i<row;i++)
     {
		 wet=0;
         cout<<i+1<<"\t";
         for (int j=0;j<7;j++)
         {
             cout<<x[i][j]<<" ";
             if (x[i][j]>wet)
                 wet=x[i][j];
         }
         cout<<" \b\t"<<wet<<endl;
     }
}
int main()
{
    int x[4][7]={{3,0,0,7,8,21,0},{0,1,1,0,0,0,4},{9,6,7,0,0,0,0},{0,0,0,0,0,0,1}};
    generatereport(x,4);
    system ("pause");
    return 0;
}
 
ليش اول واحد طلع 21 مو 7 ؟
هل يوجد خطأ بالسؤال
 
سلام ممكن مساعده ف حل السؤال
There are 5 sections of ITCS333, each with 25 students. Write a function, named countGenders(), that takes as parameter a two-dimensional array named, students of size 5 x 25, that contains students’ genders (M/m for males, F/f for females) in which each row represents a section and each column represents a student gender. The function should display the number of male students and the number of female students for each section. For example, if the array students, contains the following data:

[TABLE="align: center"]
[TR]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD="colspan: 7"]Students Genders
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]0
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[TD]…
[/TD]
[TD]…
[/TD]
[TD]24
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]Sections
[/TD]
[TD]0
[/TD]
[TD]M
[/TD]
[TD]F
[/TD]
[TD]m
[/TD]
[TD]f
[/TD]
[TD]f
[/TD]
[TD]F
[/TD]
[TD]M
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]1
[/TD]
[TD]m
[/TD]
[TD]M
[/TD]
[TD]M
[/TD]
[TD]F
[/TD]
[TD]m
[/TD]
[TD]f
[/TD]
[TD]f
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]2
[/TD]
[TD]F
[/TD]
[TD]M
[/TD]
[TD]F
[/TD]
[TD]F
[/TD]
[TD]f
[/TD]
[TD]M
[/TD]
[TD]f
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]3
[/TD]
[TD]f
[/TD]
[TD]f
[/TD]
[TD]m
[/TD]
[TD]f
[/TD]
[TD]M
[/TD]
[TD]f
[/TD]
[TD]F
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]4
[/TD]
[TD]m
[/TD]
[TD]M
[/TD]
[TD]m
[/TD]
[TD]f
[/TD]
[TD]F
[/TD]
[TD]m
[/TD]
[TD]F
[/TD]
[/TR]
[/TABLE]


Then the output of the function should be displayed as follows:

[TABLE="width: 100%"]
[TR]
[TD]Section Males Females
1 7 18
2 15 1
3 20 5
4 2 23
5 11 14


[/TD]
[/TR]
[/TABLE]
 
سلام ممكن مساعده ف حل السؤال


كود:
void countGenders(char list[][24],int row)
{
    int m,f;
    cout<<"Section\tMales\tFemales"<<endl;
    for (int i=0;i<row;i++)
    {
        m=0,f=0;
        for (int j=0;j<24;j++)
        {
            if (list[i][j]=='m'||list[i][j]=='M')
                m++;
            else 
                f++;
        }
        cout<<i+1<<"\t"<<m<<"\t"<<f<<endl;
    }
}
 
ممكن مساعدة
شنو الخطأ في حل هالسؤال
Write a program that asks the user for a file name. Assume the file contains a series of numbers, each written on a separate line. The program should read the contents of the file into an array, then displays the following data:
- The lowest number in the array.
- The highest number in the array.
- The total of the numbers in the array.
- The average of the numbers in the array

# include <iostream>
# include <fstream>
# include <string>
using namespace std ;

int getHighest (int[] , int) ;
int getLowest (int[] , int) ;
int getSum (int[] , int) ;
int getAverage (int[] , int) ;

int main()
{
ifstream inputFile;
int x ;
const int ARRAY_SIZE = x;
int numbers[ARRAY_SIZE];
int AVERAGE;
int count;
int highest;
int lowest;
int sum;
string fileName;


inputFile.open(fileName);
cout << "Enter a name of the file";
cin >> filename;

for (count = 0; count < ARRAY_SIZE; count++)
{
inputFile >> numbers[count];
highest = getHighest(numbers, ARRAY_SIZE);
cout << " The Highest Value is: " << highest << endl;
lowest = getLowest(numbers, ARRAY_SIZE);
cout << " The Lowest Value is: " << lowest << endl;
sum = getSum(numbers, ARRAY_SIZE);
cout << " The Total Sum is: " << sum << endl;
AVERAGE = getAverage(numbers, ARRAY_SIZE);
cout << "The Average is: " << AVERAGE << endl;
inputFile.close();
return 0;
}
int getLowest(int numbers[], int ARRAY_SIZE)
{
int lowest;

lowest = numbers[12];
for (int count = 1; count < ARRAY_SIZE; count++)
{
if (numbers[count] < lowest)
lowest = numbers[count];
}
return lowest;
}
int getHighest(int numbers[], int ARRAY_SIZE)
{
int highest;
highest = numbers[12];
for (int count = 1; count < ARRAY_SIZE; count++)
{
if (numbers[count] > highest)
highest = numbers[count];
}
return highest;
}
int getSum(int numbers[], int ARRAY_SIZE)
{
int total = 0;
for (int count = 0; count < ARRAY_SIZE; count++)
total += numbers[count];
return total;
}
int getAverage(int numbers[], int ARRAY_SIZE)
{
int total = 0;
int average;
for (int count = 0; count < ARRAY_SIZE; count++)
total += numbers[count];
average = total/ARRAY_SIZE;
return average;
}
​
 
ممكن مساعدة
شنو الخطأ في حل هالسؤال

الأخطاء في ال main
أول حاجه لازم يكون لل array حجم ثابت .. و القيمة الثابته ما يصير المستخدم يدخلها :smile2:
أنتون مخلين أول حاجه النظام يفتح الملف بعدين المستخدم يدخل الاسم .. المفروض العكس
في الفور لوب بس يصير ادخال للبيانات لل
array ..
()file.close يحطونها نهاية البرنامج

كود:
int main()
{ 
    ifstream inputFile; 
    int numbers[100]; 
    int AVERAGE; 
    int count; 
    int highest; 
    int lowest; 
    int sum; 
    string fileName;


    cout << "Enter a name of the file: ";
    cin >> fileName; //


    inputFile.open(fileName+".txt"); //


    for (count = 0;!inputFile.eof(); count++) 
        inputFile >> numbers[count];


    highest = getHighest(numbers, count); 
    cout << "The Highest Value is: " << highest << endl; 
    lowest = getLowest(numbers, count); 
    cout << "The Lowest Value is: " << lowest << endl; 
    sum = getSum(numbers, count); 
    cout << "The Total Sum is: " << sum << endl; 
    AVERAGE = getAverage(numbers, count); 
    cout << "The Average is: " << AVERAGE << endl;


    inputFile.close(); 
    return 0; 
}

هذي ال main بعد التعديل
-> الملف اللي بينفتح أنا مخلي تكون ضيغته txt أنتون تعدلونها على راحتكم :nosweat:

وهذا برنامج ثاني يسوي مثل الشغل بس بدون فنكشن
:whistling:

كود:
# include <iostream> 
# include <fstream>
# include <string>
using namespace std ; 


int main()
{ 
    ifstream inputFile; 
    int numbers[100],count=0,highest=0,lowest=0,sum=0; 
    string fileName;


    cout << "Enter a name of the file: ";
    cin >> fileName; //


    inputFile.open(fileName+".txt"); //


    for (count = 0;!inputFile.eof(); count++) 
    {
        inputFile >> numbers[count];
        if (count==0)
        {
            highest =numbers[count];
            lowest =numbers[count];
        }
        if (numbers[count]>highest)
            highest =numbers[count];
        if (numbers[count]<lowest )
            lowest =numbers[count];
        sum+=numbers[count];


    }


    cout << "The Highest Value is: " << highest << endl; 
    cout << "The Lowest Value is: " << lowest << endl; 
    cout << "The Total Sum is: " << sum << endl; 
    cout << "The Average is: " << sum/count << endl;


    inputFile.close(); 
    return 0; 
}
 
ممكن حل هالسؤال
Write a function that uses an array parameter to accept a string as its argument. It should convert the first letter of each word in the string to uppercase. If any of the letters are already uppercase, they should be left alone. (see hint). Demonstrate the function in a simple program that asks the user to input a string, passes it to a function, and then displays the string after it has been modified.​
 
في حد يقدر يحله لي

Write a class Date which consists of:


  • Member variables: day, month, and year
  • Member function DaysSinceFirstJan1() which returns the total number of days since 01-Jan-0000.

Now write a main function which asks the user to enter 5 dates (day, month, year) which are stored in an array of objects of the type Date and shows the total number of days past since 01-Jan-0000 for each of the 5 dates using the member function DaysSinceFirstJan1().
 
في حد يقدر يحله لي

Write a class Date which consists of:


  • Member variables: day, month, and year
  • Member function DaysSinceFirstJan1() which returns the total number of days since 01-Jan-0000.

Now write a main function which asks the user to enter 5 dates (day, month, year) which are stored in an array of objects of the type Date and shows the total number of days past since 01-Jan-0000 for each of the 5 dates using the member function DaysSinceFirstJan1().


هذا السوال 103 أو 104 ؟
 
HELP ME PLZZ:RpS_crying:
Account Class 8, Test Account Class 7, Class Declaration Header File 5.
Create a new project, and with separation between class interface and its implementation, create class Account that has two properties: name and balance. This class has the following methods
void setName(string )
string getName()
void setBalance(double)
double getBalance( )
void deposit(double) : increases account’s balance.
void withdraw(double): decreases account’s balance but it can’t be negative.


  • Add a constructor that receives name and balance.
  • In main function, create objects account1, account2 and account3 as follows:
ObjectNameBalance
account1Nasser3400
account2Khalid5000
account3Sameer6000



  • Deposit 500 in all 3 accounts and display their new balances.
  • Withdraw 5000 from all accounts. Display their new balances.
  • Calculate and output the total balance for the three accounts.
  • Create an array of 5 accounts, in the main write code to read their data.
  • Write a function that receives an array of accounts and returns total of all balances.
 
عودة
أعلى أسفل