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

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

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

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

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

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

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

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

    الأصوات: 13 40.6%

  • مجموع المصوتين
    32
شنو الجباتر المطلوبة ويانه لللامتحان ؟
 
chapter 2,3,4,5,6,7,,9
 
Write a function, getBordersSum, thattakes a 2-dimensional array of integers, row size, and column size asparameters. The function should calculate and return the sum of all integersaround the borders of the array as shown in the example below:

If the array size is 5x4 and contains thefollowing numbers:

[TABLE="class: MsoTableGrid"]
[TR]
[TD="width: 37"]
2
[/TD]
[TD="width: 36"]
1
[/TD]
[TD="width: 36"]
0
[/TD]
[TD="width: 36"]
7
[/TD]
[/TR]
[TR]
[TD="width: 37"]
1
[/TD]
[TD="width: 36"]
12
[/TD]
[TD="width: 36"]
11
[/TD]
[TD="width: 36"]
4
[/TD]
[/TR]
[TR]
[TD="width: 37"]
3
[/TD]
[TD="width: 36"]
2
[/TD]
[TD="width: 36"]
3
[/TD]
[TD="width: 36"]
6
[/TD]
[/TR]
[TR]
[TD="width: 37"]
7
[/TD]
[TD="width: 36"]
5
[/TD]
[TD="width: 36"]
6
[/TD]
[TD="width: 36"]
10
[/TD]
[/TR]
[TR]
[TD="width: 37"]
1
[/TD]
[TD="width: 36"]
8
[/TD]
[TD="width: 36"]
6
[/TD]
[TD="width: 36"]
5
[/TD]
[/TR]
[/TABLE]

Then, the function should sum all the numbersaround the array borders (see highlighted cells) and return the sum. In thisexample, the sum = 2+1+0+7+1+4+3+6+7+10+1+8+6+5= 61

Assume that the maximum number of columns inthe array is 150.
 
ممكن مساعدتكم
 
!
! + !
! + ! + !
! + ! + ! + !

جيفه نطبع دا الشكل
 
Q1: A) Write afunction named isRightTriangle that takes 3 sides (double) of a triangleas parameters. The function should return true if the sides represent a righttriangle, otherwise return false. Note that in a right triangle, the square of the hypotenuse (largest side)is equal to the sum of the squares of the other two sides.
a[SUP]2[/SUP] + b[SUP]2[/SUP]= c[SUP]2[/SUP]
B)Write a program that prompts the user to enter three sides of a triangle(double) and displays if the sides represent a right triangle or not by usingthe function defined in Part A. The Input/output of the program should bedisplayed as follows:[TABLE="class: MsoTableGrid"]
[TR]
[TD="width: 295, bgcolor: transparent"] Sample Input/output 1 [/TD]
[TD="width: 295, bgcolor: transparent"] Sample Input/output 2 [/TD]
[/TR]
[TR]
[TD="width: 295, bgcolor: transparent"] Enter 3 sides: 3.0 4.0 5.0 Yes it is a Right Triangle [/TD]
[TD="width: 295, bgcolor: transparent"] Enter 3 sides: 2.0 5.0 6.0 No it isn’t a Right Triangle [/TD]
[/TR]
[/TABLE]
Q2:A) Write afunction calculateR() that takes as parameters x (double), y (double)and code (char). The function should return the value of R (double) accordingto the code value as shown in the following table:
[TABLE="class: MsoTableGrid"]
[TR]
[TD="width: 117, bgcolor: transparent"]
code
[/TD]
[TD="width: 309, bgcolor: transparent"] R [/TD]
[/TR]
[TR]
[TD="width: 117, bgcolor: transparent"]
A
[/TD]
[TD="width: 309, bgcolor: transparent"] R=e[SUP]x[/SUP]+e[SUP]y[/SUP] [/TD]
[/TR]
[TR]
[TD="width: 117, bgcolor: transparent"]
B
[/TD]
[TD="width: 309, bgcolor: transparent"] R=cosine(45)* [/TD]
[/TR]
[TR]
[TD="width: 117, bgcolor: transparent"]
C
[/TD]
[TD="width: 309, bgcolor: transparent"] R= x[SUP](y+2)[/SUP] [/TD]
[/TR]
[TR]
[TD="width: 117, bgcolor: transparent"]
Otherwise
[/TD]
[TD="width: 309, bgcolor: transparent"] R=0.0 [/TD]
[/TR]
[/TABLE]
B)Write a program that prompts the user to enter two doubles and one charactercode and displays their corresponding R value by using the function defined inPart A. TheInput/output of the program should be displayed as follows:
[TD="bgcolor: transparent"]
Enter 2 doubles and 1 code: 2.50 3.00 C
R= 97.66
[/TD]
شنو حل ساعوني لو سمحتو :RpS_crying:
 
