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

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

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

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

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

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

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

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

    الأصوات: 13 40.6%

  • مجموع المصوتين
    32
ترى التست عقب باجر :mellow: ، إذا في احد عطوهم اسئلة او شي ياليت يحطه هني جان نستفيد :whistling:
 
Q1
Write the program that displays the following grad of number using nested loops . Your output should be as folllows
56789
45678
34567
23456
12345

Q2
كود:
[/B][/LEFT]

[LIST=1]
[*]Write a value-returning function, [B]isVowel[/B] that returns the value [B]true[/B] if its character parameter is vowel and otherwise returns [B]false[/B].
[/LIST]
[B][U]Hint[/U][/B]: the vowels are: a, e, i, o, u.

[LIST=1]
[*]Write a program that prompts the user to input a sequence of characters and outputs the number of vowels. Use the function isVowel written in question 1.
[*]
[/LIST]
[LEFT][B]

كود:
[B]Q3[/B]
[CODE]Write a program that uses while loops to perform the following steps:
-          Prompt the user to input two integers [B]first[/B] and [B]second[/B] (first < second).
-          Output all odd numbers between first and second.
-          Output the sum of all even numbers between first and second.
-          Output the sum of the square of the odd numbers between first and second.
Q4
كود:
Write a program that reads a student’s name together with his or her test scores. The program should then compute the average test score for each student and assign the appropriate grade. The grade scale is as follows:
90-100, A        80-89, B          70-79, C          60-69, D          0-59, F
Your program must use the following functions:
[B]a.      [/B]A void function, [B][U]calculateAverage[/U][/B], to determine the average of the five test scores for each student. Use a loop to read and sum the five test scores. (This function does not output the average test score. That task must be done in the function main.)
[B]b.      [/B]A value-returning function, [B][U]calculateGrade[/U][/B], to determine and return each student’s grade. (This function does not output the grade. That task must be done in the function main.)
Test your program on the data saved in [B]data.txt[/B] (provided with the lab assignment in blackboard). Send the output to a file. Do not use any global variables. Use the appropriate parameters to pass values in and out of functions.
[B][U]Sample output[/U][/B]:
Student           Test1   Test2   Test3   Test4   Test5   Average           Grade
Ali                   85        83        77        91        76        82.4                 B
Zainab             86        90        95        93        88        90.4                 A
Aysha              78        81        11        90        73        66.6                 D
Mohamed        92        83        30        69        87        72.2                 C
Reem               23        45        96        38        59        52.2                 F

بإنتظار إجابتكم :smile2:
@Mohammed_13
 
Q1
Write the program that displays the following grad of number using nested loops . Your output should be as folllows
56789
45678
34567
23456
12345

Q2
كود:
[LIST=1]
[*]Write a value-returning function, [B]isVowel[/B] that returns the value [B]true[/B] if its character parameter is vowel and otherwise returns [B]false[/B]. 
[/LIST]
[B][U]Hint[/U][/B]: the vowels are: a, e, i, o, u.

[LIST=1]
[*]Write a program that prompts the user to input a sequence of characters and outputs the number of vowels. Use the function isVowel written in question 1. 
[/LIST]
كود:
[B]Q3[/B]
[CODE]Write a program that uses while loops to perform the following steps:
-          Prompt the user to input two integers [B]first[/B] and [B]second[/B] (first < second).
-          Output all odd numbers between first and second.
-          Output the sum of all even numbers between first and second.
-          Output the sum of the square of the odd numbers between first and second.
Q4
كود:
Write a program that reads a student’s name together with his or her test scores. The program should then compute the average test score for each student and assign the appropriate grade. The grade scale is as follows:
90-100, A        80-89, B          70-79, C          60-69, D          0-59, F
Your program must use the following functions:
[B]a.      [/B]A void function, [B][U]calculateAverage[/U][/B], to determine the average of the five test scores for each student. Use a loop to read and sum the five test scores. (This function does not output the average test score. That task must be done in the function main.)
[B]b.      [/B]A value-returning function, [B][U]calculateGrade[/U][/B], to determine and return each student’s grade. (This function does not output the grade. That task must be done in the function main.)
Test your program on the data saved in [B]data.txt[/B] (provided with the lab assignment in blackboard). Send the output to a file. Do not use any global variables. Use the appropriate parameters to pass values in and out of functions.
[B][U]Sample output[/U][/B]:
Student           Test1   Test2   Test3   Test4   Test5   Average           Grade
Ali                   85        83        77        91        76        82.4                 B
Zainab             86        90        95        93        88        90.4                 A
Aysha              78        81        11        90        73        66.6                 D
Mohamed        92        83        30        69        87        72.2                 C
Reem               23        45        96        38        59        52.2                 F

