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

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

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

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

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

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

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

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

    الأصوات: 13 40.6%

  • مجموع المصوتين
    32
اذا في كود مثلا
PHP:
9%2

شلون احسبها بالكلكوليتر ؟


مثل هذا السؤال

PHP:
int k=4, x=3;   
cout << ((x*x) % 2 ? ++k : k++ );
 
ممكن شرح لل nested loop النجوم
 
السلام عليكم
 
السوال الي حاطينة

int x=30;int i=2;
bool go = true;
while (go){
x-=i;
if (x <= 0)
go= false;
i = i * 10;
cout<<x<<"\t"<<i<<endl;

احد يشرحه اذا ممكن لانه كلش مو فاهمتنه وشكرا :99:
 
السوال الي حاطينة

int x=30;int i=2;
bool go = true;
while (go){
x-=i;
if (x <= 0)
go= false;
i = i * 10;
cout<<x<<"\t"<<i<<endl;

احد يشرحه اذا ممكن لانه كلش مو فاهمتنه وشكرا :99:
كود:
int x=30;int i=2;
bool go = true;
while (go){
x-=i;
if (x <= 0)
go= false;
i = i * 10;
cout<<x<<"\t"<<i<<endl;
في البداية عندنا ثلاث متغيرات ، x يساوي 30 ، i يساوي 2 ، و متغير بوليين اسمه go و يساوي true
بعدها عندن وايل لوب و شرطه متغير go ، أي بما معناه ان اللوب بيستمر مادامت قيمة ال go مثل ما هي true
نجي داخل اللوب :
كود:
x-=i;
ايبما معناه :
x تساوي x ناقص قيمة ال i قيمة الأكس 30 ناقص قيمة ال i تساوي 2 ، فالأكس بتصير 28
بعدها في اف ستيتمنت اذا ال x اقل او يساوي 0 بتتغير قيمة ال go و بتصير false ، الاكس 28 اكبر من 0 فما بتتغير قيمة ال go
بعدها قيمة ال i تساوي قيمة ال i الحالية ضرب 10 ، 2 ضرب 10 فقيمة ال i صارت 20
السطر الي بعده سي اوت فبنطبع قيمة الاكس سبيس قيمة ال i و سطر جديد فأول سطر بكون الأوت بوت جدي :
كود:
28 20
هل قيمة ال go تغيرت ، لا فاللوب مستمر نكرر مثل الخطوات السابقة
فالأكس بتصير 8 ، و ال go ما بتتغير لان قيمة ال x اكبر من صفر ، و قيمة ال i صارت 200
فالأوت بوت بصير :
كود:
28 20 
8 200
لحد الأن قيمة ال go تساوي true فاللوب مستمر نكرر نفس الخطوات :
قيمة ال x بتصير 192- , و قيمة ال i تساوي 2000 , قيمة ال go تغير من true الى false لان الأكس أقل من صفر فبيطبع قيمة ال x و ال i لأخر مرة و بيوقف اللوب ، فبتكون النتيجة النهائية :
كود:
28 20 
8 200 
192- 2000
 
1432134644951.jpg


ممكن مساعدة في حل السؤال ..
انه سويته بهذي الكود ولكن يطلع لي غلط !!

كود:
#include<iostream>#include<fstream>
#include<string>
using namespace std;
int main () 
{
	char group[32] , x ; int score[32] ; string name[32] ; 
	int total,c=0 ; 
	int i=0 ; int sum = 0 ; 
	ifstream infile ; 
	infile.open("fifa.txt");


	if(!infile)
		cout<<"Erorr"<<endl;
	else
	{
		cout<<"Enter Group Letter:";
		cin>>group[i];
		infile>>name[i]>>score[i];}
		while(infile){
		
			total=score[i];
			infile>>name[i]>>score[i];
			infile>>group[i];}
		c++;
			
		{
		
		
		cout<<"Total score for all team in group "<<group[i]<<" is "<<total<<endl;
		cout<<name[i]<<"has the highest score of "<<score[i]<<" in group "<<group[i]<<endl;
		cout<<"Team in Group "<<group[i]<<" are: "<<endl;
		cout<<"Team"<<"\t"<<"Score"<<endl;
		cout<<name[i]<<"\t"<<score[i]<<endl;
		c++;
	}
		


		infile.close();


		system("pause");
		return 0 ;
		}
 
1432134644951.jpg


ممكن مساعدة في حل السؤال ..
انه سويته بهذي الكود ولكن يطلع لي غلط !!

كود:
#include<iostream>#include<fstream>
#include<string>
using namespace std;
int main () 
{
    char group[32] , x ; int score[32] ; string name[32] ; 
    int total,c=0 ; 
    int i=0 ; int sum = 0 ; 
    ifstream infile ; 
    infile.open("fifa.txt");


    if(!infile)
        cout<<"Erorr"<<endl;
    else
    {
        cout<<"Enter Group Letter:";
        cin>>group[i];
        infile>>name[i]>>score[i];}
        while(infile){
        
            total=score[i];
            infile>>name[i]>>score[i];
            infile>>group[i];}
        c++;
            
        {
        
        
        cout<<"Total score for all team in group "<<group[i]<<" is "<<total<<endl;
        cout<<name[i]<<"has the highest score of "<<score[i]<<" in group "<<group[i]<<endl;
        cout<<"Team in Group "<<group[i]<<" are: "<<endl;
        cout<<"Team"<<"\t"<<"Score"<<endl;
        cout<<name[i]<<"\t"<<score[i]<<endl;
        c++;
    }
        


        infile.close();


        system("pause");
        return 0 ;
        }

حلك غلط اخوي..، السؤال يقول انه في عندك في ملف معلومات عن 32 فريق ، name , score , group ف انت بتسوي infile بس
كود:
 infile>>name[i]>>score[i]>>group[i];
    while(infile){
        i++;
        infile>>name[i]>>score[i]>>group[i];
    }

بعدين تطلب من اليوزر يدخل char اللي هو رمز group وبعدين تطبع الدول اللي في هالقروب و عدد ل scorre ، الماكس ، ومجموع لـ score
 

السلام عليكم

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

void main(){
for(int i=1;i<=2;++i)
calcF();


ما هو الاوت بوت لهذا السؤال ؟


كذلك هذا السؤال

int num[6]={8,12,17,21,13,5}, x;
for (x=0; x<3; ++x){
if (num[x]>num[6-x-1])
cout<<num[x]<<endl;
else
cout<<num[6-x-1]<<endl;
}


وشكرا جزيلا
 
void editValues(int n1, int& n2, int& n3)
{
n1=n2;
n2=n3;
n3=n1;
n1=n2+n3;
cout<<n1<<"\t"<<n2<<"\t"<<n3<<endl;
}

void main()
{
int x=2, y=4, z=6;
cout<<x<<"\t"<<y<<"\t"<<z<<endl;
editValues(x, y, z);
cout<<x<<"\t"<<y<<"\t"<<z<<endl;
}




6- What is the output of the following code?
int h=20;
void main()
{
int e=14;
cout<<h<<" "<<e<<endl;
int h=6;
{
int e=2;
cout<<h<<" "<<e<<endl;
}
cout<<h<<" "<<e<<endl;
}

7- What is the output of the following code?

int a[3][4]={{4, 6, 4}, {8,2}, {9, 3, 1, 1} }, sum=0;
for (int i=1; i<=2; i++)
{
for(int j=0;j<=2;j++)
sum+=a[j];

cout<<i<<"\t"<<sum<<endl;
} 
 
2- What is the output of the following code?

char arr[3][3]={ {'A','H','B'}, {'T','K','N'}, {'D','I','G'} };

for (int k=1; k<=2; k++)
for(int g=1;g<=2;g++)
cout<<arr[g][k];





3- What is the output of the following code?
void startMe(int x){
static int a=2;
a*=x;
cout<<x<<" "<<a<<endl;
}

void main(){
for(int i=2;i<4;++i)
startMe(i);
}






4- What is the output of the following code?

int num[6]={5,11,14,10,18,9}, x;

for (x=0; x<3; ++x){
cout<<num[3-x-1]<<"\t"<< num[3+x];
cout<<endl;
}


5- What is the output of the following code?
void modifyMe(int w, int& r)
{
w+=3;
r-=3;
cout<<w<<"\t"<<r<<endl;
}

void main()
{
int a=12, b=6;
cout<<a<<"\t"<<b<<endl;
modifyMe(a, b);
cout<<a<<"\t"<<b<<endl;
}


6- What is the output of the following code?
int h=10;
void fun(){
int m=3;
++h;
cout<<m<<"\t"<<h<<endl;
--m;
}

void main()
{
int m=8;
cout<<m<<"\t"<<h<<endl;

int h=14;
fun();
cout<<m<<"\t"<<h<<endl;
}
 
2- What is the output of the following code?

char arr[3][3]={ {'A','H','B'}, {'T','K','N'}, {'D','I','G'} };

for (int k=1; k<=2; k++)
for(int g=1;g<=2;g++)
cout<<arr[g][k];





3- What is the output of the following code?
void startMe(int x){
static int a=2;
a*=x;
cout<<x<<" "<<a<<endl;
}

void main(){
for(int i=2;i<4;++i)
startMe(i);
}






4- What is the output of the following code?

int num[6]={5,11,14,10,18,9}, x;

for (x=0; x<3; ++x){
cout<<num[3-x-1]<<"\t"<< num[3+x];
cout<<endl;
}


5- What is the output of the following code?
void modifyMe(int w, int& r)
{
w+=3;
r-=3;
cout<<w<<"\t"<<r<<endl;
}

void main()
{
int a=12, b=6;
cout<<a<<"\t"<<b<<endl;
modifyMe(a, b);
cout<<a<<"\t"<<b<<endl;
}


6- What is the output of the following code?
int h=10;
void fun(){
int m=3;
++h;
cout<<m<<"\t"<<h<<endl;
--m;
}

void main()
{
int m=8;
cout<<m<<"\t"<<h<<endl;

int h=14;
fun();
cout<<m<<"\t"<<h<<endl;
}

تقدرون تشغلون البرامج وتشوفون الاوت بوت ، إذا في شي في هالبرامج مو مفهوم تقدرون تسألون وإن شاء الله بنساعدكم..
 
ما عندي البرنامج للاسف

اخاف انزل من مكان غير موثوق ويخرب الجهاز

جربت مواقع ما تعرض الاوت بت للاسف
 
حلك غلط اخوي..، السؤال يقول انه في عندك في ملف معلومات عن 32 فريق ، name , score , group ف انت بتسوي infile بس
كود:
 infile>>name[i]>>score[i]>>group[i];
    while(infile){
        i++;
        infile>>name[i]>>score[i]>>group[i];
    }

بعدين تطلب من اليوزر يدخل char اللي هو رمز group وبعدين تطبع الدول اللي في هالقروب و عدد ل scorre ، الماكس ، ومجموع لـ score


شرحك مو مفهوم
 
شرحك مو مفهوم
السؤال يقول انه عندك ملف اسمه ("fifa.txt") في معلومات عن 32 فريق والمعلومات هي : name,score,group

المطلوب منك:
-انك تكتب برنامج يقرأ المعلومات من الملف.
-يطلب من اليوزر يدخل رمز قروب (char) ، وبعد مايدخل اليوزر الرمز تطبع الدول اللي في (group) ، تطبع الماكس (اكثر دوله سجلت اهداف) ، وتطبع مجموع الاهداف في هالقروب.


*تقدر تستخدم الفور لوب بما انه عطاك في السؤال عدد محدد...
 
السؤال يقول انه عندك ملف اسمه ("fifa.txt") في معلومات عن 32 فريق والمعلومات هي : name,score,group

المطلوب منك:
-انك تكتب برنامج يقرأ المعلومات من الملف.
-يطلب من اليوزر يدخل رمز قروب (char) ، وبعد مايدخل اليوزر الرمز تطبع الدول اللي في (group) ، تطبع الماكس (اكثر دوله سجلت اهداف) ، وتطبع مجموع الاهداف في هالقروب.


*تقدر تستخدم الفور لوب بما انه عطاك في السؤال عدد محدد...

مو راضي يصير ..

جوف هاي الكود
كود:
#include<iostream>#include<fstream>
#include<string>
using namespace std;
int main () 
{
    char group[32] ; int score[32] ; string name[32] ;
	int i=0 ; char b ; int counter=0 ; int max=0 ; int total=0 ; 
    ifstream infile ; 
    infile.open("fifa.txt");


	if ( !infile)
		cout<<"Erorr in file "<<endl; 
	else{
	
		
	 cout<<"Enter Group Letter : ";
	 cin>>b ; 
	 
	 infile>>name[i]>>score[i]>>group[i];
	 cout<<"Total score for all team in Group "<<b<<" is "<<max<<endl;
	 cout<<name[i]<<"has the highest socre of "<<score[i]<<" in group "<<b<<endl;
	 cout<<"Team"<<"\t"<<"Score"<<endl;
	}


    while(infile){
        i++;
        infile>>name[i]>>score[i]>>group[i];
		cout<<name[i]<<"\t"<<score[i]<<endl;}
	for (int x = 0; x < counter; x++)
	{
		total += score[x];                 
		if (score[x] > max)        
			max=score[x];


	 
	}
	
        infile.close();




        system("pause");
        return 0 ;
        }
 
مو راضي يصير ..

جوف هاي الكود
كود:
#include<iostream>#include<fstream>
#include<string>
using namespace std;
int main () 
{
    char group[32] ; int score[32] ; string name[32] ;
    int i=0 ; char b ; int counter=0 ; int max=0 ; int total=0 ; 
    ifstream infile ; 
    infile.open("fifa.txt");


    if ( !infile)
        cout<<"Erorr in file "<<endl; 
    else{
    
        
     cout<<"Enter Group Letter : ";
     cin>>b ; 
     
     infile>>name[i]>>score[i]>>group[i];
     cout<<"Total score for all team in Group "<<b<<" is "<<max<<endl;
     cout<<name[i]<<"has the highest socre of "<<score[i]<<" in group "<<b<<endl;
     cout<<"Team"<<"\t"<<"Score"<<endl;
    }


    while(infile){
        i++;
        infile>>name[i]>>score[i]>>group[i];
        cout<<name[i]<<"\t"<<score[i]<<endl;}
    for (int x = 0; x < counter; x++)
    {
        total += score[x];                 
        if (score[x] > max)        
            max=score[x];


     
    }
    
        infile.close();




        system("pause");
        return 0 ;
        }

كود:
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main () 
{
    char group[32] ; int score[32] ; string name[32] ;
    int s;
    int i=0 ; char b ; int counter=0 ; int max=0 ; int total=0 ; 
    ifstream infile ; 
    infile.open("fifa.txt");


    if ( !infile)
        cout<<"Erorr in file "<<endl; 
    else{
        infile>>name[i]>>score[i]>>group[i];
     while(infile){
        i++;
        infile>>name[i]>>score[i]>>group[i];
        counter++;
    }
         
}
    cout<<"Enter Group Letter : ";
     cin>>b ; 

    
    for (int x = 0; x < counter; x++)
    {
        if(group[x]==b){
            
        total += score[x];                 
        if (score[x] > max){
        max=score[x];
            s=x;    
        }        
                
        }
        


     
    }

    
    cout<<"Total score for all team in Group "<<b<<" is "<<total<<endl;
     cout<<name[s]<<" has the highest socre of "<<score[s]<<" in group "<<b<<endl;
    cout<<"Teams in Group "<<b<<" are:"<<endl;
    cout<<"Team"<<"\t"<<"Score"<<endl;
    for(int j=0;j<32;j++)
    if(group[j]==b)
    cout<<name[j]<<"\t"<<score[j]<<endl;
    
    
        infile.close();




        system("pause");
        return 0 ;
        }
 


نزلته شكرا

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