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

احتاج برنامج بلغة سي ++ او جافا

مغلق
بدأه طارق عبيد في 11 يناير 2007 · 3 رد · 587 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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

تحية طيبة وبعد ،،

ما احتاجه هو برنامج على لغة سي ++ يستخدم الكائنات (Object) مهما كان طبيعة البرنامج، او على لغة Java.

ارجو توضيح البرنامج حتى اتمكن من شرحه امام المحاضر.

مع الشكر لكم

#2

ابحث حتلاقي كنيييييييير

ENG. IMAD, Programing is a way of life, It's in the air, we breath It's pumps through our veines, Without it, we soon crumble to dust

#3
//Note: I wrote this program & I didn't compile it 
//Cuz i'm not at home right now 

#include <iostream>

using namespace std;

//Class definition
Class John 
{
	public:
		//Methods 
		void Talk();
		void GetPower(int power);

	private:
		//Data 
		int m_Power();
};

//Class implementation
void John::Talk()
{
	cout << "Hi, i'm John, and I'm C++ object!" << endl;
}

void John::GetPower(int power)
{
	m_Power = power;
	if (power <= 0)
		power = 0;
	cout << "My power is: " << m_Power << endl;	
}

int main()
{
	cout << "Creating object..." << endl;
	John myJohn; //Creating johny object derived from John class

	myJohn.Talk(); //Calling Talk(); function 
	myJohn.GetPower(); //Calling GetPower(); function


	return 0;
}
:::كوت بو 6:::

IDE : Microsoft Visual Studio 2005 Pro

#4

الكود الاول فيه جم خطأ :D

هذا مافيه خطا بعد ما رديت البيت :) :

#include <iostream>
#include <conio.h>

using namespace std;

//Class definition
class John 
{
	public:
		//Methods 
		void Talk();
		void GetPower(int power);

	private:
		//Data 
		int m_Power();
};

//Class implementation
void John::Talk()
{
	cout << "Hi, i'm John, and I'm C++ object!" << endl;
}

void John::GetPower(int power)
{
	int m_Power = power;
	if (power <= 0)
		power = 0;
	cout << "My power is: " << m_Power << endl;	
}

int main()
{
	cout << "Creating object..." << endl;
	John myJohn; //Creating johny object derived from John class

	myJohn.Talk(); //Calling Talk(); function 
	myJohn.GetPower(5); //Calling GetPower(); function

	getch();
	return 0;
}
:::كوت بو 6:::

IDE : Microsoft Visual Studio 2005 Pro

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

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