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

[مخالف]بداية...بارك الله بكم

مغلق
بدأه مصطفى 36a2 في 26 يناير 2012 · 8 رد · 595 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

بسم الله الرحمن الرحيم

السلام عليكم جميعاً إخوتي

بعد البداية الشاقة والحمد لله وصلت إلى نقطة الصفر .. وبعد أن بدأت بتطبيق ما قرأته عن الصفوف classes اكتشفت أنني أصبحت الآن ""مبتدئاّ"

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

بعد خمس ساعات من قراءة مواضيع في هذا القسم .. تأكدت أن google كان على حق عندما كانت النتيجة كما يلي :

an3m1.com_13275292681.png

بارك الله فيكم .. وأسأل الله أن أستفيد منكم ما شاء الله لي أن أستفيد ...

وحتى لا أكون سلبياً (متلقي فقط ) أرغب من بعد إذنكم في الاستفسار عن أمر مهم .. ((لمن بحث في مواضيع اللينكس يعرف أن السبب الرئيس في تطوير كل الأنظمة المفتوحة هو أن المصدر متوفر للجميع وكل واحد يدلي بدلوه , ولذلك حبّذا لو نبدأ في تطوير برنامج نضع فيه كل ما تعلمناه ))

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

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

إليكم البرنامج وبإذن الله يعجبكم و نتعاون فيه .. ... إليكم البرنامج ( جربوه .. ثم خرّبوه)

ملاحظة أخيرة :: انسخ البرنامج .. نفّذه ... عندما يبدأ العمل اضغط رقم صفر لتحصل على التعليمات كاملة ... الحقوق محفوظة لكم ..

/////////////////Drown VER 1.0\\\\\\\\\\Thank for God only\\\\\\\\*/
#include<iostream.h>
#include<windows.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
#define Y 56
#define X 80
/////////////////////////////
class M{public:M();
inline void S_O();//Screen Out
inline void S_fO();//screen file Out
inline void S_S();//Screen Set
inline void Sq();//Square
inline void EC();//enter coordinates
inline void N();//N:allocate the move side
inline void a_();//allocate the button pressed
inline void sqsomain();//Ec Sq S_O main_;
inline void main_();//main;
inline void line_();
inline void circle_();
inline void rectangle_();
inline void line(double,double,double,double,int);
inline void circle(double,double,double,int);
inline void rectangle(int,int,int,int);
private:
char screen[Y][X],c,c2;int x,y,L,step,b,a;};
/////some time /////cleer screen /////pause////////////////
void st(double i=1){for(int j=0;j<1250*i;j++)cout<<1<<"\r";}
void cls(){system("cls");st();}
void paus(){system("pause");}
//////////////////
void M::rectangle_(){int x1,y1,x2,y2;
	cout<<"Drawing a rectangle \ntow point P1,P2 for the corners\nx1=";cin>>x1;x1+=2;cout<<"y1=";cin>>y1;
	cout<<"x2=";cin>>x2;x2+=2;cout<<"y2=";cin>>y2;rectangle(x1,y1,x2,y2);}
//////////////////
double linefx(double m_,double x,double x1,double y1){double y=(m_*x)-(m_*x1)+y1;return y;}
double linef_y(double m_,double y,double x1,double y1){double x=((y-y1)/m_)+x1;return x;}
////////////////*//////////////////
void M::circle_(){
	double x0,y0,r;int e0=3;
	cout<<"enter the center coordinates: x0=";cin>>x0;x0+=2;
	cout<<"y0=";cin>>y0;cout<<"r=";cin>>r;if(r>9)e0=7;if(r>19)e0=10;if(r>29)e0=15;
circle(x0,y0,r,e0);}
///////////////circle////////////////////
void M::circle(double x0,double y0,double r,int e0){
	for(double j=y0-r;j<=y0+r;j++)
		for(double i=x0-r;i<=x0+r;i++)
			for(int e=-1*e0;e<=e0;e++){
			if(int((j-y0)*(j-y0)+(i-x0)*(i-x0))==int(r*r)+e)screen[int(j)][int(i)]=c;
			//if(int((j-y0)*(j-y0)+(i-x0)*(i-x0))>int(r*r)+e) screen[int(j)][int(i)]='o';
			//if(int((j-y0)*(j-y0)+(i-x0)*(i-x0))<int(r*r)+e)screen[int(j)][int(i)]='M';
			//if(int((j-y0+(r/4))*(j-y0+(r/4))/36+(i-x0-(r/2))*(i-x0-(r/2))/16)<1) screen[int(j)][int(i)]=1;
			//if(int((j-y0+(r/4))*(j-y0+(r/4))/36+(i-x0+(r/2))*(i-x0+(r/2))/16)<1) screen[int(j)][int(i)]=2;
			//if(int(-(i-x0)*(i-x0)/(r/4))+(j-y0)*(j-y0)/(r/5)==1) screen[int(j)][int(i)]=3;
			/*if(int((j-y0-r)+(i-x0)*(i-x0)/16)==-1) screen[int(j)][int(i)]=3;*/}}
