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

اساتذتي ،، أحتاج إلى تقييمكم للبرنامج من فضلكم ،،

مغلق
بدأه العصاميه في 11 ديسمبر 2003 · 4 رد · 622 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

#include<iostream.h>

#include<string.h>

#include<stdlib.h>

#include<conio.h>

#include<iomanip.h>

void Insert_Sort(char [][10],long [],int&);

void Display(char [][10],long [],int&);

void SearchC(char [][10],int&);

void SearchP(long [],char [][10],int&);

void Delete(char [][10],long [],int&);

void Exit(int&);

void main()

{

system("color 4f");

const int Max=30;

char Car[Max][10];

long Price[Max];

int ch,num=0,search;

for(int a=0;a<Max;a++)

{

Price[a]=0;

for(int b=0;b<10;b++)

Car[a]='\0';

}//this loop is to initialize the value of both cars & prices Arrayes

do

{

cout<<endl<<setw(47)<<" )*(WELCOME)*(\n"

<<setw(45)<<" /_______/|\n"

<<setw(51)<<" ____| | ||______\n"

<<setw(52)<<"/_____|___|___|/_____/|\n"

<<setw(52)<<"| ___' |' ___ C| |\n"

<<setw(51)<<"|__( @ )__|__( @ )__|/\n"

<<setw(46)<<" '-' '-'\n"

<<setw(71)<<" ---------------------------(^_^)-----------------------------\n"

<<setw(72)<<"| This program helps you as an owner for a car company |\n"

<<setw(72)<<"| It gives you many usefull choices to organize your business |\n"

<<setw(72)<<"| You could choose the service you need from the list below |\n"

<<setw(71)<<" -------------------------------------------------------------\n"

<<setw(55)<<" ___ ___ \n"

<<setw(56)<<" _|_1_|_ _|_2_|_\n"

<<setw(57)<<"|_o_|_o_| |_o_|_o_|\n"

<<setw(56)<<" INSERT DISPLAY\n"

<<setw(55)<<" ___ ___ \n"

<<setw(56)<<" _|_3_|_ _|_4_|_\n"

<<setw(57)<<"|_o_|_o_| |_o_|_o_|\n"

<<setw(56)<<" SEARCH DELETE\n"

<<setw(43)<<" ___\n"

<<setw(45)<<" _|_5_|_\n"

<<setw(46)<<"|_o_|_o_|\n"

<<setw(43)<<" EXIT\n";

cin>>ch;

if(ch==1)

Insert_Sort(Car,Price,num);

else if(ch==2)

Display(Car,Price,num);

else if(ch==3)

{

if(num>0)

{

cout<<setw(50)<<"You chose (SEARCH)\n"

<<setw(57)<<"There are two kinds of search :\n"

<<setw(72)<<"1* You could search for a certain car by entering it's name.\n"

<<setw(71)<<"2* You could enter a price & a list of cars with this price\n"

<<setw(36)<<"or less will appeare.\n"

<<endl<<setw(57)<<"Enter your choice , please : ";

cin>>search;

if(search==1)

SearchC(Car,num);

else

SearchP(Price,Car,num);

}

else//this massage will appeares if the company was empty

cout<<setw(60)<<" -----------------(^_^)-----------------\n"

<<setw(61)<<"| Sorry there is no cars in the company |\n"

<<setw(61)<<"| try to insert cars first please |\n"

<<setw(60)<<" ---------------------------------------\n";

}

else if(ch==4)

Delete(Car,Price,num);

else

Exit(ch);

cout<<endl;

getch();

system("cls");

}while(ch!=6);

}//end main

void Insert_Sort(char C[30][10],long P[30],int &n)

{

char xC[10],ans[4];

long xP;

if(n<29)

{

cout<<setw (75)<<"You chose (INSERT) which allowes you to enter cars to the company..\n"

<<setw (57)<<"The company can acceptes 30 cars\n"

<<setw (67)<<"so please make sure you don't get over this limit..\n\n";

do//this do/while loop will receive the cars names & prices from the user

{

cout<<setw (45)<<"Enter the name of car no. "<<n+1<<" , please : ";

cin>>C[n];

cout<<setw (50)<<"Enter it's price , please : ";

cin>>P[n];

cout<<endl<<setw (53)<<"Do you want to add another car?! ";

cin>>ans;

cout<<endl;

n++;

}while((n<30)&&(strcmp(ans,"yes")==0)||(strcmp(ans,"Yes")==0));

for(int out=1;out<n;out++)

{//those loops are for sorting cars by thier prices ..

for(int in=out;((in>0)&&(P[in]>P[in-1]));in--)

{

xP=P[in];

P[in]=P[in-1];

P[in-1]=xP;

strcpy(xC,C[in]);

strcpy(C[in],C[in-1]);

strcpy(C[in-1],xC);

}//end inner loop

}//end outer loop

}

else//if the user try to enter more than 30 cars , this massage will appeares

cout<<setw(56)<<" -------------(^_^)-------------\n"

<<setw(57)<<"| Sorry but the company is FULL |\n"

<<setw(57)<<"| Try another service |\n"

<<setw(56)<<" -------------------------------\n";

}//end Insert function