بإنتظار إجابتكم :smile2:
@Mohammed_13

كود:
#include <iostream>
using namespace std;
int main()
{
    int t=10;
    for(int c=5;c>=1;c--){
        
        for(int j=c;j<t;j++)
        cout<<j;
        cout<<endl;
        t--;
        
    }
    
    system("pause");
    return 0;
    
}

كود:
#include <iostream>
using namespace std;
int main()
{
    int x,y,sum=0,oddsum=0;
    cout<<"Enter two integer number:";
    cin>>x>>y;
    while(x<y){
        
        if(x%2==0)
        sum+=x;
        else oddsum+=x,cout<<x<<endl;
        x++;
        
    }
    cout<<"Sum of even number:"<<sum<<endl;
    cout<<"Sum of odd number:"<<oddsum*oddsum<<endl;
    system("pause");
    return 0;
    
}
مشكوور على الاسئلة...
الفانكشن تونه ماخذينه ، يعني للحين ماتعمقنا فيه :whistling:
 
PHP:
#include<iostream>
using namespace std;
int main()
{
  long i;
  int cr;
  float g;
  int eg=0;
  
  cout<<"enter students iD , GPA and hours ,negative to stop"<<endl;
  cin>>i;
  
  while (i!=-1)
  {
   if (g>=2 && cr>=95) 
       eg++;
       
         cin>>i>>g>>cr;
  }
  cout<<"expected to graduate"<<eg<<"students"<<endl;
  system("pause");
  return 0;
  
  
}

المفروض ان لما ندخل -1 يخلص البرنامج
بس على حسب حلي ان لازم ندخل -1 ثلاث مرات عشان يخلص البرنامج ليش !
 
PHP:
#include<iostream>
using namespace std;
int main()
{
  long i;
  int cr;
  float g;
  int eg=0;
  
  cout<<"enter students iD , GPA and hours ,negative to stop"<<endl;
  cin>>i;
  
  while (i!=-1)
  {
   if (g>=2 && cr>=95) 
       eg++;
       
         cin>>i>>g>>cr;
  }
  cout<<"expected to graduate"<<eg<<"students"<<endl;
  system("pause");
  return 0;
  
  
}

المفروض ان لما ندخل -1 يخلص البرنامج
بس على حسب حلي ان لازم ندخل -1 ثلاث مرات عشان يخلص البرنامج ليش !
السلام عليكم
اختي البرنامج يوقف اللوب منن اول -1 عندي ما اشوف فيه مشكلة ، يمكن انت تضغطين سبيس عقب ما تدخلين ال i و cr و ال g عشان جذي يتهيألش انش لازم تدخلنه 3 مرات من أول مرة تدخلين -1 اضغطي انتر و بيوقف اللوب
 
  • Like
التفاعلات: KO8
PHP:
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
 
 float gpa,p;
 int s=0;
 int x=0;
 
 cout<<"enter student GPA's"<<endl;
 cin>>gpa;
 
 while (gpa!=-1)
 {
  s++;
  if (gpa==4) x++;
  cin>>gpa;
 }
 p=x/s;
 cout<<"there are"<<x<<"students with gpa of 4.0 \n";
 cout<<fixed<<showpoint<<setprecision(2);
 cout<<"they represent"<<p*100<<"of the students \n";
 
  system("pause");
  return 0;
  
  
}
percent of students with GPA of 4 يطلع 0 وين الخطأ :| ؟
 