!
! + !
! + ! + !
! + ! + ! + !

جيفه نطبع دا الشكل

جرب هذا

PHP:
#include
<iostream>

using
 namespace std;

void
 main()

{

	
int n,r,sp,ch;

	cout<<
"Enter positive N=";

	cin>>n;


	
if(n<=0)

		cout<<
"Invalid N";

	
else {

		
for (r=1;r<n;++r)

		{

			
for(sp=1;sp<=(n-r);++sp)

				cout<<
" ";

			
for (ch=1;ch<((2*r)-1);++ch))

				
if(ch%2==0)

					cout<<
"+";

				
else cout<<"!";

				cout<<endl;

		}

	}

}
 
PHP:
What is the output of the following code? 

 
OUTPUT
int k=7, y=5;void lookup(int y, int& x, int z=2)
{
     x+=k;
     cout<<y<<"\t"<<x<<"\t"<<z<<endl;
}
 
void main(){
     int k=3,m=1;
     cout<<k<<"\t"<<y<<"\t"<<m<<endl;
     lookup(10,m);
     cout<<k<<"\t"<<y<<"\t"<<m<<endl;
}

شنو الاوت بوت ؟
وياريت شرح في الكوولنغ سوه حق شنو بالضبط كوول
 
PHP:
What is the output of the following code? 

 
OUTPUT
int k=7, y=5;void lookup(int y, int& x, int z=2)
{
     x+=k;
     cout<<y<<"\t"<<x<<"\t"<<z<<endl;
}
 
void main(){
     int k=3,m=1;
     cout<<k<<"\t"<<y<<"\t"<<m<<endl;
     lookup(10,m);
     cout<<k<<"\t"<<y<<"\t"<<m<<endl;
}

شنو الاوت بوت ؟
وياريت شرح في الكوولنغ سوه حق شنو بالضبط كوول

الآوت بوت ،،
كود:
[COLOR=#808080]
3 5 1
10 8 2
3 5 8
[/COLOR]
 
جرب هذا

PHP:
#include
<iostream>

using
 namespace std;

void
 main()

{

    
int n,r,sp,ch;

    cout<<
"Enter positive N=";

    cin>>n;


    
if(n<=0)

        cout<<
"Invalid N";

    
else {

        
for (r=1;r<n;++r)

        {

            
for(sp=1;sp<=(n-r);++sp)

                cout<<
" ";

            
for (ch=1;ch<((2*r)-1);++ch))

                
if(ch%2==0)

                    cout<<
"+";

                
else cout<<"!";

                cout<<endl;

        }

    }

}
!
! + !
! + ! + !
! + ! + ! + !

جيفه نطبع دا الشكل

أو هذا .. :smile2:

كود:
    int x;
    cin>>x;
    for (int i=0;i<x;i++)
    {
        for (int j=0;j<=i;j++)
            if (j==0)cout<<"!";
            else cout<<"+!";
        cout<<endl;
    }
 
اوكي بس الا مو فاهمنه شنو تعني int& x
او static int x
 
اوكي بس الا مو فاهمنه شنو تعني int& x
او static int x

اشارة ال & تعني calling by referance
يعني لما تسوي calling الى الفنكشن وكانت قيمة ال x=3 مثلا / وبعد ما نفذت اللي في الفنكشن تغيرت قيمتها الى 6
فال x راح ترجع ال main بقيمة 6
و static كل مرة تاخذ القيمة النهائية ليها يعني اذا تغيرت تاخذ القيمة المتغيرة
ماعرف اشرح اصلا بس ان شاء الله وضحت الصورة :nosweat:
 