////////////////////rectangle////////////////////////////
void M::rectangle(int x1,int y1,int x2,int y2)
{int minx=x1,miny=y1,maxx=x2,maxy=y2;if(x2<x1){maxx=x1;minx=x2;}if(y2<y1){maxy=y1;miny=y2;}
for(int i=minx;i<=maxx;i++)for(int j=miny;j<=maxy;j++){
	if(i==x1||i==x2||j==y1||j==y2){screen[j]=c;}
}}
////////////////////////////////////////////////
void M::line(double x1,double y1,double x2,double y2,int pp=1)
{	double minx=x1,maxx=x2,miny=y1,maxy=y2;
	if(y1>y2){maxy=y1;miny=y2;}
	if(x1>x2){maxx=x1;minx=x2;}
	if(x2!=x1)	{
	double m_=(y2-y1)/(x2-x1);
	for(double i=minx+2;i<=maxx+2;i++)screen[int(linefx(m_,i-2,x1,y1))][int(i)]=c;
	if(pp=='2')for(double j=miny;j<=maxy;j++)screen[int(j)][int(linef_y(m_,j,x1,y1))+2]=c;}
	else for(double j=miny;j<=maxy;j++)screen[int(j)][int(x1)]=c;
}
//////////////////////////
void M::line_()
{double x1,x2,y1,y2;char a[3];
	cout<<"To draw a line we want tow points P1(x1,y1),P2(x2,y2)\n";
	cout<<"So For P1(x1,y1) :: \nx1= ";cin>>x1;
	cout<<" y1= ";cin>>y1;
	cout<<"and For P2(x2,y2) :: \nx2= ";cin>>x2;
	cout<<" y2= ";cin>>y2;
	cout<<"Wich mode:1 or 2 ?";
	cin>>a;
	line(x1,y1,x2,y2,a[0]);}
//////////////////////yes//////////////////////////////
int yes(){return((getche()=='y'&&getche()=='e'&&getche()=='s')?1:0);}
//////////////////showxy///////
void showxy(int x,int y){char msg[11]={"x=  ,y=  ."};
msg[3]=char(x%10+48);
msg[2]=char((x-x%10)/10+48);
msg[8]=char(y%10+48);msg[7]=char((y-y%10)/10+48);
MessageBox(NULL,msg,"Coordinates",64);}
//////////////////////////////////////////
void pause(){system("pause");}
////////////////////////////////Help//////////////
void help()
{
	cls();
	cout<<"Welcome \noptions available here are :\n1- Space to change x,y"
		<<"\n2- Enter to change x,y,your square side length(L/2),the drawing\ncharachter and step "
		<<"\n3- Tab to change the drawing charachter"
		<<"\n4- Back space to use the eraser , then press tab to return\nto the bruch tool"
		<<"\n5- X to show x and y"
		<<"\n6- Escape  to save your picture"
		<<"\n7-numbers:\n\t 1:to change bruch mode \n\t 2:to reset,then just type yes \n\t 3:to change step\n\t 4: to change (L/2)"
		<<"\n\t 7: Drow a rectangle any where\n\t 8:Drow a circle any where \n\t 9: Drow a line any where"
		<<"\n\t\t 0:for help"
		<<"\nEnjoy\n";st(10);paus();cls();
}
//////////////////////a_////////////////////
void M::a_()
{	a=getch();
	 if(a==224){a=getch();N();}
else if(a==8)c=c2;
else if(a==9){cout<<"enter the charachter";cout.flush();a=getch();if(a=='2')c=char(219);else c=a;}
else if(a==13){EC();sqsomain();}
else if(a==27)S_fO();
else if(a==32){cout<<"Enter new x,y\nx=";cin>>x;x+=2;if(x<2)x=40;cout<<"y=";cin>>y;if(y<0)y=27;}
else if(a==48){help();}
else if(a==49){cout<<"Welcome :what the mode you want sur?0,1,2,3,4\n";cin>>b;}
else if(a==50){cout<<"Restart?";cout.flush();if(yes()){cout<<"\nbackground charachter";cin>>c2;S_S();}}
else if(a==52){cout<<"new L:";cin>>L;}
else if(a==51){cout<<"enter the step";cin>>step;}
else if(a==57)line_();
else if(a==56)circle_();
else if(a==55)rectangle_();
else if(a==120){showxy(x,y);}
}
///////////////////////////Screen Out//////////////////
void M::S_O(){cls();for(int c0=0;c0<Y;c0++){for(int c1=0;c1<X;c1++){cout<<screen[c0][c1];}cout<<"\r";}st();}
///////////////////////////Screen fOut//////////////////
void M::S_fO(){
	MessageBox(NULL,"enter yor file name please ","Saving",1);
	char name[20];char txt[]={".txt"};
	cin>>name;
	strcat(name,txt);
	reinterpret_cast<const char*>(name);
	ofstream outfile(name,ios::out);
	outfile<<"#include<iostream.h>"<<endl<<"#include<windows.h>"<<endl<<"void main(){cout";
	for(int c0=0;c0<Y-2;c0++){outfile<<"<<\"";
		for(int c1=2;c1<X;c1++){
			outfile<<screen[c0][c1];}outfile<<"\\n\""<<endl;}
	outfile<<";system(\"pause\");}";outfile.close();system(name);}
