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

مساعدة لو سمحتم

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

السلام عليكم والرحمة

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

وهذا السؤال

(Structures & Enumeration)

Programming Book Store needs to store and manipulate information about each book in the store. Each book has a title, author, ISBN number, publisher, month of the book first sold, price, and quantity. You may assume that there are no more than 100 books in store. Write a program to store the book info into an array of user define structure of type Book and perform the following analysis:

• Write a function add-New-Book which asks the user to enter the information of a new book and add the book to the end of the array.

• Write a function displayTable which prints a Seven-column table displaying the data in the array about the books.

• Write a function Search that search for a book according to its ISBN number and returns the position (subscript) of the book with that name.

• Write a function changePrice that accepts an ISBN number and new price for the book. The function should call the above function to search for that record and then change the price of the book to the new one.

• Write a function find_Total_New-Books which calculates the total number of the store. The function should return an array which contains all the totals. Use enumeration to represent each month.

• Write a menu-driven program to call the above functions with appropriate data according to the user choice.

#2

مرحباً فيك عضو (ة) جديد(ة) في المنتدى

انا اشتغلت عليه شوي بس ما كملته ويمكن فيه اغلاط

ممكن تحطي الكود اللي وصلتيلو و احنا حاضرين نساعدك ونعله لو لزم الأمر.

#3

# include<stdio.h>

struct book

{

char titel[30];

char auther[50];

long int isbn;

char puplisher [50];

float price;

int quantity;

};

void AddNewBook(struct);

void DisplayTable(struct);

int search(struct);

void changeprice(struct);

void main()

{

struct book books[100]={{"programming","detile",123456,prentice hall,15.500,3},{"itcs"

,"ditel",1111111,"uob",10.500,4}};

puts("TO START THE PROGRAM, ENTER A CHOISE:\n1\tadd new book\n2\tdisplay table of the book\n3\t search for a book according to its ISBN number\n4\tchange the price\n5\tfind total new book\n6\t Exit");

puts("enter your choise:");

scanf("%d",&x);

while (n!=6)

{

puts("enter your choise:");

scanf("%d",&x);

if (x==1)

AddNewBook(struct book books);

else

if (x==2)

DisplayTable(struct book books);

else

if (x==3)

{

int e=search(struct book books);

if (e==100)

printf(the book not found");

else

if(e!=100)

printf("the subscribt of the book is %d",e);

}

if (x==4)

changeprice(struct book books);

}

}

void AddNewBook(struct book books)

{

printf("enter the title of the new book");

gets(books[100].title);

printf("enter the auther of the book");

gets(books[100].auther);

printf("enter the ISBN of the book");

scanf("%ld",&books[100].isbn);

printf("enter the puplisher of the book");

gets(books[100].puplisher);

printf("enter the price of the book");

scanf("%f",&books[100].price);

printf("enter the nomber of quantity of the book");

scanf("%d",&books[100].quantity);

}

void DisplayTable(struct book books)

{

printf("1)title\t\t2)auther\t\t3)isbn\t\t4)puplisher\t\t5)price\t\t6)quantity");

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

{

printf("%s\t\t%s\t\t%ld\t\t%s\t\t%s\t\t%f\t\t%d",books.title,books.auther,books.isbn,books.puplisher,books.price,books.quantity);

}

int search(struct book books)

{

int x, search=100;

printf("\n enter the ISBN\n")

scanf("%d",&x);

for (int y=0; y<100; y++)

if (books[y].isbn==x)

search=x;

return search;

}

void changprice(struct book books)

{

printf("enter the isbn of the book u want to change its price\n");

int f;

scanf("%d",&f);

________________________________________________

وقفت لحد هنا وشيرت بليز ساعدوني مخي وقف عن التفكير :(

#4

انا قريت السؤال والبرنامج فكرته راح تسهل لو استخدمتي Link List

لأن عمليه اضافه معلومات كتاب جديد صعبه باستخدام المصفوفات لانها محدده الحجم مسبقا

لكن link list تستطيعين اضافه كتاب جديد عن طريق mallok(node) ok

وlink list تساعدك بالاضافه من الاخير بسهوله عن طريق التحكم البسيط بالمؤشر

Next و Current

غيري ال Structure حق برنامجك

برنامجك يستخدم Array of strcture

خلي برنامجك LinkedList of structure وراح تشوفين كيف راح تسهل عليك لعمليه

انا ودي اساعدك بكتابه الكود بصراحه لكن انا لست متفرغا للغه سي لاني

اعطيت ج تفكيري واهتمامي للغه الجافا الممتعه:)

مو مثل السي لغه شوي عقيمه :)

#5

هذا هو البرنامج واناشاء الله يكون مفهوم

story.cpp

#6

السلام عليكم

حبيت اشكر كل من رد على موضوعي وساعدني في وضع البرنامج وشكرا لك يا اخ عبدالله وان شاء الله راح اشوف الملف اللي وضعته واذا في اي سؤال راح اسال وان شاء الله اشوف الجواب

اما الاخ red eyes ما فهمت علىالطريقة اللي تكلمت عنها اذا ممكن توضحها اكثر هذا البرنامج هو تطبيق على الموضوع اللي درسته

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

123.cpp

تم تعديل هذه المشاركة بواسطة bent84 في 18 ديسمبر 2003 في 15:02

#7

السلام عليكم

الاخ عبدالله انا شفت البرنامج بس في function مطلوبة وهي مذكورة Write a function find_Total_New-Books which calculates the total number of the store. The function should return an array which contains all the totals. Use enumeration to represent each month.

لكن لم اجدها في البرنامج اللي وضعته .. اشكرك مرة ثانية للرد

#8

بالسبه لكلام اخوي red_eyes

فهو يقصد اننا نهلك الذاكره اذا حجزنا مئه خانه واننا مالنا حاجه الا في 5 خنانات مثلا

لذالك نستخدم structre معين اسمه link list

وهذي الsrtuct تساعدنا في حفض الذاكره يعني كل ما اردنا اضافه كتاب فأننا نحجز في الذاكره مكان معين لكتاب واحد

وبكذا حفضنا الذاكره

وللشي هذا نستخدم كل مره في الحجز امر malloc في السي

و new في السي بلس بلس

اما بالنيبه للداله

انا ما فهمت وشو المطلوب من ال function هذي

وضحي لي وشو المطلوب وإن شاء الله اساعدك

وصل الله وبارك

تم تعديل هذه المشاركة بواسطة ABDULLAH1003 في 19 ديسمبر 2003 في 14:36

#9

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

وشكرا

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

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