PHP:
#include<iostream>
using namespace std;
int main()
{
  long i;
  int cr;
  float g;
  int eg=0;
  
  cout<<"enter students iD , GPA and hours ,negative to stop"<<endl;
  cin>>i;
  
  while (i!=-1)
  {
   if (g>=2 && cr>=95) 
       eg++;
       
         cin>>i>>g>>cr;
  }
  cout<<"expected to graduate"<<eg<<"students"<<endl;
  system("pause");
  return 0;
  
  
}

المفروض ان لما ندخل -1 يخلص البرنامج
بس على حسب حلي ان لازم ندخل -1 ثلاث مرات عشان يخلص البرنامج ليش !

طريقة كتابتش للوب غلط...
كود:
[SIZE=2][FONT=tahoma]     cin>>i>>g>>cr;[/FONT][/SIZE]
المفروض تخلين بس i بروحها ، لانه هني حتى لو دخلتين -1 بعد راح ينتظهر عشان تدخلين قيمة ال g و cr بعدها راح يرجع للوب ويجيك إذا -1 بيوقف...

المفروض تكتبين جذي:
كود:
[SIZE=2][FONT=tahoma] cin>>i;
            while (i!=-1)
      {
          
           cout<<"Enter GPA and hours:";
           cin>>g>>cr;
           if (g>=2 && cr>=95) 
       eg++;
                      cout<<endl<<"Enter students ID,negative to stop:";
           cin>>i;
       
      }[/FONT][/SIZE]
 
PHP:
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
 
 float gpa,p;
 int s=0;
 int x=0;
 
 cout<<"enter student GPA's"<<endl;
 cin>>gpa;
 
 while (gpa!=-1)
 {
  s++;
  if (gpa==4) x++;
  cin>>gpa;
 }
 p=x/s;
 cout<<"there are"<<x<<"students with gpa of 4.0 \n";
 cout<<fixed<<showpoint<<setprecision(2);
 cout<<"they represent"<<p*100<<"of the students \n";
 
  system("pause");
  return 0;
  
  
}
percent of students with GPA of 4 يطلع 0 وين الخطأ :| ؟
الخطأ بسيط جداً المتغيرين x و s انتيجر فمهما كان ناتج القسمة مالهم بكون كله 0 ما عدا في حالة ان كل الطلبة معدلهم 4 بيطلع 1 و بيصير الجواب 100 % فقط غيري نوع المتغيير من انتجر الى فلوت و بتنحل المشكلة
 
هذا سؤال عطونا اياه في تست 2 :whistling: ، كان المطلوب حساب عدد الاحرف في ملف...

كود:
#include <Iostream>
#include <fstream>
using namespace std;
int main()
{
int sum=0;
char ch;
ifstream infile;
infile.open ("file.txt");
if (!infile)
{
    cout<<"cannot open file";
    return 1;
}
infile>>ch;
while(!infile.eof())
{
sum++;
infile>>ch;
}

cout<<"sum="<<sum<<endl;

system ("pause");
return 0;
}
 
  • Like
التفاعلات: KO8
PHP:
#include<iostream>
using namespace std;
int main()
{
int num1,num2;
int x=num1,c1=0;
cout<<"enter first number:";
cin>>num1;
cout<<endl;
cout<<"enter second number:";
cin>>num2;
cout<<endl;
while(num1>num2)
{
 cout<<"invalid"<<endl;
cout<<"enter first number:";
cin>>num1;
cout<<endl;
cout<<"enter second number:";
cin>>num2;
cout<<endl;
}
cout<<"the numbers divisible by 5 are:"<<endl;
while(x>=num1 && x<=num2)
{
 
 if(x%5==0) c1++;
 if(x%5==0)cout<<x<<endl;
x++;
}
cout<<"ther are"<<c1<<"numbers divisible by 5"<<endl;
system("pause");
return 0;
}