Write a program that reads in a set of positive integers and outputs how many times a particular number appears in the list. you may assume that data set has at most 100 numbers and -999 marks the end of the input data. The numbers must be output in increasing order

أحد يعرف شلون نحل هذا السؤال ؟
 
اشارة ال & تعني calling by referance
يعني لما تسوي calling الى الفنكشن وكانت قيمة ال x=3 مثلا / وبعد ما نفذت اللي في الفنكشن تغيرت قيمتها الى 6
فال x راح ترجع ال main بقيمة 6
و static كل مرة تاخذ القيمة النهائية ليها يعني اذا تغيرت تاخذ القيمة المتغيرة
ماعرف اشرح اصلا بس ان شاء الله وضحت الصورة :nosweat:

ايي شكرا فهمت للاولى
بس للستاتيك للحين :nosweat:
 
سلام عليكم ..
ممكن شرح شلون نطلع الاوت بت حق ال array
مثلا نفس هذا
408608172.jpg
[/URL][/IMG]

وشكرا مقدما :smile:
 
Write a program that prompts the user to input one 3-digits integer and display the digits in reverse order.

simple I/O:
Enter 3-digits integer: 593

Input Reversed = 395
PHP:
#include <iostream>
using namespace std;

int main(){
 int num,i=10;   
 cin>>num;   

 do{
    cout<< (num%i)/ (i/10);
    i *=10;
}while((num*10)/i!=0);

 cout<<endl;

 return 0;
}
 
من عنده حل لهذا السؤال

Write a program that calculates and prints the monthly payable for an employee. The net pay is calculated after the following deductions:


  • Medical Tax: 2.75%
  • Pension Plan: 6%
  • Health Insurance: BD 75

Your program should prompt the user to enter the gross amount and print the Net Pay. Format the Net Pay to the two decimal places.
 
ايي شكرا فهمت للاولى
بس للستاتيك للحين :nosweat:

أنا ما أعرف اشرح لكن بحاول :RpS_tongue:

static = قابل للتغير

يعني مثلاً لو عندك كود :
=int test(int a)
{
int notStatic = 6;
notStatic+=a;
return notStatic;
}


int main()
{
for ( int k = 1 ; k < 3 ; k ++ )
{
cout<<test(k)<<endl;
}
return 0;
}
الآوتبت في حالة الـ Not Static

7
8

راح يتم استدعاء فنكشن test مرتين من قبل ال for loop في اول مرة راح يكون انتجرa = 1 والمرة الثانية a = 2 .. في أول مرة راح يتم اضافة 6 مع 1 فيكون الناتج 7 فيتم طبعه وإضافة سطر جديد .. المرة الثانية يتم اضافة 6 مع 2 فيكون الناتج 8 فيتم طبعه وإضافة سطر جديد ..

فـ كل مرة فنكشن test يضيف رقم 6 الذي تم تعريفه في بداية الفنكشن على الانتجر a فـ هو غير قابل للتغير .

ولكن في حالة ال static



int test(int a)
{
static int Static = 6;
Static+=a;
return Static;
}


int main()
{
for ( int k = 1 ; k < 3 ; k ++ )
{
cout<<test(k)<<endl;
}
return 0;
}





الآوت بت بعد إضافة static :

7
9



راح يتم استدعاء فنكشن test مرتين من قبل ال for loop في اول مرة راح يكون انتجر a = 1 والمرة الثانية a = 2 ، أول مرة راح يتم إضافة 6 مع 1 فيكون الناتج 7 .. وراح يتم تغيير انتجر Static إلى 7 لأنه قـابل للتغير ( Static ) ويتم طبع 7 وإضافة سطر جديد .. والمرة الثانية راح يتم إضافة 7 مع 2 فيكون الناتج 9 ويتم طبعه

إذا ماوصلت الفكرة قولي علشان اشرحلك بطريقة ثانية :shiny:
 
عودة
أعلى أسفل