void Display(char C[30][10],long P[30],int &n)

{

if(n>0)

{

cout<<setw(51)<<"You chose (DISPLAY)\n"

<<setw(70)<<"Here is a table that shows all the cars in the company\n"

<<setw(55)<<"arranged by thier prices\n\n"

<<setw(67)<<" _________________________________________________\n"

<<setw(68)<<"| no. | THE CAR | THE PRICE |\n"

<<setw(68)<<"|_____|_____________________|_____________________|\n";

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

{

if(d<9)

cout<<setw(19)<<"| "<<d+1<<" |"<<setw(13)<<C[d]<<" |"<<setw(13)<<P[d]<<" |\n";

else

cout<<setw(19)<<"| "<<d+1<<" |"<<setw(13)<<C[d]<<" |"<<setw(13)<<P[d]<<" |\n";

}

cout<<setw(67)<<"|_____|_____________________|_____________________|";

}//end if statment

else//this massage will appeares if the company was empty

cout<<setw(61)<<" ----------------(^_^)------------------\n"

<<setw(62)<<"| Sorry there is no cars in the company |\n"

<<setw(62)<<"| try to insert cars first please |\n"

<<setw(61)<<" ---------------------------------------\n";

}//end display function

void SearchC(char C[30][10],int &n)

{

int T1=0;

char Scar[10];

cout<<setw(55)<<"Enter the car's name , please :";

cin>>Scar;

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

{

if(strcmp(C,Scar)==0)

{T1=1;

break;}

}

if(T1==1)

cout<<endl<<setw(53)<<"The car you've been loking for ("<<C<<") is found\n"

<<setw(50)<<"& it's number is ("<<s+1<<")";

else

cout<<endl<<setw(75)<<"(Sorry the car you've been looking for is not found in the company)\n";

}//end searchC function

void SearchP(long P[30],char C[30][10],int &n)

{

int T2=0;

long Sp;

cout<<setw(52)<<"Enter the price , please : ";

cin>>Sp;

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

{

if(P[sch]==Sp||P[sch]<Sp)

{T2=1;

break;}

}

if(T2==1)

{

cout<<endl<<setw(67)<<"The cars which have this price or less are :\n";

for(int sh=sch;sh<n;sh++)

cout<<setw(43)<<C[sh]<<endl;

}

else

cout<<setw(65)<<"(Sorry but there are no cars with this price)\n";

}//end searchP function

void Delete(char C[30][10],long P[30],int &n)

{

int T3=0;

char Del[10];

if(n>0)

{

cout<<setw(65)<<"Enter the name of the car you want to delete , please : ";

cin>>Del;

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

{

if(strcmp(C[d],Del)==0)

{T3=1;

break;}

}

if(T3==1)

{

for(int de=d;de<n-1;de++)

{

strcpy(C[de],C[de+1]);

P[de]=P[de+1];

}

cout<<endl<<setw(49)<<"(The car is deleted)";

n--;

}

else

cout<<endl<<setw(75)<<"(Sorry the car which you want to delete is not found in the company)\n";

}//end if statment

else//this massage will appeares if the company was empty

cout<<setw(60)<<" -----------------(^_^)-----------------\n"

<<setw(61)<<"| Sorry there is no cars in the company |\n"

<<setw(61)<<"| try to insert cars first please |\n"

<<setw(60)<<" ---------------------------------------\n";

}//end Delete function

void Exit(int &choice)

{

cout<<endl

<<setw(63)<<" -------------------(^_^)-------------------\n"

<<setw(64)<<"| Well it's been nice working with you |\n"

<<setw(64)<<"| I hope this program was usefull for you |\n"

<<setw(64)<<"| WISH YOU ALL THE BEST |\n"

<<setw(63)<<" -------------------------------------------\n"<<endl

<<setw(58)<<" _______\n"

<<setw(59)<<" /_______/|\n"

<<setw(65)<<" ____| | ||______\n"

<<setw(66)<<" /_____|___|___|/_____/|\n"

<<setw(66)<<"~~~ BYE BYE ~~~| ___' |' ___ C| |\n"

<<setw(65)<<" |__( @ )__|__( @ )__|/\n"

<<setw(61)<<" '-' '-'\n\n";

choice++;

}//end Exit function