الجزء الثاني من البروقرام ما يشتغل صح
الا هو الاعداد الي تقبل القسمة على خمسة
وكم عددها .
لما اشغله يطلع 0 .
وين الغلط :| ؟
 
PHP:
#include<iostream>
using namespace std;
int main()
{
int num1,num2;
int x=num1,c1=0;
cout<<"enter first number:";
cin>>num1;
cout<<endl;
cout<<"enter second number:";
cin>>num2;
cout<<endl;
while(num1>num2)
{
 cout<<"invalid"<<endl;
cout<<"enter first number:";
cin>>num1;
cout<<endl;
cout<<"enter second number:";
cin>>num2;
cout<<endl;
}
cout<<"the numbers divisible by 5 are:"<<endl;
while(x>=num1 && x<=num2)
{
 
 if(x%5==0) c1++;
 if(x%5==0)cout<<x<<endl;
x++;
}
cout<<"ther are"<<c1<<"numbers divisible by 5"<<endl;
system("pause");
return 0;
}

الجزء الثاني من البروقرام ما يشتغل صح
الا هو الاعداد الي تقبل القسمة على خمسة
وكم عددها .
لما اشغله يطلع 0 .
وين الغلط :| ؟
الغلط في اللوب الثاني لان مو قاعد يحسب شي اساساً ، الافضل انش تخلينه يحسب الارقام الي تنقسم على خمسة خلال اللوب الاولي تفضلي هذا الحل
كود:
#include<iostream>using namespace std;
int main()
{
int num1,num2;
int x=num1,c1=0;
cout<<"enter first number:";
cin>>num1;
cout<<endl;
cout<<"enter second number:";
cin>>num2;
cout<<endl;
while(num1>num2)
{
cout<<"enter first number:";
cin>>num1;
cout<<endl;
cout<<"enter second number:";
cin>>num2;
cout<<endl;
if ( num1%5 == 0 )
{ c1++ ; }
if ( num2%5 == 0 )
{ c1++ ; }
}
cout<<"the numbers divisible by 5 are:" ; 


cout << c1 << endl ; 
system("pause"); 
return 0 ; 
}
 
الغلط في اللوب الثاني لان مو قاعد يحسب شي اساساً ، الافضل انش تخلينه يحسب الارقام الي تنقسم على خمسة خلال اللوب الاولي تفضلي هذا الحل
كود:
#include<iostream>using namespace std;
int main()
{
int num1,num2;
int x=num1,c1=0;
cout<<"enter first number:";
cin>>num1;
cout<<endl;
cout<<"enter second number:";
cin>>num2;
cout<<endl;
while(num1>num2)
{
cout<<"enter first number:";
cin>>num1;
cout<<endl;
cout<<"enter second number:";
cin>>num2;
cout<<endl;
if ( num1%5 == 0 )
{ c1++ ; }
if ( num2%5 == 0 )
{ c1++ ; }
}
cout<<"the numbers divisible by 5 are:" ; 


cout << c1 << endl ; 
system("pause"); 
return 0 ; 
}
جربته بعد يطلع 0 !
 
جربته بعد يطلع 0 !
اختي اتوقع ولا رقم دخلتيه ينقسم على الرقم 5 فشي طبيعي انه بيطلع صفر
شوفي هاذي الصورة كوبايل لنفس الكود و دخلت رقمين ينقسمون على 5 الي هم 20 و 10 في النهاية طلع لي الارقام الي تنقسم على 5 هي 2
https://drive.google.com/file/d/0By6IydPqj2WAZWdocXJiSzRJOHc/view?usp=sharing
 
اختي اتوقع ولا رقم دخلتيه ينقسم على الرقم 5 فشي طبيعي انه بيطلع صفر
شوفي هاذي الصورة كوبايل لنفس الكود و دخلت رقمين ينقسمون على 5 الي هم 20 و 10 في النهاية طلع لي الارقام الي تنقسم على 5 هي 2
https://drive.google.com/file/d/0By6IydPqj2WAZWdocXJiSzRJOHc/view?usp=sharing
الارقام الي دخلتها num1=1 & num2=10
السؤال كان طالب ان ندخل num1 &num2 بحيث ان يكون num1 less than num2
وبعدين يطلع الارقام الي تقبل على خمسة ما بين الرقمين.
فالمفروض يطلع 5 و 10 صح ؟
 