////////////////////////////Screen Set///////////////////
void M::S_S(){
	for(int c0=0;c0<56;c0++){
		for(int c1=0;c1<X;c1++){
			if(c1==0&&c0<Y-2)screen[c0][c1]=(c0-c0%10)/10+48;
			else if(c1==1&&c0<Y-2)screen[c0][c1]=c0%10+48;
			else if(c0==Y-2&&c1>1)screen[c0][c1]=(c1-2)%10+48;
			else if(c0==Y-1&&c1>1)screen[c0][c1]=((c1-2)-(c1-2)%10)/10+48;
			else screen[c0][c1]=c2;}}}
/////////////////////////////////Main///////////////
void main(){M ohammad;ohammad.sqsomain();}
//////////////////////////////////M()///////////////
M::M(){system("color f0");c='0';x=39;y=27;L=0;step=1;b=1;a=0;c2='.';S_S();S_O();}
//////////////////////square....screen out.....main_/////////////
void M::sqsomain(){Sq();S_O();main_();}
/*main_:a_ to get ch and analyze it
*		square to draw square 
*		screen out 
*		main_ to repeat the operation
*/
void M::main_(){a_();Sq();S_O();main_();}
//////t/h/e////m/o/s/t///i/m/p/o/r/t/a/n/t////f/u/n/c/t/i/o/n////
//////////////////////////////Square/////////////////////////////////
void M::Sq()
{
		for(int c0=y-L;c0<=y+L;c0++){
		for(int c1=x-L;c1<=x+L;c1++){
			if(c0<0||c1<2)continue;
			if(c0>Y-3||c1>X-1)continue;if(b!=0&&b!=1&&b!=2&&b!=3&&b!=4)b=0;
/*All the surface screen*/				 if(b==0)screen[c0][c1]=c;
/*Only the perimeterif*/			else if(b==1&&(c0==y-L||c0==y+L||c1==x-L||c1==x+L))screen[c0][c1]=c;
/*the perimeter and X in the shape*/else if(b==2){if(c0==y-L||c0==y+L||c1==x-L||c1==x+L)screen[c0][c1]=c;
												else if(c1-c0==x-y||c1+c0==y+x)screen[c0][c1]=c;}
/*Xin the shape*/					else if(b==3){if(c1-c0==x-y||c1+c0==y+x)screen[c0][c1]=c;}	
/*the surface without the center*/  else if(b==4){if(c0!=y||c1!=x)screen[c0][c1]=c;else screen[c0][c1]=c2;}}}
}
/////////////////////N///////////EC//////////
void M::N(){if(a==77) x+=step;else if(a==80) y+=step;else if(a==72) y-=step;else if(a==75) x-=step;}
void M::EC(){	char yesorno[5];cout<<"Do you wonna enter the coordinates?";cin>>yesorno;
				if(yesorno[0]!='n'){cout<<"enter the coordinates of the center\n x=";cin>>x;x+=2;if(x<2)x=40;
				cout<<"y=";cin>>y;if(y<0)y=27;
				cout<<"enter the side length of the Sq:\n L=";cin>>L;if(L<0)L=0;
				cout<<"Enter the charachter you wonna drow by:";cin>>yesorno;c=yesorno[0];
				cout<<"Enter step\nstep=";cin>>step;cls();}else cls();}
/////////////////////////////////////////
/*
void choose
{int choose_=1;
cout<<"Choose the shape ypu wonna draw:\n1-LINE\n2-square\n3-rectangle\t";
cin>>choose_;
	 if(choose_==1)line_();
else if(choose_==2)square_();
else if(choose_==3)rectangle_();
else if(choose_==4)circle_();
else line_();
}
*/

