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

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

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

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

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

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

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

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

    الأصوات: 13 40.6%

  • مجموع المصوتين
    32
شكرا جزيلا

اسوي الي قلت عليه ما نسخته كوبي

بس شكله من سيستم باس ما احطها اني
 
شكرا جزيلا

اسوي الي قلت عليه ما نسخته كوبي

بس شكله من سيستم باس ما احطها اني

بدلي
كود:
void main()
خلي بدالها
كود:
int main()

ولو في امكانيه تصورين المشكله احسن عشان نقدر نساعدكم..
 
[MENTION=689]أنس الوجود[/MENTION]
إضافة إلى كلام محمد إذا خليتين void main بدل ال int main لازم تشيلين ال return 0 من البرنامج بهاذي الطريقة :
كود:
#include<iostream>
using namespace std;
void main(){
//Place of code 
system("pause");
}
 
[MENTION=689]أنس الوجود[/MENTION]
سبب ثاني ممكن يكون ظهور ايرور انش تنسخين الكود كامل و تحطينه في المين بما فيه الفنكشن او ال void main الموجودة في السؤال فبعد بيطلع ايرور للتوضيح أكثر شوفي الفيديو :
https://drive.google.com/file/d/0By6IydPqj2WAYy1WWUpadXlJc0U/view?usp=sharing
في بداية الفيديو نسخت الكود كامل و حطيته في المين فطلع ليي خطأ لأن الكود الي نسخته نفسه فيه void main فتكررت فنكشن ال main مرتين فهذا ممكن يكون سبب للخطأ فخليته كمجرد كومنت عشان ما يأثر في الكومبايل او تقدرين تمسحينه ، لاحظي حتى بعد ما سويت هذا الشي و سويت كومبايل من جديد بعد طلع ايرور لان الفنكشن داخل المين ، فبعد ما نقلت الفنكشن الى قبل المين اشتغل الكود عادي ، كملاحظة اخيرة يصير تنكتب الفنكشن داخل المين بس مو بهاذي الطريقة بالإضافة كتابتها برا المين افضل كتنسيق للكود
كود:
#include<iostream>
using namespace std;
[COLOR=#ff0000]//Place of functions[/COLOR]
int main(){
[COLOR=#ff0000]//Place of code [/COLOR]
system("pause");
return 0;
}
 
اي بالضبط هذا الي كان اغلب الي جربتهم في خطا من هالسالفه

مع انه void نفس int بس الفويد بدون ريترن 0 :RpS_huh:

عموما شكرا جزيلا :smile2:
 
#include<iostream>

using namespace std;

void calcF(){
static int y=5;
int x=2;
y*=x;
++x;
cout<<x<<"\t"<<y<<endl;
}
int main(){
for(int i=1;i<=2;++i)
calcF();

system("pause");
return 0;
}


يطلع output


ما عرفت اعدله صاير المفروض 3 على اليسار


3 10
3

20​

المهم ما فهمت الاكس =3 مرتين ولا تغيرت ليش ؟؟
 
#include<iostream>

using namespace std;

void calcF(){
static int y=5;
int x=2;
y*=x;
++x;
cout<<x<<"\t"<<y<<endl;
}
int main(){
for(int i=1;i<=2;++i)
calcF();

system("pause");
return 0;
}


يطلع output


ما عرفت اعدله صاير المفروض 3 على اليسار


3 10
3

20​

المهم ما فهمت الاكس =3 مرتين ولا تغيرت ليش ؟؟

الاكس مجرد فاريبال عادي قيمتة 2 ، بعد الكال الاولي للفانكشن راح تصير قيمته 3 ، وبعدها راح ترجعين للمين وبتردين تسوين كال للفانكشن من جديد فترجع له قيمته الاساسيه اللي هي 2..

بالنسبه لل y تتغير لانها static
 
ساعدوني cs

ساعدوني حاولت احله كله يطلع ليي الاوتبوت غلط و ارقام غير الا ادخلها

write a C++ program that processes the work done by a furniture factory. The furniture factory produces different kinds of products. For each product, the program should ask the user to enter the ID of the product followed by the quantity of that product produced in a month. Create two parallel arrays. The first array is of type string to store the ID of the product. The second array is of type integer to store the quantity of the product. There are four types of products which are produced by the factory. The program should find and print the id and quantity of the product with minimum quantity and output the Average quantity produced per the factory.

Your program run should be as follows:
Enter the name of the product followed by its quantity: 111​ 20
Enter the name of the product followed by its quantity: 222 ​100
Enter the name of the product followed by its quantity: 333​ 50
Enter the name of the product followed by its quantity: 444 ​ 60

OUTPUT
ID of the product ​Quantity of the product
111​ ​ 20
222 ​​100
333​​ 50
444​​ 60

The product 111 is has the minimum quantities equal to 20.
The Average quantity produced per the factory is 57.5
 
ساعدوني حاولت احله كله يطلع ليي الاوتبوت غلط و ارقام غير الا ادخلها

write a C++ program that processes the work done by a furniture factory. The furniture factory produces different kinds of products. For each product, the program should ask the user to enter the ID of the product followed by the quantity of that product produced in a month. Create two parallel arrays. The first array is of type string to store the ID of the product. The second array is of type integer to store the quantity of the product. There are four types of products which are produced by the factory. The program should find and print the id and quantity of the product with minimum quantity and output the Average quantity produced per the factory.

Your program run should be as follows:
Enter the name of the product followed by its quantity: 111​ 20
Enter the name of the product followed by its quantity: 222 ​100
Enter the name of the product followed by its quantity: 333​ 50
Enter the name of the product followed by its quantity: 444 ​ 60

OUTPUT
ID of the product ​Quantity of the product
111​ ​ 20
222 ​​100
333​​ 50
444​​ 60

The product 111 is has the minimum quantities equal to 20.
The Average quantity produced per the factory is 57.5
السلام عليكم
اذا ممكن ترفع حلك عشان نشوف وين الخطأ الي صاير :smile2:
 
المشكله ما اعرف ارفعه من التلفون الابتوب النت عندي فيه مشكله
 
المشكله ما اعرف ارفعه من التلفون الابتوب النت عندي فيه مشكله
الاسايمنت بإختصار تسوي اري من نوع سترنق و اريه ثاني من نوع انتجر ، بتدخل معلومات عن طريق اليوز عبارة عن الأيدي في اريه لسترنق و الكونتتي في اريه الانتجر ، تقدر تسوي هذا الشي بالوايل لوب او الفور لوب ، بعدها بتسوي فور لوب تطلع المنتج صاحب الاقل كمية فتبعرف متغير اسمه min و بتفرض ان الإلمنت الاول هو الاقل و بعدها بتجيك الاريه المنت المنت اذا في المنت اقل منه فبيصير هو ال min الى نهاية اللوب بالإضافة قبل هذا اللوب عرف متغير سم من نوع فلوت و خل قيمته صفر و أجمع فيه الالمنت مال اريه لكونتتي و اقسمهم على عددهم عشان تطلع الافرج
 
#include <iostream>
using namespace std;
void readRainFall(int figures[4][7])
{
for (int row=0; row<4; row++)
{
for (int col=0; col<7; col++)
cin>>figures[row][col];
}
}
void generateReport(int figures[4][7])
{
int total;
int wettestweek;
int weekNumber;
cout<<"Week "<<" "<<"Rainfall data"<<" "<<"Total"<<endl;
cout<< " ";
for(int j=0;j<7;j++)
{
cout<<(j+1)<<"\t";
}
cout<<endl;
for (int row=0; row<4; row++)
{
total=0;
weekNumber=row;
for (int col=0; col<7; col++)
{
cout<<(weekNumber+1)<<" "<<figures[row][col]<<" ";
total+=figures[row][col];
if (figures[row][7])
cout<<total;
}

}
cout<<endl<<endl<<" Wettest Week "<<" ";
for (int row=0; row<4; row++)
{
wettestweek=figures[row][0];
for (int col=0; col<7; col++)
{
if ( figures[row][col]>wettestweek)
wettestweek=figures[row][col];
}
cout<<wettestweek;
}
}
int main()
{
;
cout<<" Enter Rainfall days for 4 weeks, each week in a row, 4 weeks and 7 days each:";
readRainFall();
generateReport();
return 0;
}

طلع ليي واجد ايرورز و كلما اعدلهم يطلع شي جديد!
وين المشكلة حالياً بالضبط؟ مافهمت إلي يبيه البرنامج؟
 
طلع ليي واجد ايرورز و كلما اعدلهم يطلع شي جديد!
وين المشكلة حالياً بالضبط؟ مافهمت إلي يبيه البرنامج؟

الايرور اللي عندش هني
كود:
readRainFall();
	generateReport();

لازم تطرشين اراي من نوع int لكل فانكشن
كود:
int x[4][7];
    cout<<" Enter Rainfall days for 4 weeks, each week in a row, 4 weeks and 7 days each:";
    readRainFall(x);
    generateReport(x);
 


يطلع ليي هذا الآوتبت الغريب

PHP:
#include <iostream>#include <iomanip>using namespace std;void readRainFall(int figures[4][7]){    for (int row=0; row<4; row++)    {        for (int col=0; col<7; col++)        cin>>figures[row][col];    }}void generateReport(int figures[4][7]) {     int total;     int wettestweek;     int weekNumber;     cout<<fixed<<showpoint<<left;     cout<<endl<<setw(6)<<"Week "<<"\t"<<setw(12)<<"Rainfall data"<<" "<<setw(6)<<"Total"<<endl;     cout<<left<<setw(6) <<setw(12);     for(int j=0;j<7;j++)     {     	cout<<(j+1)<<"\t";     }     cout<<endl;        for (int row=0; row<4; row++)    {    	total=0;    	weekNumber=row;        for (int col=0; col<7; col++)        {		    cout<<(weekNumber+1)<<"\t";        	cout<<setw(20)<<figures[row][col]<<"\t";        	total+=figures[row][col];            if (figures[row][7])            cout<<total;        }        cout<<endl;    }            cout<<endl<<endl<<setw(22)<<"Wettest Week "<<"  "<<setw(4);     for (int col=0; col<4; col++)    {         wettestweek=figures[0][col];        for (int row=0; row<7; row++)         {            if ( figures[row][col]>wettestweek)            wettestweek=row;        }        cout<<(wettestweek+1)<<" ";    }  }int main(){	int x[4][7];    cout<<" Enter Rainfall days for 4 weeks, each week in a row, 4 weeks and 7 days each:";    readRainFall(x);    generateReport(x);	return 0;}


أدري البرنامج معقد :99:
 


يطلع ليي هذا الآوتبت الغريب

PHP:
#include <iostream>#include <iomanip>using namespace std;void readRainFall(int figures[4][7]){    for (int row=0; row<4; row++)    {        for (int col=0; col<7; col++)        cin>>figures[row][col];    }}void generateReport(int figures[4][7]) {     int total;     int wettestweek;     int weekNumber;     cout<<fixed<<showpoint<<left;     cout<<endl<<setw(6)<<"Week "<<"\t"<<setw(12)<<"Rainfall data"<<" "<<setw(6)<<"Total"<<endl;     cout<<left<<setw(6) <<setw(12);     for(int j=0;j<7;j++)     {         cout<<(j+1)<<"\t";     }     cout<<endl;        for (int row=0; row<4; row++)    {        total=0;        weekNumber=row;        for (int col=0; col<7; col++)        {            cout<<(weekNumber+1)<<"\t";            cout<<setw(20)<<figures[row][col]<<"\t";            total+=figures[row][col];            if (figures[row][7])            cout<<total;        }        cout<<endl;    }            cout<<endl<<endl<<setw(22)<<"Wettest Week "<<"  "<<setw(4);     for (int col=0; col<4; col++)    {         wettestweek=figures[0][col];        for (int row=0; row<7; row++)         {            if ( figures[row][col]>wettestweek)            wettestweek=row;        }        cout<<(wettestweek+1)<<" ";    }  }int main(){    int x[4][7];    cout<<" Enter Rainfall days for 4 weeks, each week in a row, 4 weeks and 7 days each:";    readRainFall(x);    generateReport(x);    return 0;}


أدري البرنامج معقد :99:

الجواب حق هذا السؤال أعتقد مشابه حق سؤال محلول قبل وموجود في المكتبه :whistling:
تقدرون تستفيدون من طريقة الحل

كود:
/*
(A)
The rainfall figures in mm are available for each day of the past four weeks. 
Write a function generateReport() that displays the total rainfall for each 
week and the most wettest day. 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:


Days
0    1    2    3    4    5    6
Week 0    3    0    0    7    8    21    0
Week 1    0    1    1    0    0    0    4
Week 2    9    6    7    0    0    0    0
Week 3    0    0    0    0    0    0    1




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


Week Rainfall data Total
1 3 0 0 7 8 21 0 39
2 0 1 1 0 0 0 4 6
3 9 6 7 0 0 0 0 22
4 0 0 0 0 0 0 1 1


The wettest day was day 6 in week 1.


(B)
Write A program that prompt the user for input into 2D array and use the above 
function for output.
*/
#include<iostream>
using namespace std;
void generatereport (int x[][7],int row)
{
     int sum,wet=0,wek,maxd;
     cout<<"Week    Rainfall        Total"<<endl;
     for (int i=0;i<row;i++)
     {
         sum=0;
         cout<<i+1<<"\t";
         for (int j=0;j<7;j++)
         {
             cout<<x[i][j]<<" ";
             sum+=x[i][j];
             if (x[i][j]>wet)
             {
                 wet=x[i][j];
                 wek=i;
                 maxd=j;
             }
         }
         cout<<" \b\t"<<sum<<endl;
     }
     cout<<endl<<"The wettest day was day "<<maxd+1<<" in week "<<wek+1<<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;
}

بالنسبة للكود انا افضل استخدام t\ احسن من setw .. عشان يترتب الأوتبوت
 
السلام عليكم

كود:
Week                  Rainfall data                        Total
                           1  2  3  4  5  6    7
1                         3  0  0  7  8  21  0     39
2                         0  1  1  0  0  0    4     6
3                         9  6  7  0  0  0    0     22
4                         0  0  0  0  0  0    1     1
 
Wettest Week   3   3   3  1 1  1    2


شلون اسوي Wettest Week 3 3 3 1 1 1 2 ؟
 
السلام عليكم

كود:
Week                  Rainfall data                        Total
                           1  2  3  4  5  6    7
1                         3  0  0  7  8  21  0     39
2                         0  1  1  0  0  0    4     6
3                         9  6  7  0  0  0    0     22
4                         0  0  0  0  0  0    1     1
 
Wettest Week   3   3   3  1 1  1    2


شلون اسوي Wettest Week 3 3 3 1 1 1 2 ؟

وش المطلوب من السؤال :whistling:.
المفروض يطلع رقم واحد وهو الإسبوع الأول
 
وش المطلوب من السؤال :whistling:.
المفروض يطلع رقم واحد وهو الإسبوع الأول

هاي المطلوب


كود:
[B][U]PART A[/U][/B]
Write a function readRainFall() that takes parameter a two-dimensional array named, [B]figures[/B] of size 4 x 7. The function should read rainfall figures week by week and store them in the array figures in which each row represent a week and each column represent a day.
 
[B][U]PART B[/U][/B]
Write a function [B]generateReport()[/B] that displays the total rainfall for each week and the most wettest day. The function takes as parameter a two-dimensional array named, [B]figures[/B] 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] 
[/TD]
[TD="colspan: 7"]Days
[/TD]
[/TR]
[TR]
[TD] 
[/TD]
[TD]0
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[TD]4
[/TD]
[TD]5
[/TD]
[TD]6
[/TD]
[/TR]
[TR]
[TD]Week 0
[/TD]
[TD]3
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD]7
[/TD]
[TD]8
[/TD]
[TD]21
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]Week 1
[/TD]
[TD]0
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD]4
[/TD]
[/TR]
[TR]
[TD]Week 2
[/TD]
[TD]9
[/TD]
[TD]6
[/TD]
[TD]7
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]Week 3
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD]0
[/TD]
[TD]1
[/TD]
[/TR]
[/TABLE]

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

[TABLE="align: left"]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][TABLE="width: 100%"]
[TR]
[TD]Week                  Rainfall data                        Total
                           1  2  3  4  5  6    7
1                         3  0  0  7  8  21  0     39
2                         0  1  1  0  0  0    4     6
3                         9  6  7  0  0  0    0     22
4                         0  0  0  0  0  0    1     1
 
Wettest Week   3   3   3  1 1  1    2
 

[/TD]
[/TR]
[/TABLE]
 [/TD]
[/TR]
[/TABLE]
 
 
 
 
 
 
 
 
 
 
 

[B][U]PART C[/U][/B]
Write a main function to call the above functions in PART A and B.
 
عودة
أعلى أسفل