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

مساعدة عاجلة في تراكيب البيانات فيها بتحدد نجاحي بالمادة

مغلق
بدأه سليم زعرب في 15 يناير 2008 · 8 رد · 1,013 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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

انا عندي مشروع علي اللينكد ليست

وانا تقريبا انجزت بعض المطلوب مني ولكن الوقت ادركني ومش قادر اكمل وعندي تسليم للمشروع الايام الجاية واريد المساعدة باقصي سرعة ارجو من كل فريق البرمجة بالمنتدي مساعدتي

انا سوف اقدم لكم متطلبات المشروع

هوا مشروع باستخدام الينكد ليست يمثل برنامج قبول وتسجيل صغيريتكون من قائمة رئيسية

1- الطلاب ويتفرع منها قائمة اخري وهي 1 اضافة طالب2-حذف طالب 3-البحث عن طالب4- تعديل بيانات الطالب 5- المواد المطروحة لهذا الفصل6-عرض البيانات الموجودة7- الرجوع للقائمة الرئيسية

2- في القائمة الاولي -اضافة مواد

3- برضو بالقائمة الاولي-تقريري عن الهيئة التدريسية (وهي عبارة عن معلومات تخزن بملف ويتم استدعائه

4-تقرير بعرض طلاب مساق معين

5-خروج

بعرف انو الموضوع مبين كبير بس انا عامل كل شي فيه ومصمم الواجهات وهرفق الكو البرنامج وهوا يعمل ولكن غير كامل اريد منكم ملاحظتك وتعديلاتكم

وهتفهمو المطلوب من خلال تشغيل البرنامج

هادا هوا الكود

#include <iostream>

#include <fstream>

#include<windows.h>

#include<stdlib.h>

#include<conio.h>

using namespace std;

struct node

{ char name[20]; // Name of up to 20 letters

char idnumber[10];

char Specialization[40];

node *next;// Pointer to next node

};

node *start_ptr = NULL;

node *head; // Used to move along the list

/*****************************************************/

struct subject

{ char sname[20]; // Name of up to 20 letters

char snumber[10];

char teachername[30];

subject *next1;// Pointer to next node

};

subject *start_ptr1 = NULL;

subject *head1; // Used to move along the list

/*****************************************************/

void add_student()

{ node *temp, *temp2; // Temporary pointers

ofstream outf("stu.txt",ios::app);

// Reserve space for new node and fill it with data

temp = new node;

cout << "Please enter the name of the student: ";

cin >> temp->name;

cout << "Please enter the id numberof the student : ";

cin >> temp->idnumber;

cout << "Please enter the Specialization of the student : ";

cin >> temp->Specialization;

temp->next = NULL;

outf<<temp->name<<temp->idnumber<<temp->Specialization;;//ادخال البيانات من الزاكرة للملف

outf.close();//اغلاق الملف

// Set up link to this node

if (start_ptr == NULL)

{ start_ptr = temp;

head = start_ptr;

}

else

{ temp2 = start_ptr;

// We know this is not NULL - list not empty!

while (temp2->next != NULL)

{ temp2 = temp2->next;

// Move to next link in chain

}

temp2->next = temp;

}

}

/*****************************************************/

void display_list()

{ node *temp11;

temp11 = start_ptr;

cout << endl;

if (temp11 == NULL)

cout << "The list is empty!" << endl;

else

{ while (temp11 != NULL)

{ // Display details for what temp points to

cout << "Name : " << temp11->name << "\n ";

cout << "idnumber : " << temp11->idnumber << " \n";

cout << "Specialization : " << temp11->Specialization;

if (temp11 == head)

cout << " <-- head node";

cout << endl;

temp11 = temp11->next;

}

cout << "End of list!" << endl;

}

}

/*****************************************************/

void deleteNode()

{

char num;

node *nodePtr, *previousNode;

cout<<"\tinter student id you want to delet"<<endl;

cin>>num;

// If the list is empty, do nothing.

if (!head)

cout<<"the list is empty\n"<<endl;

// Determine if the first node is the one.

else if (head->idnumber[10] = num)

{

nodePtr = head->next;

delete head;

head = nodePtr;

}

else

{

// Initialize nodePtr to head of list

nodePtr = head;

// Skip all nodes whose value member is

// not equal to num.

while (nodePtr != NULL && nodePtr->idnumber[10] != num)

{

previousNode = nodePtr;

nodePtr = nodePtr->next;

}

// Link the previous node to the node after

// nodePtr, then delete nodePtr.

previousNode->next = nodePtr->next;

delete nodePtr;

}

}

/*****************************************************/

// searching private function

void search()

{

char id;

node *nodePt ;

cout<<"\tinter student id you want to search"<<endl;

cin>>id;

// If the list is empty, do nothing.

if (!head)

cout<<"the list is empty\n"<<endl;

else

{

// Initialize nodePtr to head of list

nodePt = head;

// Skip all nodes whose value member is

// not equal to id.

while (nodePt != NULL && nodePt->idnumber[10] != id)

{

nodePt= nodePt->next;

}

cout << "Name : " << nodePt->name << " \n";

cout << "idnumber : " << nodePt->idnumber << "\n ";

cout << "Specialization : " << nodePt->Specialization<<endl;

}

}

/*****************************************************/

void update()

{

char idnum;

node *nodeP;

cout<<"\tinter student id num you want to update"<<endl;

cin>>idnum;

// If the list is empty, do nothing.

if (!head)

cout<<"the list is empty\n"<<endl;

else

{

// Initialize nodeP to head of list

nodeP = head;

// Skip all nodes whose value member is

// not equal to idnum.

while (nodeP != NULL && nodeP->idnumber[10] != idnum)

{

nodeP= nodeP->next;

}

cout << "Please enter new information of the student: \n";

cout << "Please enter the name of the student: ";

cin >> nodeP->name;

cout << "Please enter the id numberof the student : ";

cin >> nodeP->idnumber;

cout << "Please enter the Specialization of the student : ";

cin >> nodeP->Specialization;

}

}

/*****************************************************/

void addsubject()

{ subject *tempp, *tempp2; // Temporary pointers

// Reserve space for new node and fill it with data

tempp = new subject;

cout << "Please enter the name of the subject: ";

cin >> tempp->sname;

cout << "Please enter the id numberof the subject : ";

cin >> tempp->snumber;

cout << "Please enter the techer name of subject : ";

cin >> tempp->teachername;

tempp->next1 = NULL;

// Set up link to this node

if (start_ptr1 == NULL)

{ start_ptr1 = tempp;

head1 = start_ptr1;

}

else

{ tempp2 = start_ptr1;

// We know this is not NULL - list not empty!

while (tempp2->next1 != NULL)

{ tempp2 = tempp2->next1;

// Move to next link in chain

}

tempp2->next1 = tempp;

}

cout<<"THE SUBJECT ADDING COMPLEAT"<<endl;

cout<<" press any key to return to main menu"<<endl;

}

/*****************************************************/

//void write_data()

//{

//fstream file("student.txt",ios::out/ios::binary);

//{

/// if(student.idnumber!=0)

// file.write((char*)&student,sizeof(student));

//}

//}

/*****************************************************/

//void read_data()

//{

//ofstream outf("stu.txt",ios::app);

/*****************************************************/

void main()

{

start_ptr = NULL;

char mn1,mn2;

node student;

subject subj;

do

{

//main secreen

system("cls");

cout<<endl<<endl;

cout<<"\n\t\t\t\t *>MAIN MENU<*\n"<<endl;

cout<<"\t\t\t* * * * ***************** * * * *\n";

cout << "\t\t\t*\t1- STUDENTS\t\t*\n\t" << endl;

cout << "\t\t\t*\t2- EDIT SUBJECTS \t*\n\t" << endl;

cout << "\t\t\t*\t3- REPORT ON FACULTY\t* \n\t" << endl;

cout << "\t\t\t*\t4- VIEW STUDENTS IN * \n\t\t\t\t CERTAIN COURSE\t \n\t" << endl;

cout << "\t\t\t*\t5- Exit \t\t*\n\t" << endl;

cout<<"\t\t\t* * * * ***************** * * * *\n";

cout <<"Pleas choose what Do you want to Do"<<endl;

cin>>mn1;

cout<<endl;

{

switch(mn1)

{

case '1':

// ofstream outf("stu.txt",ios::app);

do

{

system("cls");

cout<<"\t==================================================\n"<<endl;

cout << "\t\t1. Add new student" << endl;

cout << "\t\t2. remove student." << endl;

cout << "\t\t3. search student." << endl;

cout << "\t\t4. update student information." << endl;

cout << "\t\t5. display student list." << endl;

cout << "\t\t6. subjects put up for the current term." << endl;

cout << "\t\t7. Return to Main menu." << endl<<endl;

cout<<"\t==================================================\n"<<endl;

cout<<"Pleas choose operation:"<<endl;

cin >> mn2;

switch (mn2)

{

case '1':

add_student();

break;

case '2' :

deleteNode();

cout<<"deleting done sucssesful!"<<endl;

getch();

break;

case '3' :

search() ;

getch();

break;

case '4' :

update();

cout<<"updating done sucssesful!"<<endl;

getch();

break;

case '5' :

display_list() ;

getch();

break;

case '6' :

cout<<"UNDER construction"<<endl;

cout<<"press any key to continue..."<<endl;

getch();

break;;

case '7' :

break;

default:

cout<<"Invalid Entry.......Try again."<<endl;

cout<<"press any key to continue..."<<endl;

getch();

break;

}

}

while (mn2 != '7');break;

/*****************************************************/

case '2':

system("cls");

addsubject();

getch();

break;

/*****************************************************/

case '3':

cout<<"UNDER construction"<<endl;

cout<<"press any key to continue..."<<endl;

getch();

break;

/*****************************************************/

case '4':

cout<<"UNDER construction"<<endl;

cout<<"press any key to continue..."<<endl;

getch();

break;

/*****************************************************/

case '5':

break;

default:

cout<<"Invalid Entry.......Try again."<<endl;

cout<<"press any key to continue..."<<endl;

getch();

break;

}

}

}while (mn1 != '5');

cout<<"BYE BYE\n TO EXIT"<<endl;

exit(0);

//خاص سليم زعرب

}

241210559.jpg
#2

السلام عليكم

كنت اتوقع ايضا ان ادخل اليوم الي المنتدي لاجد اجابة او مساعدة من اخواني بالمنتدي

اين المشرف اين مبرمجينا!!!!!!! ساعدوني؟؟؟؟؟؟؟؟

مساعدة عاجلة لو تكرمتم

اعطوني من وقتكم نص ساعة واعطوني اجابة ولو مساعدة؟؟؟؟

241210559.jpg
#3

ناقص إيه بالظبط؟ قول المشكلة بالتحديد ﻷن أنا عن نفسى مش حعرف أنفذه علشان أنا مش على ويندوز!

#4

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

يا أخ سليم, ضع الجزئية التي تريد الكلام عنها, و ضع حلك لتلك الجزئية, و ما هو المفروض من تلك الجزئية أن تفعل, و ماذا يفعل ذلك الكود بدلاً من ذلك, و بعدها ستأتيك المناقشة من كل مكان و سنضع كل قدرتنا في مساعدتك,

أما أن تقول الرجاء إكمال البرنامج فلا يوجد أحد سينظر إلى موضوعك, حتى لو أعطيته المال مقابل ذلك!!

#5

شكرا لكم علي اعادة توجيهي لطرح الموضوع

انا لااريد اكمال الموضوع بدلا عني فانا قد قطعت شوطا كبيرا في كتابة هذا الكود ولكنني وضعت الكود كاملا ليكون سهل عليكم تنفيذه وملاحظة ما يطلبه هذا البرنامج

سوف اطرح عليكم الجزيئات التي اواجه بها ومشكلة مثلا عند ادخال بيانات طالب ومن ثم ادخال بيانات طالب اخر

ثم اختيار مثلا بحث عن طالب بواسطة الرقم الجامعي له يعطيني خطأ ويخرج من البرنامج فاريد منكم مساعدتي علي اكتشاف الخطأ

لذلك وضعن الكود كاملا لانه لايمكن ملاحظة الخطأ بدالة واحدة ومع ذللك سوف اضع الدوال التي اشك في الخطأ بها مع مراعاة الرجوع للبرنامج كاملا الذي بالاعلي للتفهم اكثر مثال هذه الدالة


// searching private function
void search()
{
char id;
node *nodePt;
cout<<"\tinter student id you want to search"<<endl;
cin>>id;
// If the list is empty, do nothing.

if (!head)

cout<<"the list is empty\n"<<endl;



else
{
// Initialize nodePtr to head of list
nodePt = head;

// Skip all nodes whose value member is
// not equal to id.
while (nodePt != NULL && nodePt->idnumber[10] != id)
{

nodePt= nodePt->next;
}

cout << "Name : " << nodePt->name << " \n";
cout << "idnumber : " << nodePt->idnumber << "\n ";
cout << "Specialization : " << nodePt->Specialization<<endl;
}
}


وايضا هذه الدالة

void update()

{

char idnum;

node *nodeP;

cout<<"\tinter student id num you want to update"<<endl;

cin>>idnum;

// If the list is empty, do nothing.

if (!head)

cout<<"the list is empty\n"<<endl;

else

{

// Initialize nodeP to head of list

nodeP = head;

// Skip all nodes whose value member is

// not equal to idnum.

while (nodeP != NULL && nodeP->idnumber[10] != idnum)

{

nodeP= nodeP->next;

}

cout << "Please enter new information of the student: \n";

cout << "Please enter the name of the student: ";

cin >> nodeP->name;

cout << "Please enter the id numberof the student : ";

cin >> nodeP->idnumber;

cout << "Please enter the Specialization of the student : ";

cin >> nodeP->Specialization;

}

}

وهذه الدالة

/*****************************************************/

void deleteNode()

{

char num;

node *nodePtr, *previousNode;

cout<<"\tinter student id you want to delet"<<endl;

cin>>num;

// If the list is empty, do nothing.

if (!head)

cout<<"the list is empty\n"<<endl;

// Determine if the first node is the one.

else if (head->idnumber[10] = num)

{

nodePtr = head->next;

delete head;

head = nodePtr;

}

else

{

// Initialize nodePtr to head of list

nodePtr = head;

// Skip all nodes whose value member is

// not equal to num.

while (nodePtr != NULL && nodePtr->idnumber[10] != num)

{

previousNode = nodePtr;

nodePtr = nodePtr->next;

}

// Link the previous node to the node after

// nodePtr, then delete nodePtr.

previousNode->next = nodePtr->next;

delete nodePtr;

}

}

هذه جزء من المشكلة الرجاء مساعدتي اخي خالدواخيblueteeth و لا تبخل علي بعلمك واتمني ان اكون قد اوصلت الفكرة

واتمني التعليق باقرب وقت ممكن

تنويه انصح بتشغيل الكود كاملا الموجود باول مشاركة لملاحظة المشكلة

تحياتي للجميع

241210559.jpg
#6
/*****************************************************/
// searching private function
void search()
{
char id[10];	// id should be the same size as idnumber in student struct
node *nodePt;
cout<<"\tinter student id you want to search"<<endl;
cin>>id;
// If the list is empty, do nothing.

if (!head)

cout<<"the list is empty\n"<<endl;



else
{
// Initialize nodePtr to head of list
nodePt = head;

// Skip all nodes whose value member is
// not equal to id.
while (nodePt != NULL && strcmp(nodePt->idnumber/*[10]*/,id)) //use strcmp to compare between two c-strings
{

nodePt= nodePt->next;
}

////////////////////////////////////////////////////////
// YOU MUST CHECK FIRST IF IT'S FOUND OR NOT ///////////
////////////////////////////////////////////////////////
cout << "Name : " << nodePt->name << " \n";
cout << "idnumber : " << nodePt->idnumber << "\n ";
cout << "Specialization : " << nodePt->Specialization<<endl;
}
}
/*****************************************************/

عندى بس ملاحظة, لما تيجى تستخدم array متكتبش ال size بتاعها, إنت بتكتبه بس فى تعريفها.

#7

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

اقتباس
// YOU MUST CHECK FIRST IF IT'S FOUND OR NOT ///////////

////////////////////////////////////////////////////////

cout << "Name : " << nodePt->name << " \n";

cout << "idnumber : " << nodePt->idnumber << "\n ";

cout << "Specialization : " << nodePt->Specialization<<endl;

}

}