لا إله إلا الله وحده لا شريك له له الملك وله الحمد وهو على كل شيء قدير ...

بارك الله فيكم والسلام عليكم ...

تم تعديل هذه المشاركة بواسطة مصطفى 36a2 في 26 يناير 2012 في 01:08

#2

التنظيم أفضل وأظن ان هكذا افضل

/////////////////Drown VER 1.0\\\\\\\\\\Thank for God only\\\\\\\\*/
#include<iostream.h>
#include<windows.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
#define Y 56
#define X 80
/////////////////////////////
class M{public:M();
inline void S_O();//Screen Out
inline void S_fO();//screen file Out
inline void S_S();//Screen Set
inline void Sq();//Square
inline void EC();//enter coordinates
inline void N();//N:allocate the move side
inline void a_();//allocate the button pressed
inline void sqsomain();//Ec Sq S_O main_;
inline void main_();//main;
inline void line_();
inline void circle_();
inline void rectangle_();
inline void line(double,double,double,double,int);
inline void circle(double,double,double,int);
inline void rectangle(int,int,int,int);
private:
char screen[Y][X],c,c2;int x,y,L,step,b,a;};
/////some time /////cleer screen /////pause////////////////
void st(double i=1){for(int j=0;j<1250*i;j++)cout<<1<<"\r";}
void cls(){system("cls");st();}
void paus(){system("pause");}
//////////////////
void M::rectangle_(){int x1,y1,x2,y2;
cout<<"Drawing a rectangle \ntow point P1,P2 for the corners\nx1=";cin>>x1;x1+=2;cout<<"y1=";cin>>y1;
cout<<"x2=";cin>>x2;x2+=2;cout<<"y2=";cin>>y2;rectangle(x1,y1,x2,y2);}
//////////////////
double linefx(double m_,double x,double x1,double y1){double y=(m_*x)-(m_*x1)+y1;return y;}
double linef_y(double m_,double y,double x1,double y1){double x=((y-y1)/m_)+x1;return x;}
////////////////*//////////////////
void M::circle_(){
double x0,y0,r;int e0=3;
cout<<"enter the center coordinates: x0=";cin>>x0;x0+=2;
cout<<"y0=";cin>>y0;cout<<"r=";cin>>r;if(r>9)e0=7;if(r>19)e0=10;if(r>29)e0=15;
circle(x0,y0,r,e0);}
///////////////circle////////////////////
void M::circle(double x0,double y0,double r,int e0){
for(double j=y0-r;j<=y0+r;j++)
for(double i=x0-r;i<=x0+r;i++)
for(int e=-1*e0;e<=e0;e++){
if(int((j-y0)*(j-y0)+(i-x0)*(i-x0))==int(r*r)+e)screen[int(j)][int(i)]=c;
//if(int((j-y0)*(j-y0)+(i-x0)*(i-x0))>int(r*r)+e) screen[int(j)][int(i)]='o';
//if(int((j-y0)*(j-y0)+(i-x0)*(i-x0))<int(r*r)+e)screen[int(j)][int(i)]='M';
//if(int((j-y0+(r/4))*(j-y0+(r/4))/36+(i-x0-(r/2))*(i-x0-(r/2))/16)<1) screen[int(j)][int(i)]=1;
//if(int((j-y0+(r/4))*(j-y0+(r/4))/36+(i-x0+(r/2))*(i-x0+(r/2))/16)<1) screen[int(j)][int(i)]=2;
//if(int(-(i-x0)*(i-x0)/(r/4))+(j-y0)*(j-y0)/(r/5)==1) screen[int(j)][int(i)]=3;
/*if(int((j-y0-r)+(i-x0)*(i-x0)/16)==-1) screen[int(j)][int(i)]=3;*/}}
////////////////////rectangle////////////////////////////
void M::rectangle(int x1,int y1,int x2,int y2)
{int minx=x1,miny=y1,maxx=x2,maxy=y2;if(x2<x1){maxx=x1;minx=x2;}if(y2<y1){maxy=y1;miny=y2;}
for(int i=minx;i<=maxx;i++)for(int j=miny;j<=maxy;j++){
if(i==x1||i==x2||j==y1||j==y2){screen[j]=c;}
}}
////////////////////////////////////////////////
void M::line(double x1,double y1,double x2,double y2,int pp=1)
{	double minx=x1,maxx=x2,miny=y1,maxy=y2;
if(y1>y2){maxy=y1;miny=y2;}
if(x1>x2){maxx=x1;minx=x2;}
if(x2!=x1)	{
double m_=(y2-y1)/(x2-x1);
for(double i=minx+2;i<=maxx+2;i++)screen[int(linefx(m_,i-2,x1,y1))][int(i)]=c;
if(pp=='2')for(double j=miny;j<=maxy;j++)screen[int(j)][int(linef_y(m_,j,x1,y1))+2]=c;}
else for(double j=miny;j<=maxy;j++)screen[int(j)][int(x1)]=c;
}
//////////////////////////
void M::line_()
{double x1,x2,y1,y2;char a[3];
cout<<"To draw a line we want tow points P1(x1,y1),P2(x2,y2)\n";
cout<<"So For P1(x1,y1) :: \nx1= ";cin>>x1;
cout<<" y1= ";cin>>y1;
cout<<"and For P2(x2,y2) :: \nx2= ";cin>>x2;
cout<<" y2= ";cin>>y2;
cout<<"Wich mode:1 or 2 ?";
cin>>a;
line(x1,y1,x2,y2,a[0]);}
//////////////////////yes//////////////////////////////
int yes(){return((getche()=='y'&&getche()=='e'&&getche()=='s')?1:0);}
//////////////////showxy///////
void showxy(int x,int y){char msg[11]={"x= ,y= ."};
msg[3]=char(x%10+48);
msg[2]=char((x-x%10)/10+48);
msg[8]=char(y%10+48);msg[7]=char((y-y%10)/10+48);
MessageBox(NULL,msg,"Coordinates",64);}
//////////////////////////////////////////
void pause(){system("pause");}
////////////////////////////////Help//////////////
void help()
{
cls();
cout<<"Welcome \noptions available here are :\n1- Space to change x,y"
<<"\n2- Enter to change x,y,your square side length(L/2),the drawing\ncharachter and step "
<<"\n3- Tab to change the drawing charachter"
<<"\n4- Back space to use the eraser , then press tab to return\nto the bruch tool"
<<"\n5- X to show x and y"
<<"\n6- Escape to save your picture"
<<"\n7-numbers:\n\t 1:to change bruch mode \n\t 2:to reset,then just type yes \n\t 3:to change step\n\t 4: to change (L/2)"
<<"\n\t 7: Drow a rectangle any where\n\t 8:Drow a circle any where \n\t 9: Drow a line any where"
<<"\n\t\t 0:for help"
<<"\nEnjoy\n";st(10);paus();cls();
}
//////////////////////a_////////////////////
void M::a_()
{	a=getch();
if(a==224){a=getch();N();}
else if(a==8)c=c2;
else if(a==9){cout<<"enter the charachter";cout.flush();a=getch();if(a=='2')c=char(219);else c=a;}
else if(a==13){EC();sqsomain();}
else if(a==27)S_fO();
else if(a==32){cout<<"Enter new x,y\nx=";cin>>x;x+=2;if(x<2)x=40;cout<<"y=";cin>>y;if(y<0)y=27;}
else if(a==48){help();}
else if(a==49){cout<<"Welcome :what the mode you want sur?0,1,2,3,4\n";cin>>b;}
else if(a==50){cout<<"Restart?";cout.flush();if(yes()){cout<<"\nbackground charachter";cin>>c2;S_S();}}
else if(a==52){cout<<"new L:";cin>>L;}
else if(a==51){cout<<"enter the step";cin>>step;}
else if(a==57)line_();
else if(a==56)circle_();
else if(a==55)rectangle_();
else if(a==120){showxy(x,y);}
}
///////////////////////////Screen Out//////////////////
void M::S_O(){cls();for(int c0=0;c0<Y;c0++){for(int c1=0;c1<X;c1++){cout<<screen[c0][c1];}cout<<"\r";}st();}
///////////////////////////Screen fOut//////////////////
void M::S_fO(){
MessageBox(NULL,"enter yor file name please ","Saving",1);
char name[20];char txt[]={".txt"};
cin>>name;
strcat(name,txt);
reinterpret_cast<const char*>(name);
ofstream outfile(name,ios::out);
outfile<<"#include<iostream.h>"<<endl<<"#include<windows.h>"<<endl<<"void main(){cout";
for(int c0=0;c0<Y-2;c0++){outfile<<"<<\"";
for(int c1=2;c1<X;c1++){
outfile<<screen[c0][c1];}outfile<<"\\n\""<<endl;}
outfile<<";system(\"pause\");}";outfile.close();system(name);}
////////////////////////////Screen Set///////////////////
void M::S_S(){
for(int c0=0;c0<56;c0++){
for(int c1=0;c1<X;c1++){
if(c1==0&&c0<Y-2)screen[c0][c1]=(c0-c0%10)/10+48;
else if(c1==1&&c0<Y-2)screen[c0][c1]=c0%10+48;
else if(c0==Y-2&&c1>1)screen[c0][c1]=(c1-2)%10+48;
else if(c0==Y-1&&c1>1)screen[c0][c1]=((c1-2)-(c1-2)%10)/10+48;
else screen[c0][c1]=c2;}}}
/////////////////////////////////Main///////////////
void main(){M ohammad;ohammad.sqsomain();}
//////////////////////////////////M()///////////////
M::M(){system("color f0");c='0';x=39;y=27;L=0;step=1;b=1;a=0;c2='.';S_S();S_O();}
//////////////////////square....screen out.....main_/////////////
void M::sqsomain(){Sq();S_O();main_();}
/*main_:a_ to get ch and analyze it
*	 square to draw square 
*	 screen out 
*	 main_ to repeat the operation
*/
void M::main_(){a_();Sq();S_O();main_();}
//////t/h/e////m/o/s/t///i/m/p/o/r/t/a/n/t////f/u/n/c/t/i/o/n////
//////////////////////////////Square/////////////////////////////////
void M::Sq()
{
for(int c0=y-L;c0<=y+L;c0++){
for(int c1=x-L;c1<=x+L;c1++){
if(c0<0||c1<2)continue;
if(c0>Y-3||c1>X-1)continue;if(b!=0&&b!=1&&b!=2&&b!=3&&b!=4)b=0;
/*All the surface screen*/	 if(b==0)screen[c0][c1]=c;
/*Only the perimeterif*/	 else if(b==1&&(c0==y-L||c0==y+L||c1==x-L||c1==x+L))screen[c0][c1]=c;
/*the perimeter and X in the shape*/else if(b==2){if(c0==y-L||c0==y+L||c1==x-L||c1==x+L)screen[c0][c1]=c;
else if(c1-c0==x-y||c1+c0==y+x)screen[c0][c1]=c;}
/*Xin the shape*/	 else if(b==3){if(c1-c0==x-y||c1+c0==y+x)screen[c0][c1]=c;}	
/*the surface without the center*/ else if(b==4){if(c0!=y||c1!=x)screen[c0][c1]=c;else screen[c0][c1]=c2;}}}
}
/////////////////////N///////////EC//////////
void M::N(){if(a==77) x+=step;else if(a==80) y+=step;else if(a==72) y-=step;else if(a==75) x-=step;}
void M::EC(){	char yesorno[5];cout<<"Do you wonna enter the coordinates?";cin>>yesorno;
if(yesorno[0]!='n'){cout<<"enter the coordinates of the center\n x=";cin>>x;x+=2;if(x<2)x=40;
cout<<"y=";cin>>y;if(y<0)y=27;
cout<<"enter the side length of the Sq:\n L=";cin>>L;if(L<0)L=0;
cout<<"Enter the charachter you wonna drow by:";cin>>yesorno;c=yesorno[0];
cout<<"Enter step\nstep=";cin>>step;cls();}else cls();}
/////////////////////////////////////////
/*
void choose
{int choose_=1;
cout<<"Choose the shape ypu wonna draw:\n1-LINE\n2-square\n3-rectangle\t";
cin>>choose_;
if(choose_==1)line_();
else if(choose_==2)square_();
else if(choose_==3)rectangle_();
else if(choose_==4)circle_();
else line_();
}
*/

