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

وين الخلل في الكود

بدأه a7la khokha في 3 مايو 2009 · 10 رد · 1,749 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

عندي في التاسك بي مشكله عندي اخطاء

تاسك A كامل صحيح مع التيست بس مشكلتي ببي

وماني قادره ابدى بسي بدون ماتكون صح عندي

بليز ساعدوني قبل يوم الثلاثاء :cry:

عشان الحق اسوي c

Task A

Write a Passenger class which holds information about passenger including their name (string), passport number (string containing letters and numbers), and contact number (long). The class should contain both default and parameterized constructor, set/get methods for each attribute, and method to print the details of the Passenger.


Task B
Create a header file for the class student which contains the following header, then write its implementation file.				

#ifndef RESERVATION_H_
#define RESERVATION_H_

#include <iostream>
#include <string>
#include "Passenger.h"
using namespace std;


class Reservation{

private:
	static int sn;
	const string ID; //first two letters of passanger name plus sn
	bool smokerSeat;
	Passenger passenger;

public:

	//Constructor taking the parameters of Passenger
	Reservation(string psngrName, long psngrPhone, string psngrPassport, bool 	smoke);

	//Constructor taking a Passenger object
	Reservation(Passenger& psngr, bool smoke);

	Passenger getPassenger();		bool isSmoker();

	string getReservationNumber()		void printDetails();
};


#endif /*RESERVATION_H_*/

وهذا حلي بالمرفقات ومحدده المشاكل عندي ومظللتها

بليز لاتبخلو علي

والله يجزاكم الجنه مقدما

a_and_b.rar

#2

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

بعض الأخطاء البسيطه وتم معالجتها والحمد لله

فى المرفقات

p.rar

اللهم صل على سيدنا محمد وعلى آله وصحبه وسلم

#3

مشكور اخوي الله يجزاك خير

بس للحين :cry:

يطلع لي ايرور

وهذا هو المسج

1>------ Build started: Project: project a+b, Configuration: Debug Win32 ------
1>Compiling...
1>Reservation.cpp
1>c:\users\khowlah\desktop\project a+b - copy\passenger.h(7) : error C2011: 'passenger' : 'class' type redefinition
1>		c:\users\khowlah\desktop\project a+b - copy\passenger.h(7) : see declaration of 'passenger'
1>c:\users\khowlah\desktop\project a+b - copy\reservation.cpp(8) : error C2027: use of undefined type 'passenger'
1>		c:\users\khowlah\desktop\project a+b - copy\passenger.h(7) : see declaration of 'passenger'
1>c:\users\khowlah\desktop\project a+b - copy\reservation.cpp(8) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Build log was saved at "file://c:\Users\khowlah\Desktop\project a+b - Copy\Debug\BuildLog.htm"
1>project a+b - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#4

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

.h و .cpp

جربته والكلاسات كلها فى ملف cpp واحد

الآن بشوفه بعد التقسيم

اللهم صل على سيدنا محمد وعلى آله وصحبه وسلم

#5

المشكله كلها فى ملفات الهيدر

1 - ملف passenger .h

#include<iostream>
#include<string>
using namespace std;

2- ملف passenger.cpp

#include"passenger.h"

3- ملف reservation.h

#include"passenger.h"

4- ملف reservation.cpp

#include"reservation.h"

5- ملف main.cpp

#include "Reservation.h"

حاولى تضع ملفات الهيدر بدقه

سلام

اللهم صل على سيدنا محمد وعلى آله وصحبه وسلم

#6

مشكوووووووووووووووووووووووووووووور اخوي

وربي يجزاك الجنه

ويوفقك وين مارحت

ضبط معي وطلع لي الرن

كان باقي بس اخطاء بسيطه

بس كان عندي سؤال بسيط

اممم

هالستيتمنت وش تعني

int Reservation::sn=1234;

تم تعديل هذه المشاركة بواسطة a7la khokha في 3 مايو 2009 في 17:11

#7

العفو أختى فى الله

اسناد قيمه لمتغير ستاتك يجب ان تتم بهذا الشكل

خارج دالة البناء

فى أمان الله

اللهم صل على سيدنا محمد وعلى آله وصحبه وسلم

#8

مشكووووووووووووووور الله يجزاك الخير

#9

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

جميل جدا التعاون هذا

وانا استفدت مع تعاونكم ومعلوماتكم

لكم مني خالص التقدير

*********************

دروس الاكسس

قاعدة بيانات بالسي++

قاعدة بيانات اخرى بالسي++

الفريق العربي للبرمجه

*********************

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

#10

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

#11

بديت في التاسك الثالث لكن مافهمت الفقره الثانيه منه

Task C 
1. Write the OK Reservation class which is a derived class from Reservation. It should contain two attributes: reservation date and ticket bought, which is a Boolean, initially set to false. Don't forget the make the Reservation class an abstract class.


2. Write the Waiting Reservation class which is a derived class from Reservation. It should contain a single attribute: turn in list which specifies the order of the waiting reservations (i.e. is it the first reservation on the waiting list? The second? The third?... etc). It should also contain a method that moves reservation forward in list, which is used to move the waiting reservation higher in the waiting list, provided of course that it is not the first reservation.
هذا حلي

Ok_Reseveation.h
[CODE]include<iostream>
using namespace std;
#include<string>
using std::string;
using std::getline;
class Ok_Reseveation:public Reservation
{
	//data member{attrbutes}
	bool res_date,tecket_bought;

Ok_Reseveation();

};

Ok_Reseveation.cpp

include<iostream>
using namespace std;
#include<string>
using std::string;
using std::getline;
#include "Ok_Reseveation.h"
Ok_Reseveation::Ok_Reseveation()
{res_date = false; tecket_bought= false; }

wating_Reseveation.h

include<iostream>
using namespace std;
#include<string>
using std::string;
using std::getline;
class wating_Reseveation:public Reservation
{

};

wating_Reseveation.cpp

include<iostream>
using namespace std;
#include<string>
using std::string;
using std::getline;
#include "wating_Reseveation.h"

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