الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

لو سمحتوا ساااااااااااعدوني

مغلق
بدأه al7elwah في 9 أبريل 2005 · 2 رد · 491 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

أبي أعرف الأخطاء إذا ممكن وهذا هو السؤال وهذي طريقتي في الحل

Write program that reads some information of 10 students (name [max 15] , level number , #of points , #of hours , GPA , student id ). These fields should be filled for each student by user except GPA. The GPA (max: 5) should be calculate it by function that takes #of points , #of hours as arguments and return the value of GPA.

Using small menu, the user can done some operations:

1. print all information for specific name

2. print all students names and ids that their GPA more than 4

3. sort the students information using student name

4. exit

here is the code

#include<iostream.h>
#include<string.h>
float fun(float arr[][1],float arr[][3]){

	arr[5]=(arr[1]/arr[2]);
	return arr[5];}
int main(){
	char ch,temp;
	int i,b,a,num;
	char arr_name[10];
	float arr[10][5];
	cout<<"this is a small menu to show what this program do\n";
	cout<<"to use this program you should use the same order of \n";
	cout<<"the menu......\n";
	cout<<"                *^*^*^*****^*^*^*\n";
	do{
	cout<<"1. print all information for specific name.\n";
	cout<<"2. prints all student's names and id's that their GPA more than 4.\n";
	cout<<"3. sort the student information using the student's name.\n";
	cout<<"4. exit.\n";
	cin>>num;

	switch(num){
	case 1 :for(i=0;i<10;i++){

  cout<<"enter the name for student "<<i<<endl;
  gets(arr_name[ch]);
  cout<<"enter the student's level number: ";
 	 cin>>arr[0];
 	 cout<<"enter the student;s points of all classes: ";
 	 cin>>arr[1];
 	 cout<<"enter the students hours of all classes: ";
 	 cin>>arr[2];
 	 cout<<"enter the student's id number: ";
 	 cin>>arr[3];
 	 arr[5]=fun(arr[][1],arr[][2]);
 	 cout<<"the GPA for student number "<<i<<" is "<<arr[5]<<endl;
  }
  break;
	case 2 :for(i=0;i<10;i++){
  if(arr[5]>4)
 	 cout<<"the student's name is :  "<<arr_name<<"    id number:  "<<arr[4]<<"\n";
 	 }
  break;
  case 3 :for(i=0;i<10;i++){
  for(a=0;a<10;a++){
 	 for(b=9;b<=a;b--){
    if (arr_name[b-1]>arr_name){
   	 temp=arr_name[b-1];
   	 arr_name[b-1]=arr_name;
   	 arr_name=temp;}
 	 }
  }
 	 cout<<arr_name;
 	 }
  break;
	case 4 :cout<<"thank you for visiting this program\n";
  break;
	}while(num!=4);
	return 0;
	}
}

تم تعديل هذه المشاركة بواسطة احمد غريب في 10 أبريل 2005 في 21:58

#2

ياريت تنزل البرنامج ككود عشان نعرف نتتبعه لأني مش عارف أقراه كويس غير كده ياريت تقول الخطأ الي طالع بالظبط

SYNTAX ERROR

LOGIC ERROR

#3

انا ما اعرف كيف أنزله ككود والأخطاء لما أسوي كومبايلر يعطيني 5 ايرور

هذا الموضوع مغلق.

مواضيع مشابهة