GoodBye

#3

الله يسلّم إيديك , اي والله هيك أفضل .. تم التعديل جزاك الله خيراً

إليكم هذا قبل النوم وتصبحون على خير

نفّذ ثم اعترض.

#include<iostream.h>
#include<windows.h>
void st(double i=1){for(int j=0;j<1250*i;j++)cout<<1<<"\r";}
void clr(char a,char b){char k[]={"color 00"};k[7]=b;k[6]=a;system(k);st(10);}
void color(){char v,bu;
	for(int ysd=0;ysd<16;ysd++)for(int kd=0;kd<16;kd++){if(ysd<10)v=ysd+48;else v=ysd+87;if(kd<10)bu=kd+48;else bu=kd+87;
	clr(v,bu);}}
void main()
{
	for(int y=0;y<56;y++)for(int x=0;x<80;x++)cout<<char(179);
color();
}

تم تعديل هذه المشاركة بواسطة مصطفى 36a2 في 26 يناير 2012 في 01:23

#4

السلام عليكم اخواني , إليكم البرنامج التالي ... وهو برنامج جميل .. ومفيد ...يعطينا جدول الآسكي .. نفّذوه وادعولي

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#include<windows.h>
void main()
{
	cout<<setw(10)<<"ASCI"<<setw(15)<<"character"<<endl;
	for(int a=0;a<1000;a++){
		if(a!=7&&a!=10&&a!=8&&a!=9&&a!=13&&a!=32) 
		cout<<         setw(7)<<a<<setfill('*')<<setw(15)             <<char(a)<<setfill('*')<<setw(15)<<endl;
		if(a==7) cout<<setw(7)<<a<<setfill('*')<<setw(15)<<"beeb"     <<char(a)<<setfill('*')<<setw(15)<<endl;
		if(a==8) cout<<setw(7)<<a<<setfill('*')<<setw(15)<<"backspace"<<char(a)<<setfill('*')<<setw(15)<<endl;
		if(a==9) cout<<setw(7)<<a<<setfill('*')<<setw(15)<<"tab"      <<char(a)<<setfill('*')<<setw(15)<<endl;
		if(a==10)cout<<setw(7)<<a<<setfill('*')<<setw(15)<<"newline"  <<char(a)<<setfill('*')<<setw(15)<<endl;
		if(a==13)cout<<setw(7)<<a<<setfill('*')<<setw(15)<<"return to the biggining of the line"  <<char(a)<<setfill('*')<<setw(2)<<endl;
		if(a==32)cout<<setw(7)<<a<<setfill('*')<<setw(15)<<"space"    <<char(a)<<setfill('*')<<setw(15)<<endl;
	getch();	
	}	system("pause");
}
#5