الارقام الي دخلتها num1=1 & num2=10
السؤال كان طالب ان ندخل num1 &num2 بحيث ان يكون num1 less than num2
وبعدين يطلع الارقام الي تقبل على خمسة ما بين الرقمين.
فالمفروض يطلع 5 و 10 صح ؟

حطي هذي الجزئية وبيشتغل اوكي
كود:
while (num1<=num2)
{
 
 if(num1%5==0) 
 {
     c1++;
      cout<<num1<<endl;
 }
 

num1++;
}
cout<<"ther are "<<c1<<" numbers divisible by 5"<<endl;
 
  • Like
التفاعلات: KO8
الارقام الي دخلتها num1=1 & num2=10
السؤال كان طالب ان ندخل num1 &num2 بحيث ان يكون num1 less than num2
وبعدين يطلع الارقام الي تقبل على خمسة ما بين الرقمين.
فالمفروض يطلع 5 و 10 صح ؟
لا أختي بيطلع بس رقم واحد يقبل القسمة على 5 الي هو 10 لانش دخلتين رقمين بس الي هم 10 و 1 و ال 10 بس ينقسم على 5
بالنسبة للسؤال يبغي تسوين سي اوت للارقام التنقسم على 5 أو يبغي يحسبهم ؟ أو الاثنين ؟
 
لا أختي بيطلع بس رقم واحد يقبل القسمة على 5 الي هو 10 لانش دخلتين رقمين بس الي هم 10 و 1 و ال 10 بس ينقسم على 5
بالنسبة للسؤال يبغي تسوين سي اوت للارقام التنقسم على 5 أو يبغي يحسبهم ؟ أو الاثنين ؟

لا اتوقع السؤال مالها يعد من num1 إلى num2 ويطلع عدد الارقام اللي تقبل القسمه على 5 ، ويطبعهم بعد...
 
لا أختي بيطلع بس رقم واحد يقبل القسمة على 5 الي هو 10 لانش دخلتين رقمين بس الي هم 10 و 1 و ال 10 بس ينقسم على 5
بالنسبة للسؤال يبغي تسوين سي اوت للارقام التنقسم على 5 أو يبغي يحسبهم ؟ أو الاثنين ؟
سي اوت حق الارقام الي تنقسم على 5 ما بين num1 و num 2 ويحسبهم
 
كود:
#include<iostream>


using namespace std;
int main()
{
int num1,num2;
int [B][SIZE=4][COLOR=#ff0000]x=num1[/COLOR][/SIZE][/B],c1=0;
cout<<"enter first number:";
cin>>num1;
cout<<endl;
cout<<"enter second number:";
cin>>num2;
cout<<endl;
while(num1>num2)
{
 cout<<"invalid"<<endl;
cout<<"enter first number:";
cin>>num1;
cout<<endl;
cout<<"enter second number:";
cin>>num2;
cout<<endl;
}
[B][SIZE=4][COLOR=#ff0000]x=num1;[/COLOR][/SIZE][/B]
cout<<"the numbers divisible by 5 are:"<<endl;
while(x>=num1 && x<=num2)
{
 
 if(x%5==0) c1++;
 if(x%5==0)cout<<x<<endl;
x++;
}
cout<<"ther are"<<c1<<"numbers divisible by 5"<<endl;
system("pause");
return 0;
}
الجزء الثاني من البروقرام ما يشتغل صح
الا هو الاعداد الي تقبل القسمة على خمسة
وكم عددها .
لما اشغله يطلع 0 .
وين الغلط :| ؟

بالنسبة للوب فهي صحيحه ..
المشكلة صايرة أن ناخذ قيمة num1 إلى x قبل ما يدخلها اليوزر
عشان يشتغل بشكل صحيح نحطها قبل اللوب
:smile2:
 
عودة
أعلى أسفل