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

ضروري جداً (برنامج لجمع نتائج المبارايات)

بدأه hhh1727 في 27 ديسمبر 2008 · 3 رد · 445 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

بســم الله الـرحمــن الرحيــم

السلام عليكــم ورحمـة الله وبركاتــه

أخواني الاعضاء الكرام

أنا في ورطة

ومحتاج فزعة أي شخص يعرف في c++ , Sorting

وهذه مواصفات البرنامج

""The program have to produce a ranked (i.e. sorted) list of teams in a series of football tournaments. The program should read the tournament name, team names, and games played, and it should output the tournament standings.

A team wins a game if it scores more goals than its opponent, and loses if it scores fewer goals. Both teams tie if they score the same number of goals. A team earns 3 points for each win, 1 point for each tie, and 0 points for each loss.

Teams are ranked according to these rules (in this order):

1- Most points earned.

2- Most wins.

3- Most goal difference (i.e., goals scored – goals against).

4- Most goals scored.

5- Fewest games played.

6- Case-insensitive lexicographic order. "

{Output style:

(no. of order) Team name (total points earned), (no. of games played), ([wins no.], [ties no.], [losses no.]), (goal difference), ([goals scored]-[goals against])

}

"

ضروري جداً دخليلكم

طالبنكم طلبه

#2

اسف أخواني على مخالفتي للقوانين

كنت لا اعرف انه لازم اضع محاولتي

هذه إحدى محاولتي

((#include<iostream>

#include<fstream>

#include<cstring>

#include<sstream>

using namespace std;

#define N_teams 30

struct Team_T {

string teamName;

int point;

int game;

int win;

int tie;

int loss;

int goalD;

int goalS;

int goalA;

} teams [N_teams];

int main(){

int N_t=0, NOfT=0, N_M=0;

int S1, S2;

char ToName[30];

char teamName1[20],teamName2[20];

cout<<"enter the no. of tournament:";

cin>>NOfT;

for(int a=0;a<NOfT;a++){

cout<<"Enter the name of the tournament"<<a+1<<endl;

cin>>ToName;

cout<<endl;

cout<<"enter the no. of teams at the tournament "<<a+1<<":";

cin>>N_t;

for (int n=0; n<N_t; n++)

{

cout << "Enter name of the team "<<n+1<<":";

cin>>teams[n].teamName;

}

cout<<"enter the no. of the matches were played in this tournament:";

cin>>N_M;

for (int i=0; i<N_M; i++)

{

cout << "Match Number "<<i+1<<endl;

cout<<"Please enter the first team: ";

cin>>teamName1;

cout<<"Please enter the score of the first team: ";

cin>>S1;

cout<<"Please enter the second team: ";

cin>>teamName2;

cout<<"Please enter the score of the second team: ";

cin>>S2;

if (teamName1==teams[N_teams].teamName)

{

if(S1=S2)

{int point;

teams[N_teams].game+1;

teams[N_teams].win;

teams[N_teams].tie+1;

teams[N_teams].loss;

teams[N_teams].goalD;

teams[N_teams].goalS+S1;

teams[N_teams].goalA+S2;}

else if(S1>S2)

{teams[N_teams].game+1;

teams[N_teams].win+1;

teams[N_teams].tie;

teams[N_teams].loss;

teams[N_teams].goalD;

teams[N_teams].goalS+S1;

teams[N_teams].goalA+S2;}

else

{teams[N_teams].game+1;

teams[N_teams].win;

teams[N_teams].tie;

teams[N_teams].loss+1;

teams[N_teams].goalD;

teams[N_teams].goalS+S1;

teams[N_teams].goalA+S2;}

}

else

continue;

}

cout << "\nYou have entered these teams:\n";

for (int n=0; n<N_t; n++)

cout<<teams[n].teamName<<endl;

}

return 0;

}

))

أحد الاخطاء يظهر عندي

يغلق البرامج

عند تشغيل هذه الجملة if (teamName1==teams[N_teams].teamName)

بس ارجوكم ضروري

تم تعديل هذه المشاركة بواسطة hhh1727 في 27 ديسمبر 2008 في 17:39

#3

وعليكــم السـلام ورحمة الله وبركاتـه..

اولا التعليمات مثل هذه :

teams[N_teams].loss+1;

ماقصدك بها ؟

هل تقصد

teams[N_teams].loss+=1;

ثانيا , مافائدة المتغير

	int point;

لم اراك تستخدمه ؟

تم تعديل هذه المشاركة بواسطة time1 في 28 ديسمبر 2008 في 00:10

llback.jpg

اشهد ان لا إله إلا الله وان محمدا ً رسول الله

#4

على الملاحظة الاولى نعم هذا هو اللي اقصده teams[N_teams].loss+=1;

اما على الملاحظة الثانية فأنا باستخدم هذه في خطوة زيادة ما حطيتها بعدني

عالعموم شكرا على الملاحظات

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