من قياسى الكود بأقصى قدر ممكن

post-15367-027053900%201340345097.gifpost-15367-087183200%201340344597.gif
post-247365-0-10080400-1379403554_thumb.

#6

أظن أخي أنك تقصد ( أقصر قدر ممكن ) ..

بالمناسبة إخوتي :: عندما يضع أحدهم كود بسيط , فهذا يفيد المبتدئين كثيراً ( كما يحدث معي) بأن تتعلم دوال جديدة وأساليب جديدة

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

إليكم برنامجاً آخر يعطي نتيجة المعادلة التي يدخلها المستخدم ( يدعم الجمع والطرح والضرب والقسمة فقط)

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

#include<iostream.h>
#include<windows.h>
//////////////////////////////////////////////////////////////////
//	**Welcome To This Program**FUNCTIONS VER 1.2**ENJOY**		//
//To Understand Some Figures Read This Please:					//
//1-CTD=char to double function;								//
//2-UN =user's numbers array;									//
//3-UI =user in array (to save the function he enter);			//
//4-c  =counter integer(iin the FOR loop;						//
//5-iin=is it number function;									//
//6-FB =find bracket ')' function;								//
//7-RD =return double integer in function CTD					//
//////////////////////////////////////////////////////////////////
/*problem here don't enter   (sth)x+etc 
*/
/***//*cout*//**/	void out(int a){cout<<a;}
/*//error//*/		void error(int a){if(a==0)cout<<"Error div on 0";}
/*poweroften*/	double pot(int m){double a=1;for(int c=0;c<m;c++){a*=10;}return a;}	
/*iin*/		int iin(char a){if((47<a&&a<58)||a=='.')return 1;	else return 0;}
/*strout*/			void strout(char a[],int b=100){for(int i=0;i<b;i++){if(a==0)break;else cout<<a;}}
/*set*/				void set(char a[],int b=100){for(int i=0;i<b;i++){a=0;}}
/*CTD*/	double CTD(char a[],int b=100){double RD=0;int m=0;
			for(int i=0;i<b;i++){	if(a==0){if(m==0)RD/=10;break;}
							else if(a=='.'){m=1;RD/=10;}
							else if(m==0)RD=(RD+(a-48))*10;
							else if(m!=0){RD+=((a-48)/pot(m));m++;}}return RD;}