#2

لم أطلع على الكود بعد لكن تنفيذه إلى الآن سليم ولم أكتشف فيه أي خطأ

في الـRun time لكن إن شاء الله أراجعه وأشوف.

#3

الحمد لله ،، :)

و يهمني رأيك بالتأكييييد أخي الكريم ،،

و أنا بالإنتظار ،،

أختك ،،

العصامية ،،

#4

السلام عليكم ,,

ماشاء الله عليكي أختي العصامية ,, برنامج أكثر من راااااااائع ,,

بصراحة أعجبتني موهبتك في الرسم بالرموز الغريبة ,,

والجدول الذي يعرض السيارات أيضا ممتاز وفعال ,,

لم أجرب أن أضغط على البرنامج لأعرف مشاكله " ان وجدت " :) ,,

اذا كان هذا البرنامج تدريبي ,, فأنتي موهوبة ومثابرة ,,

واذا أردتي تحسينه مثلا ,, يمكنك أن تدخلي بيانات السيارات في ملف بدل الذاكرة "المتغيرات " بحيث اذا قمتي باطفاء الجهاز لاتضيع البيانات ,, فأمر جيد وستطوري مستواك بشكل ممتاز ,,

أخيرا أقول لديك مستقبل جيد باذن الله في الفيجوال سي++ لأنه يمكنك أن تقومي بعمل كهذا ,, وأن تركزي على قواعد البيانات ,, وابداعات الرسم سيكون أمرها أسهل من هذا بالتأكيد ,,

وفقك الله ,,

banner_60_468.gif

NOTHING IS IMPOSSIBLE

#5

الســــــ عليكم ــــــــــلام........

البرنامج مبدع وطريقة عرضه ممتازة وإذا استطعت تطويع شاشة الكونسول وخرجت بهذه الرسومات فهذا يدل على إنك راح تنجي أكيد في الفيجوال سي++.

والواضح أن البرنامج متعوب عليه وأنا أعرف هذا الشي فلقد استغرقني اليومين الفائتين رسم جدول وتنسيقه في هذه الشاشة السوداء وطلعت عيوني على ما ضبط.

فكيف بوزن هذه الرسومات الكثيرة.

على العموم عندي ملاحظات علشان يكمل الزين يا ليت تتقبليها:

1- استخدمتي هيكل بياني بسيط هو المصفوفات array والتي يصعب التلاعب بها وتغييرها. لو استخدمتي الـ Linked List يكون أفضل و يعطيك حرية أكبر في إضافة سيارة جديدة فممكن تضيفينها في الأول وممكن في الأخير و ممكن في أي مكان في الوسط

وبالتالي ممكن للمستخدم(صاحب معرض السيارات) أنه يرتب الجدول مثل ما يريد وهذي ميزة تزيد عدد مستخدمي البرنامج.

2- رسم جدول العرض يحتاج إلى مراحعة حتى يكون في أبهى صورة والعملية تطفش لكنها مطلوبة وأعتقد إنها سهلة لأنه التعديل في الخانات العليا من الجدول وهي ثابتة لا يكتب عليها وبالتالي لا تتحرك.

3- في عملية البحث يطلب البرنامج من المستخدم الإختيار بين 1) البحث بالإسم

2) البحث بالسعر . وفي حالة إدخال أي رقم آخر يحدث خطأ في البرنامج فالمطلوب في حالة إدخال أي رقم آخر يطبع رسالة تقول إن الرقم المدخل خاطئ ويطلب من المستخدم إدخال رقم آخر وذلك باستخدام while loop يستمر ذلك حتى يدخل المستخدم 1 أو 2.

4- في البحث لو كان هناك سياراتين بنفس الإسم يجب أن يقول أن السيارة وجدت 2 مرة

وذلك بالبحث عن جميع حالات وجود السيارة بتعديل بسيط في البحث.

5- لا أدري إن كنت قد درست الـ filing أو حفظ البيانات في ملف باستخدام fstream

ولكن هذا مفيد جداً و سيجعل للبرنامج قاعدة بيانات (مثل ما قال الأستاذ HGB)

في الختام أهنيك على هذا النجاح وتراك قطعتي شوط طويل في البرمجة وآسف على الإطالة وترى لا تخافي كل هالنقاط زيادة في الزين و ماشاء الله عليك مشروع مبرمج محترفة.

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

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