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

السلام عليكم ارجوا الرد الليلة ولكم جزيل الشكر

بدأه السهم الثاقب في 13 أبريل 2009 · 0 رد · 334 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1

السلام عليكم

ممكن مساعدة بسيطة

عندي سوال ضروري بدي احله اليوم اذا في امكانية

وهذا نص السوال ( اريد الفرع الرابع فقط)

You are to enter information about employees in 5 different companies. Each company has 20 employees. The structure for each employee should contain: name (allocated dynamically based on name length), ID (long), salary (double) between 200 and 4000 and the address (street and city). The city can be one of the following :{ Nablus, Jenin, Ramallah, Jerusalem, Bireh}. The program should output the following:

1. The average of salaries.

2. The names of the employees whose salaries are above the average

3. The list of employees and their information sorted in alphabetical order of their names

4. Print a table that shows the distribution of salaries over the 5 cities as follows:

Below 1000 Between 1000 and 2000 Between 2000 and 3000 Between 3000 and 4000

Nablus

Jenin

Ramallah

Jerusalem

Bireh

Expand  -  Plain text

 

#include<iostream.h>#include <string.h>struct student{		char name[5];	int ID;	long salary;	char adress[5];};void copy(student& a,student& b){	strcpy(a.name,b.name);	a.ID=b.ID;	a.salary=b.salary;	strcmp(a.adress,b.adress);}void swap(student& a,student& b){	student tmp;	copy(tmp,a);	copy(a,b);	copy(b,tmp);}void main(){	student A[5];	int i,j;	for( i=0; i<5; i++){						  			cout<<" Enter the name of employee "<<i+1<<" ==";			cin>>A.name;	   cout<<" Enter ID of employee"<<i+1<<" ==";		 cin>>A.ID;		  cout<<" Enter the salary of employee"<<i+1<<" ==";	  cin>>A.salary;	  cout<<" Enter the adress of employee "<<i+1<<" ==";		 cin>>A.adress;		 cout<<endl;		}	long total = 0;	double average=0;		for ( i=0; i<5; i++)	{		total +=(A.salary);	}	average = total / 5.0;	cout << "average is : " << average<<endl;	char* tmp;	for (i=0;i<5;i++)	{		for (j=i;j<5;j++)		{			if(strcmp(A.name,A[j].name)>=0)			{				swap(A,A[j]);			}		}	}	cout<<endl;	cout<<" The student in alpha order \n";	for (i=0;i<5;i++)	{		cout<<A.name<<'\t'<<A.ID<<'\t'<<A.adress<<'\t'<<A.salary<<endl;	}	cout<<"The names of students who salary the highest of average"<<endl;	for(i=0;i<5;i++)	if(A.salary>average)		cout<<A.name<<endl;	}

ارجوا الرد اليوم وبسرعة ان امكن ولكم جزيل الشكر

تم تعديل هذه المشاركة بواسطة Xacker في 18 يناير 2013 في 03:27

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

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…