/*M*/double M(char &a,double b,double c,double x0=1){strout((&a-1));cout<<endl;
			 if(a=='+')return b+c;
		else if(a=='*')return b*c;
		else if(a=='(')return b*c;
		else if(a=='x')return b*x0;
		else if(a=='-')return b-c;
		else if(a=='/'){if(c!=0)return b/c;else error(0);return 0;}
		else return b;}
/*find bracket*/ int FB(char UI[],int start,int b=300){int a=0;
	for(int c=start;c<b;c++){
		if(UI[c]=='(')a++;
		else if(UI[c]==')'){if(a==1)return c;else a--;}
		else if(UI[c]==0)break;
		else continue;}
	if(a==0) {cout<<"No Bracket";return 2;}
	else {cout<<"Error couldn't find the end of the function//no close bracket//\n";return 0;}}
/*calc*/double calc(char UI[],double x0=1,int start=0,int b=300){
	int a=0;char UN [100];set(UN);
	for(int c=start;c<b;c++){
		if		(	 UI[c] ==0 )break;
		else if (	 UI[c] =='x'){return M(UI[c+1],x0,calc(UI,x0,c+2),x0);}
		else if (	 UI[c] =='('){return M(UI[FB(UI,c)+1],calc(UI,x0,c+1,FB(UI,c)),calc(UI,x0,FB(UI,c)+2));}
		else if (iin(UI[c])==1  ){
			UN[a]=UI[c];a++;
			if(UI[c+1]==0){break;}
			else if(iin(UI[c+1])==1)continue;
			else if(UI[c+1]=='x')					return M(UI[c+2],(CTD(UN)*x0),calc(UI,x0,c+3));
			else if(UI[c+1]=='*'){  if(UI[c+2]=='x')return M(UI[c+3],(CTD(UN)*x0),calc(UI,x0,c+4));
							 else if(iin(UI[c+2])==1) return (CTD(UN)*calc(UI,x0,c+2));
							 else if(UI[c+2]=='(')return M(UI[FB(UI,c+2)+1],CTD(UN)*calc(UI,x0,c+2),calc(UI,x0,FB(UI,c+2)+2));}
			else if(UI[c+1]=='+'){  if(UI[c+2]=='x')return M(UI[c+3],(CTD(UN)+x0),calc(UI,x0,c+4));
							 else if(iin(UI[c+2])==1) return (CTD(UN)+calc(UI,x0,c+2));
							 else if(UI[c+2]=='(')return M(UI[FB(UI,c+2)+1],CTD(UN)+calc(UI,x0,c+2),calc(UI,x0,FB(UI,c+2)+2));}
			else if(UI[c+1]=='-'){  if(UI[c+2]=='x')return M(UI[c+3],(CTD(UN)-x0),calc(UI,x0,c+4));
							 else if(iin(UI[c+2])==1) return (CTD(UN)-calc(UI,x0,c+2));
							 else if(UI[c+2]=='(')return M(UI[FB(UI,c+2)+1],CTD(UN)-calc(UI,x0,c+2),calc(UI,x0,FB(UI,c+2)+2));}
			else if(UI[c+1]=='/'){  if(UI[c+2]=='x'){if(x0!=0)return M(UI[c+3],(CTD(UN)/x0),calc(UI,x0,c+4));
													else error(0);}
							 else if(iin(UI[c+2])==1) return (CTD(UN)/calc(UI,x0,c+2));
							 else if(UI[c+2]=='('){if(calc(UI,x0,c+2)!=0)
													return M(UI[FB(UI,c+2)+1],CTD(UN)/calc(UI,x0,c+2),calc(UI,x0,FB(UI,c+2)+2));
												   else error(0);}}
			else if(UI[c+1]=='('){/*cout<<"here3";*/return M(UI[FB(UI,c+1)+1],CTD(UN)*calc(UI,x0,c+1),calc(UI,x0,FB(UI,c+1)+2)) ;}
			else continue;
		}
}return CTD(UN);}