ولكن هنا حاولت ان اعمل شرط وهوا ان وجد الid االصحيح يعمل بحث مثل

if(nodpt->idnumber==id)

او مقارنة ولم انجح انني مبتدأ بالبرمجة ولكني اريد ان استفيد

فكيف افعل بحث

2- اذا لاحظ بالكود يوجد بعض دوال للفايل ولكنها غير مفعلة لانني ايضا لم استطع وضع دوالread_data(),writ_data()

هل يمكن مساعدتي لوضع معلومات داخل فايل ومن ثم استرجاعها للتعديل عليها في اي وقت لاحق بعد ايقاف البرنامج ؟؟؟

وشكرا كثيرا اخيblueteeth

241210559.jpg
#8

ممكن تعمل ال check دا عن طريق التأكد من أن ال nodeptr ليس ب NULL, فإذا كان NULL إذا فالطالب غير موجود

if (nodePt == NULL)  cout << "Not found!";
else
{
// the rest of your code
}

أما عن الفايلز, فأنصحك تقرأ فى كتاب أحسن عن التعامل مع الفايلز.

دى صفحة كويسة> http://www.daniweb.com/forums/post31214.html

#9

شكرا للك كتير اخي بلوتيث بس انا ممكن اكون النود موجود به بيانات ولكن ليس بنفس الرقم

يعني انا ادخللت عدة طلاب ومن ثم ادخللت رقم غير موجود للطالب

فهنا سوف يعطيني انو موجود وهيك بيكون خلل

بالنسبة للفايل سوف ادخل علي الصفحة التي قدمتها لي

ولكن ارجو منك التفكير معي بطريقة الفحص هل الرقم للطالب موجود ام لا

241210559.jpg

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

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

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

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

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

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