void main()
{
	//const char  symbols[]={'+','-','*','/','(',')','^'};
	double x0=1;
	char UI[300];set(UI);
	cout<<"Enter f(x):";
	cin.getline(UI,300);
	cout<<"Enter x=";
	cin>>x0;
	//cout<<"here";
//cout<<iin(UI[0]);
//cout<<CTD(UI);
//cout<<pot(x0);
	cout<<calc(UI,x0)<<endl;
//cout<<sizeof(long double);
	system("pause");
}
1
#7
اقتباس
أظن أخي أنك تقصد ( أقصر قدر ممكن ) ..

بل أقصد كود سي++ طبقا للغة السي++ القياسية

أى عندما اقوم بتشغيلة لينكس يعمل او بتعديل بسيط جدا

اعتقد ان الكود لمثالى لئن يكون قياسي ...

شكرا اخى على مشاركتك الرائعة

post-15367-027053900%201340345097.gifpost-15367-087183200%201340344597.gif
post-247365-0-10080400-1379403554_thumb.

#8

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

والله ولي التوفيق

#9

الأخ الكريم/الأخت الكريمة

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

مرحباً بكم في منتدى الفريق العربي للبرمجة

تأسف إدارة المنتدى لغلق الموضوع وذلك لمخالفته قوانين المشاركات .

قواعد طرح المشاركات

/index.php?showtopic=29343

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

{username}

مدونتي: C++ Tips and Tricks

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

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