ورود به حساب ثبت نام جدید فراموشی کلمه عبور
برای ورود به حساب کاربری خود، نام کاربری و کلمه عبورتان را در زیر وارد کرده و روی «ورود به سایت» کلیک کنید.





اگر فرم ورود برای شما نمایش داده نمیشود، اینجا را کلیک کنید.









اگر فرم ثبت نام برای شما نمایش داده نمی‌شود، اینجا را کلیک کنید.









اگر فرم بازیابی کلمه عبور برای شما نمایش داده نمی‌شود، اینجا را کلیک کنید.






جهت تبلیغ در وب سایت ECA کلیک کنید.

کاربران برچسب زده شده

صفحه 1 از 3 123 آخرین
نمایش نتایج: از 1 به 10 از 30
  1. #1
    2006/10/28
    esfahan
    79
    0

    برنامه های توپ برای طرفداران C

    سلام Developers
    من حدود 10 تا برنامه در حد خوب با C نوشتم که می خواستم
    اونا رو برای علاقمندان بذارم ولی نمیدونم بهتره همینجا کپی کنم یا exeرا پلود کنم لطفا نظرتان را بدید
    در ضمن اگه شما هم برنامه خوب دارید اینجا بذارید
    we are here,it must be done
  2. #2
    2006/10/28
    esfahan
    79
    0

    پاسخ : برنامه های توپ برای طرفداران C

    این اولین برنامه:
    این برنامه گرافیکیه پس قبل از اجراش تنظیمات گرافیکیه کامپایلر c تونا درست کنید
    برنامه یکجورایی بازی بیدله البته همه قواعدش رعایت نشده
    کد:
    #include<graphics.h>
    #include  <stdio.h>
    #include  <conio.h>
    #include <stdlib.h>
    #include <string.h>
    #include  <ctype.h>
    #include   <dos.h>
    union REGS in,out;
    union REGS InRegs;
    union REGS OutRegs;
     int prev_mouse_x=0;
     int prev_mouse_y=0;
    void mouse( )
      {
        InRegs.x.ax=0x0001;
        int86(0x33,&InRegs,&OutRegs);
      }
    
    int callmouse()
    {
    in.x.ax=1;
    int86(51,&in,&out);
    return 1;
    }
    void mouseposi(int &xpos,int &ypos,int &click)
    {
    in.x.ax=3;
    int86(51,&in,&out);
    click=out.x.bx;
    xpos=out.x.cx;
    ypos=out.x.dx;
    }
    int mousehide()
    {
    in.x.ax=2;
    int86(51,&in,&out);
    return 1;
    }
    void setposi(int &xpos,int &ypos)
    {
    in.x.ax=4;
    in.x.cx=xpos;
    in.x.dx=ypos;
    int86(51,&in,&out);
    }
    void resetmouse()
    {in.x.ax=0;
    int86(51,&in,&out);}
    void restrictmouseptr(int x1,int y1,int x2,int y2)
    {
    in.x.ax=7;
    in.x.cx=x1;
    in.x.dx=x2;
    int86(51,&in,&out);
    in.x.ax=8;
    in.x.cx=y1;
    in.x.dx=y2;
    int86(51,&in,&out);
    }
    #define  con  20
    #define  add  13
    void input(int[],int[]);
    void motion(int[],int);
    void dis(int,int,int,int,int);
    void club(int,int);
    void hearts(int,int);
    void spade(int,int);
    void diamond(int,int);
    void begin(int[],int[]);
    void intialize(int[]);
    void call(int[],int[],int[]);
    int pluskid(int[],int[],int);
    int score(int,int[],int[],int,int[],int);
    int now(int,int[],int[]);
    int move(int,int,int[],int[],int);
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void main(){
    int d=DETECT,m=0;
    initgraph(&d,&m,"");
    restrictmouseptr(3,1,637,447);
    int adv[4]={0};int sc[4]={0};
    while(1){
    input(adv,sc);}}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void intialize(int array[52]){
    int i,j,s,k,player,face;
    randomize();
    for(j=0;j<4;j++)
    for(i=1+j*con;i<14+j*con;i++){
    player=random(52);
    while(array[player]!=0)
    player=random(52);
    array[player]=i;}
    for(k=0;k<4;k++)
    for(i=k*add;i<13+k*add;i++)
    for(j=12+k*add;j>i;j--)
    if(array[i]>array[j]){
    face=array[i];array[i]=array[j];array[j]=face;}
    for(k=1;k<4;k++)
    for(i=k*add;i<13+k*add;i++)
    for(j=12+k*add;j>i;j--)
    if(array[i]<array[j] && ((array[j]<14 && array[i]<14) || (20<array[j] && 20<array[i] && array[i]<34 && array[j]<34) || (40<array[j] && 40<array[i] && array[i]<54 && array[j]<54) || (60<array[j] && 60<array[i] && array[i]<74 && array[j]<74)) ){
    face=array[i];array[i]=array[j];array[j]=face;}}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    int pluskid(int plus[52],int a[4],int cv){
    char h;int f,q,e,i,j,s,k,m,g,x,y,cl=0,b=0,n,p=0,l=0;
    setposi(550,430);
    callmouse();
    for(j=0;j<add;j++)
    if(plus[j]>cv && plus[j]<cv+14){
    l=13;break;}
    while(1){
    while(cl==0 || cl==2)
    mouseposi(x,y,cl);
    y=y>475 ? y/10 : y;
    sound(3000);
    delay(9);
    nosound();
    for(n=0;n<7;n++){
    if(x>10+n*90 && x<93+n*90)
    if(y>210 && y<340){
    b=n+1;break;}
    else if(y>345 && y<475){
    b=n+8;break;}}
    if(b==0 || b==14){cl=0;b=0;continue;}
    for(n=0;n<13;n++){
    if(plus[n]!=0)
    p++;
    if(p==b){
    if(l==0){
    a[0]=plus[n];
    plus[n]=0;
    m=0;break;}
    else
    if(plus[n]>cv && plus[n]<cv+14){
    a[0]=plus[n];
    plus[n]=0;
    m=0;break;}p=15;break;}}
    if(p!=b){b=0;cl=0;p=0;continue;}
    if(a[0]>20)
    m=20;
    if(a[0]>40)
    m=40;
    if(a[0]>60)
    m=60;
    return m;}}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    int move(int i,int m,int plus[52],int a[4],int w){
    int j,s,f=0,q,k=-1;//need to improve
    for(j=i*add;j<add*(i+1);j++){
    if(plus[j]==71 && plus[j]>m && plus[j]<a[w]){
    a[i]=plus[j];plus[j]=0;return w;}
    else if(plus[j]==71){
    k=j;break;}else;}
    for(j=i*add;j<add*(i+1);j++){
    if(plus[j]>m && plus[j]<a[w]){
    a[i]=plus[j];plus[j]=0;s=j;f=1;break;}
    else if(a[w]<plus[j] && plus[j]<m+14){
    a[i]=plus[j];s=j;f=1;w=i;//need to improvment for i=2 stage
    }else;}
    if(f==1)
    plus[s]=0;
    else{//need to improvment
    if(k!=-1){
    a[i]=plus[k];plus[k]=0;return w;}
    q=0;m=i*add;
    while(plus[m+q]==0)
    q++;
    a[i]=plus[m+q];plus[m+q]=0;}
    return w;}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    int now(int w,int us[52],int a[4]){
    int i;int val=14,v,c,m;//begin of movement with PC
    for(i=w*add;i<(w+1)*add;i++){
    v=us[i];
    if(v>0 && (v%20)<(val%20)){
    val=v;c=i;m=(v/20)*20;}else;}
    a[w]=val;us[c]=0;
    return m;}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    int score(int a[4],int m,int kid[4],int w,int sc[4],int ctl){
    int i,min=100;int j=w,h=a[w];
    if(ctl==0){
    for(i=0;i<4;i++)
    if(a[i]>m && a[i]<m+14 && h<a[i]){
    h=a[i];j=i;}
    for(i=0;i<4;i++){
    if(a[i]>0 && a[i]<14)
    sc[j]++;//j is lost this stage
    else if(a[i]==71)
    sc[j]+=13;}
    return j;}
    else{
    for(i=0;i<4;i++)
    if(sc[i]==26){
    for(j=0;j<4;j++)
    if(j!=i)
    kid[j]+=26;return j;}
    for(i=0;i<4;i++)
    kid[i]+=sc[i];
    for(i=0;i<4;i++){
    if(kid[i]<min){
    min=kid[i];j=i;}
    if(kid[i]>99)
    w=100;}
    if(w==100){
    kid[0]=kid[1]=kid[2]=kid[3]=0;
    cleardevice();
    setcolor(4);
    settextstyle(3,0,19);
    if(j==0)
    outtextxy(30,200,"YOU WIN");
    else
    outtextxy(30,200,"YOU LOST");
    delay(3000);cleardevice();}
    return i;}}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void input(int adv[4],int sc[4]){
    int x,y,cl=0,i=-2,j,color=14,a1=3;int u[52]={0},a[4]={0};
    setposi(460,30);
    mouse();
    sc[3]=0;sc[1]=0;sc[2]=0;sc[0]=0;
    call(u,adv,sc);
    setcolor(4);
    settextstyle(1,0,9);
    outtextxy(110,25,"HEARTS");
    settextstyle(3,0,1);
    outtextxy(200,250," Developed And Designed:");
    settextstyle(4,0,19);
    outtextxy(120,250,"PlusKid");
    setcolor(a1);
    settextstyle(0,0,1);
    setfillstyle(1,4);
    rectangle(500,30,580,50);
    settextstyle(0,0,1);
    floodfill(503,33,a1);
    outtextxy(509,35," NEW");
    rectangle(500,60,580,80);
    floodfill(503,65,a1);
    outtextxy(508,67," HELP");
    rectangle(500,90,580,110);
    floodfill(503,93,a1);
    outtextxy(509,95,"CONTINUE");
    rectangle(500,120,580,140);
    floodfill(503,125,a1);
    outtextxy(508,125," ABOUT");
    rectangle(500,150,580,170);
    floodfill(503,152,a1);
    outtextxy(508,155," QUIT");
    settextstyle(0,0,1);
    while(cl==0 || cl==2){
    mouseposi(x,y,cl);
    while(y>33 && y<49 && (cl==0 || cl==2) && x>510 && x<570){
    mouseposi(x,y,cl);
    i=0;
    setcolor(color);
    rectangle(500,30,580,50);}
    setcolor(a1);
    rectangle(500,30,580,50);
    while(y>61 && y<80 && (cl==0 || cl==2) && x>510 && x<570){
    mouseposi(x,y,cl);
    setcolor(color);
    rectangle(500,60,580,80);
    i=1;}
    setcolor(a1);
    rectangle(500,60,580,80);
    while(y>90 && y<110 && (cl==0 || cl==2) && x>510 && x<570){
    mouseposi(x,y,cl);
    setcolor(color);
    rectangle(500,90,580,110);
    i=2;}
    setcolor(a1);
    rectangle(500,90,580,110);
    while(y>120 && y<140 && (cl==0 || cl==2) && x>510 && x<570){
    setcolor(color);
    mouseposi(x,y,cl);
    i=3;
    rectangle(500,120,580,140);}
    setcolor(a1);
    rectangle(500,120,580,140);
    while(y>151 && y<170 && (cl==0 || cl==2) && x>510 && x<570){
    setcolor(color);
    mouseposi(x,y,cl);
    i=4;
    rectangle(500,150,580,170);}
    setcolor(a1);
    rectangle(500,150,580,170);}
    switch(i){
    case 0:
    begin(a,sc);
    break;
    case 1:
    mousehide();
    setviewport(120,110,520,330,1);
    clearviewport();
    floodfill(1,1,2);
    window(10,10,240,250);
    bar3d(0,0,390,240,10,0);
    setcolor(11);
    highvideo();
    outtextxy(28,5,"       IN THE NAME OF GOD  ");
    outtextxy(20,25,"      Introduce Of This Game ");
    outtextxy(20,45,"     WithOut Heart And Spade Queen");
    outtextxy(1,65,"         You Are Pluskid.");
    outtextxy(20,85,"     Spade Queen Is Equal -13");
    outtextxy(30,105,"  Every Heart Which You Get Is Equal -1");
    outtextxy(20,125,"      The Winner's Name Is Red");
    outtextxy(1,145," Game Is Continued Till Somebody Get -100 Score");
    outtextxy(1,165,"Whatever Your Score Is Higher You're Loser Sooner");
    outtextxy(30,200,"      Sunday,May 07,2006");
    delay(15000);
    setfillstyle(11,8);
    floodfill(10,10,4);
    setviewport(0,0,639,479,1);
    cleardevice();
    call(u,adv,sc);
    i=-1;
    input(adv,sc);
    break;
    case 2:
    if(adv[0]==0 && adv[1]==0 && adv[2]==0 && adv[3]==0){
    mousehide();
    setviewport(140,110,400,190,1);
    clearviewport();
    floodfill(1,1,2);
    window(10,10,240,250);
    bar3d(0,0,250,80,10,0);
    setcolor(11);
    highvideo();
    outtextxy(28,40,"YOU DON'T BEGIN ANY GAME ");
    delay(1500);
    setfillstyle(11,8);
    floodfill(10,10,4);
    setviewport(0,0,639,479,1);
    cleardevice();
    break;}
    begin(adv,sc);
    break;
    case 4:
    exit(1);
    break;
    case 3:
    mousehide();
    setviewport(200,110,460,300,1);
    clearviewport();
    floodfill(1,1,2);
    window(10,10,200,250);
    bar3d(0,0,250,190,10,0);
    setcolor(14);
    highvideo();
    outtextxy(8,5,"    IN THE NAME OF GOD  ");
    outtextxy(1,45," Developed And Published By: ");
    outtextxy(1,70,"    Hossein Paimard");
    outtextxy(1,100,"   Pluskid2000@yahoo.com");
    outtextxy(1,130,"   Sunday,May 07,2006");
    delay(6000);
    setfillstyle(11,8);
    floodfill(10,10,4);
    setviewport(0,0,639,479,1);
    cleardevice();
    call(u,adv,sc);
    i=-1;
    input(adv,sc);
    break;
    }}
    
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void begin(int adv[4],int sc[4]){
    int a[4]={0},j,i,w,m,s=13,cl=0,x,y,ss;
    //call(plus,adv);
    int plus[52]={0};
    intialize(plus);
    //input(adv);
    w=random(4);
    j=w;
    while(s--){
    mousehide();
    call(plus,adv,sc);
    if(w==0)
    m=pluskid(plus,a,-100);
    else
    m=now(w,plus,a);
    motion(a,w);
    for(i=w+1;i<w+4;i++){
    if((i%4)==0)
    pluskid(plus,a,m);
    else
    j=move(i%4,m,plus,a,j);
    motion(a,i%4);}
    setposi(540,345);
    w=score(a,m,adv,w,sc,0);
    j=w;
    mousehide();
    delay(1500);
    clearviewport();}
    score(a,m,adv,w,sc,1);
    input(adv,sc);}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void motion(int a[4],int i){
    int j,f;
    j=a[i]/con;
    f=a[i]%con;
    dis(f,i,j,1+i,-180);}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void club(int i,int j){
    setcolor(0);
    circle(i+8,j+2,4);
    circle(i+4,j+9,4);
    circle(i+13,j+9,4);
    rectangle(i+5,j+13,i+11,j+18);
    setfillstyle(0,10);
    putpixel(i+9,j+6,5);
    putpixel(i+8,j+12,0);
    putpixel(i+9,j+12,0);
    putpixel(i+8,j+11,0);
    putpixel(i+9,j+11,0);
    floodfill(i+9,j+16,0);
    floodfill(i+8,j+2,0);
    floodfill(i+5,j+9,0);
    floodfill(i+11,j+9,0); }
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void call(int array[52],int adv[4],int sc[4]){
    int s,j,k=0,i,m=0,x,y,cl,min=10,min1=10,yy=-1,nn=-1;
    char p0[3]={0},p1[3]={0},p2[3]={0},p3[3]={0},p10[3]={0},p11[3]={0},p12[3]={0},p13[3]={0};
    //resetmouse();
    for(i=0;i<13;i++){
    s=array[i];
    if(s==0)continue;
    if(s<14+k*con){
    switch(k){
    case 0:k=0;
    dis(s,m,0,m,0);m++;
    break;//call hearts
    case 1:k=0;
    dis(s-con,m,1,m,0);m++;break;//call club
    case 2:k=0;
    dis(s-2*con,m,2,m,0);m++;
    break;
    case 3:k=0;
    dis(s-3*con,m,3,m,0);m++;
    break;}}
    else{
    k++;i--;}}
    setcolor(4);
    settextstyle(1,0,9);
    outtextxy(110,25,"HEARTS");
    settextstyle(0,0,1);
    setcolor(4);
    setfillstyle(1,4);
    ellipse(54,13,0,360,46,12);
    floodfill(55,14,4);
    setcolor(15);
    outtextxy(11,10,"TOTAL SCORE");
    setcolor(4);
    ellipse(54,175,0,360,46,12);
    floodfill(55,176,4);
    setcolor(15);
    outtextxy(10,172,"STAGE SCORE");
    setcolor(2);
    min=min1=100;
    for(int o=0;o<4;o++)
    if(adv[o]<min){
    min=adv[o];yy=o;}
    for(o=0;o<4;o++)
    if(sc[o]<min1){
    min1=sc[o];nn=o;}
    itoa(adv[0],p0,10);itoa(adv[1],p1,10);
    itoa(adv[2],p2,10);itoa(adv[3],p3,10);
    itoa(sc[0],p10,10);itoa(sc[1],p11,10);
    itoa(sc[2],p12,10);itoa(sc[3],p13,10);
    if(yy==0)
    setcolor(4);
    else
    setcolor(3);
    outtextxy(25,37,"Pluskid");outtextxy(45,52,p0);
    if(nn==0)
    setcolor(4);
    else
    setcolor(3);
    outtextxy(113,168,"Pluskid");outtextxy(130,185,p10);
    if(yy==1)
    setcolor(4);
    else
    setcolor(3);
    outtextxy(25,67,"Hossein");outtextxy(45,82,p1);
    if(nn==1)
    setcolor(4);
    else
    setcolor(3);
    outtextxy(203,168,"Hossein");outtextxy(223,185,p11);
    if(yy==2)
    setcolor(4);
    else
    setcolor(3);
    outtextxy(25,97,"Michael");outtextxy(45,112,p2);
    if(nn==2)
    setcolor(4);
    else
    setcolor(3);
    outtextxy(290,168,"Michael");outtextxy(315,185,p12);
    if(yy==3)
    setcolor(4);
    else
    setcolor(3);
    outtextxy(25,127,"Carlson");outtextxy(45,142,p3);
    if(nn==3)
    setcolor(4);
    else
    setcolor(3);
    outtextxy(380,168,"Carlson");outtextxy(405,185,p13);}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void dis(int i,int m,int g,int z,int s){
    int x,y,spot[30]={0},r;char j[20]={0};
    setfillstyle(11,8);
    setcolor(3);
    floodfill(10,10,4);
    i++;
    rectangle(0,200,639,479);
    setposi(590,370);
    callmouse();
    if(i==14){
    strcpy(j," ACE");
    i=1;}
    else if(i==13){
    strcpy(j," KING");
    i=1;}
    else if(i==12){
    strcpy(j,"QUEEN");
    i=1;}
    else if(i==11){
    strcpy(j," JACK");
    i=1;}
    else
    itoa(i,j,10);
    if(m>6){
    z=m-7;
    s=135;}
    y=93+90*z;
    x=3+z*90;
    rectangle(x+7,210+s,y,340+s);
    setfillstyle(1,15);
    floodfill(x+8,211+s,3);
    outtextxy(x+11,214+s,j);
    spot[0]=x+28;spot[1]=215+s;
    spot[2]=x+55;spot[3]=spot[1];
    spot[4]=spot[0];spot[5]=239+s;
    spot[6]=spot[2];spot[7]=spot[5];
    spot[8]=spot[0];spot[9]=263+s;
    spot[10]=spot[2];spot[11]=spot[9];
    spot[12]=spot[0];spot[13]=289+s;
    spot[14]=spot[2];spot[15]=spot[13];
    spot[16]=spot[0];spot[17]=313+s;
    spot[18]=spot[2];spot[19]=spot[17];
    switch(g){
    case 0:
    if(i==1){
    hearts(x+43,spot[11]);
    settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
    outtextxy(x+12,spot[11]-28,j);
    settextstyle(DEFAULT_FONT,HORIZ_DIR,1);}
    else
    for(r=0;r<i;r++)
    hearts(spot[r*2],spot[r*2+1]);
    break;
    case 1:
    if(i==1){
    club(x+43,spot[11]);
    settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
    outtextxy(x+12,spot[11]-28,j);
    settextstyle(DEFAULT_FONT,HORIZ_DIR,1);}
    else
    for(r=0;r<i;r++)
    club(spot[r*2],spot[r*2+1]+2);
    break;
    case 2:
    if(i==1){
    diamond(x+43,spot[11]);
    settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
    outtextxy(x+12,spot[11]-28,j);
    settextstyle(DEFAULT_FONT,HORIZ_DIR,1);}
    else
    for(r=0;r<i;r++)
    diamond(spot[r*2],spot[r*2+1]);
    break;
    case 3:
    if(i==1){
    spade(x+43,spot[11]);
    settextstyle(TRIPLEX_FONT,HORIZ_DIR,3);
    outtextxy(x+12,spot[11]-28,j);
    settextstyle(DEFAULT_FONT,HORIZ_DIR,1);}
    else
    for(r=0;r<i;r++)
    spade(spot[r*2],spot[r*2+1]);
    break;}}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void diamond(int i,int j){
    int p[10]={0};
     char pattern[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
    setcolor(4);
    p[0]=i;p[1]=j+12;p[2]=i+7;p[3]=j+1;p[4]=i+14;
    p[5]=j+12;p[6]=i+7;p[7]=j+24;p[8]=i;p[9]=j+12;
    drawpoly(5,p);
    setfillpattern(pattern,4);
    fillpoly(5,p);}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void hearts(int i,int j){
    int p[10]={0};
     char pattern[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
    setcolor(4);
    p[0]=i;p[1]=j+12;p[2]=i+7;p[3]=j+23;p[4]=i+14;p[5]=j+12;p[6]=i;p[7]=j+12;
    drawpoly(4,p);
    setfillpattern(pattern,4);
    fillpoly(4,p);
    circle(i+3,j+9,4);
    circle(i+11,j+9,4);
    putpixel(i+8,j+11,0);
    putpixel(i+9,j+11,0);
    floodfill(i+3,j+9,4);
    floodfill(i+11,j+9,4);}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void spade(int i,int j){
    int p[10]={0};
     char pattern[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
    setcolor(0);
    p[0]=i;p[1]=j+14;p[2]=i+7;p[3]=j+2;p[4]=i+14;p[5]=j+14;p[6]=i;p[7]=j+14;
    drawpoly(4,p);
    setfillpattern(pattern,0);
    fillpoly(4,p);
    circle(i+4,j+15,4);
    circle(i+10,j+15,4);
    rectangle(i+5,j+16,i+9,j+24);
    putpixel(i+7,j+15,0);
    putpixel(i+6,j+17,0);
    putpixel(i+8,j+17,0);
    floodfill(i+8,j+21,0);
    floodfill(i+4,j+15,0);
    floodfill(i+10,j+15,0);}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    we are here,it must be done
  3. #3
    2005/12/28
    تبريز
    4,216
    1,149

    پاسخ : برنامه های توپ برای طرفداران C

    سلام دوست عزيز خوب هستين؟
    اتفاقا چند روز پيش تصميم گرفته بوديم يك بانك نرم افزاري از برنامه هايي كه خود اعضاي سايت نوشتن درست كنيم و تو خود هاست سايت پلود كنيم البته با همكاري مدير بخش مربوطه (آقا محمد رضاي عزيز) .
    شما لطف كنيد و فايل هاي exe و سورس برنامه هارو يكي يكي تو يك سايت رايگان پلود كنيد و لينكش رو اينجا بزارين + يك توضيح نسبتا خوب هم براي برنامه ها بدين تا دوستان بتونن استفاده كنند.
    بعد ما به همين زودي اين بانك نرم افزاري رو راه مي اندازيم و از از برنامه هاي شما و بقيه دوستان هم با نام و توضيح خودتون استفاده خواهيم كرد :smile:
    البته توضيحات بيشتري داده خواهد شد :agree:
    موفق باشين. (منتظريم :icon_razz
  4. #4
    2006/10/28
    esfahan
    79
    0

    پاسخ : برنامه های توپ برای طرفداران C

    بازم سلام
    بچه ها کدها تو صفحه اینجوری هست اگه کپی کنید و پیست کنیدتو notepad درست میشه
    اگه سوالی بود در خدمتم
    با تشکر از آقای امیر علی می خواستم بگم همینجا کد را کپی کنیم بهتر نیست
    bye
    we are here,it must be done
  5. #5
    2006/10/28
    esfahan
    79
    0

    پاسخ : برنامه های توپ برای طرفداران C

    سلام اینم دومین برنامه
    محاسبه پارامترهای A,B,C,D فضای حالت با ورودی تابع پروسس کنترل(مرجع کنترل اوگاتا)
    کد:
    #include<stdio.h>
    #include<conio.h>
    void prog1(int [],int [],int);
    void prog2(int [],int [],int [],int);
    int main(){
    int num[10]={0},den[10]={0},i,dn,dd;clrscr();
    printf("\n   Y(s)  num");printf("\nenter ؤؤؤؤ = ؤؤؤ");printf("\n   U(s)  den");
    printf("\n\nenter degree of num & den:");scanf("%d%d",&dn,&dd);
    for(i=dn;i>=0;i--){
    printf("\nenter power of num(U(s)) degree(%d):",i);scanf("%d",&num[dn-i]);}
    printf("\n*******************************\n");
    for(i=dd;i>=0;i--){
    printf("\nenter power of den(Y(s)) degree(%d):",i);scanf("%d",&den[dd-i]);}
    prog1(num,den,dd);getch();return 0;}
    //***************************************************************************
    void prog1(int num[],int den[],int dd){
    int b[20]={0},i;
    for(i=dd;i>=0;i--)
    b[i]=num[i]-den[1]*b[i+1]-den[2]*b[i+2]-den[3]*b[
    i+3]-den[4]*b[i+4]-den[5]*b[i+5]-den[6]*b[i+6]-den
    [7]*b[i+7]-den[8]*b[i+8]-den[9]*b[i+9]-den[10]*b[i+10];
    prog2(num,den,b,dd);}
    //***************************************************************************
    void prog2(int num[],int den[],int b[],int dd){
    int h[10][10]={0},q=1,i,j,s=1;clrscr();printf("\n\n\nA=\n\n");
    for(j=0;j<dd-1;j++){
    for(i=0;i<dd;i++){
    if(i==s)
    h[j][i]=1;printf("\t%4d",h[j][i]);}printf("\n");s++;}
    for(j=0;j<dd;j++)
    printf("\t%4d",-den[dd-j]);printf("\n\nB=\n\n");
    for(i=dd-1;i>=0;i--)
    printf("\t%4d\n",b[i]);printf("\n\nC=\n\n\n");printf("\t%4d",q);
    for(i=0;i<dd-1;i++)
    printf("\t%4d",q-1);printf("\n\nD=\n\n\t%4d",num[0]);}
    //***************************************************************************
    we are here,it must be done
  6. #6
    2006/10/28
    esfahan
    79
    0

    پاسخ : برنامه های توپ برای طرفداران C

    سلام
    سومین برنامه ماتریس های بالا مثلثی و پایین مثلثی را به اضافه دترمینان ماتریس اصلی با دو تقریب سطر اصلی ماتریس های قبلی محاسبه می کند.
    :question:اگه در اجرای برنامه ها با مشکل روبرو شدید لطفا بگید

    کد:
    #include<stdio.h>
    #include<conio.h>
    #include<alloc.h>
    #include<string.h>
    const volatile int max=10;
    void output(float[][max],float[][max],float[][max],int);
    void calculateU(float[][max],int);
    void calculateL(float[][max],int);
    void finish(void);
    int input(float[][max],float[][max],float[][max]);
    int main(){
    clrscr();int s;char u;
    float c[max][max],c1[max][max],c2[max][max];
    do{
    s=input(c,c1,c2);
    calculateU(c1,s);
    calculateL(c2,s);
    output(c,c1,c2,s);
    u=getch();
    }while(u!='n' && u!='N');finish();getch();return 0;}
    //input//////////////////////////////////////////////////////////////////////////
    int input(float a[][max],float a1[][max],float a2[][max]){
    clrscr();int s;int register i,j;
    printf("\n\ncomment:\n\n   << this program calculate triU & triL of a special squre matrix >>\n\t   << with constant determinan of original matrix >>\n\t     << also provide determinan with 2'ways >>\n\n\nbegin:\n enter degree of matrix:");
    scanf("%d",&s);clrscr();
    for(i=0;i<s;i++){
    printf("\nplease inter arguments of row %d:\n",i+1);
    for(j=0;j<s;j++){
    scanf("%f",*(a+i)+j);
    *(*(a2+i)+j)=*(*(a1+i)+j)=*(*(a+i)+j);}}return s;}
    //output///////////////////////////////////////////////////////////////////////
    void output(float o[][max],float o1[][max],float o2[][max],int s){
    clrscr();int register i,j;double h1=1,h2=1;
    for(i=0;i<s;i++){
    h1*=o1[i][i];h2*=o2[i][i];}
    printf("\n\n\n\t\t\t ORIGINAL MATRIX\n");
    for(i=0;i<s;i++){
    printf("\n\t\t  ");
    for(j=0;j<s;j++)
    printf("%-10.3f",o[i][j]);}
    for(i=0;i<s;i++)
    for(j=0;j<s;j++){
    if(o1[i][j]<0)
    gotoxy(j*12+2,i+20);
    else
    gotoxy(j*12+3,i+20);
    printf("%-9.5f",o1[i][j]);
    gotoxy(10,18);
    printf("--TRIU of matrix--");
    if(s<4){
    gotoxy(48,18);
    printf("--TRIL of matrix--");
    if(o2[i][j]<0)
    gotoxy(j*12+42,i+20);
    else
    gotoxy(j*12+43,i+20);
    printf("%-9.5f",o2[i][j]);}}
    int b=i+7;
    if(s>3){
    gotoxy(15,b+18);
    printf("--TRIL of matrix--");
    for(i=0;i<s;i++)
    for(j=0;j<s;j++){
    if(o2[i][j]<0)
    gotoxy(j*12+2,i+b+20);
    else
    gotoxy(j*12+3,i+b+20);
    printf("%-9.5f",o2[i][j]);}}
    i=b+i+20;
    gotoxy(8,i+20);
    	printf("\n\n\n عؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤ؟  عؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤ؟");
    	printf("\n ³determinan of matrix= %12.3f³  ³determinan of matrix= %12.3f³ ",h1,h2);
    	printf("\n ہؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤظ  ہؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤظ");
    	printf("\n\n\n\t عؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤ؟");
    	printf("\n\t ³    design and make by : pluskid2000@yahoo.com    ³ ",h2);
    	printf("\n\t ہؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤظ");
    	printf("\n\n\n\t     would you like to continue?");}
    //calculate triU//////////////////////////////////////////////////////////////////////
    void calculateU(float c[][10],int s){
    float *h=(float*)malloc(sizeof(float));int y=0,k=s;
    int register i,j;
    while(y<s-1){
    for(i=1;i<k;i++){
    if(c[y][y]!=0)
    h[i-1]=c[y+i][y]/c[y][y];
    else{
    for(j=0;j<s;j++)
    c[y][j]+=c[y+i][j];
    h[i-1]=c[y-i][y]/c[y][y];}}
    y++;k--;
    for(i=0;i<k;i++)
    for(j=s-1;j>=0;j--)
    c[i+y][j]=c[i+y][j]-h[i]*c[y-1][j];}}
    //calculate triL//////////////////////////////////////////////////////////////////////
    void calculateL(float c[][10],int s){
    float *h=(float*)malloc(sizeof(float));int y=s-1,k=s;
    int register i,j;
    while(y>0){
    for(i=1;i<k;i++){
    if(c[y][y]!=0)
    h[i-1]=c[y-i][y]/c[y][y];
    else{
    for(j=0;j<s;j++)
    c[y][j]+=c[y-i][j];
    h[i-1]=c[y-i][y]/c[y][y];}}
    y--;k--;
    for(i=0;i<k;i++)
    for(j=s-1;j>=0;j--)
    c[y-i][j]=c[y-i][j]-h[i]*c[y+1][j];}}
    //finish//////////////////////////////////////////////////////////////////////////
    //external function
    void delay(void){
    for(long int l=0;l<1999990;l++);}
    void finish(void){
    clrscr();int max=20,r=1,e=0,i,j;char k[40]=" Design And Make By:";loop:r--;
    for(i=0;i<24;i++)for(j=0;j<max;j++){
    gotoxy(j+2*i,j+e);printf("%c",k[i]);
    gotoxy(max+2*i,max-1+e);printf(" ");delay();
    if(j<max-1)gotoxy(j+2*i,j+e);
    printf(" ");}e+=3;
    strcpy(k,"  Hossein Paimard      ");
    if(r==0)goto loop;
    strcpy(k," Pluskid2000@yahoo.com     ");
    if(r==-1)goto loop;gotoxy(80,50);}
    
    //////////////////////////////\/\/\/\/\/\/\/\/\/\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    //              pluskid2000@yahoo.com             \\
    //              monday,january23,2006             \\
    //                  20:02                 \\
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\/\/\/\/\/\/\/\/\/\/\/\//////////////////////////
    we are here,it must be done
  7. #7
    2006/10/28
    esfahan
    79
    0

    پاسخ : برنامه های توپ برای طرفداران C

    سلام
    برنامه چهارم ماتریس وارون را به اضافه دترمینان ماتریس اصلی محاسبه می کنه
    بچه ها لطفا نظرتونا در مورد برنامه ها بگین

    کد:
    #include<stdio.h>
     #include<conio.h>
      #include<alloc.h>
    const volatile max=15;
    int  read(float[][max],float[][max]);
    void  compute1(float[][max],float[][max],float[][max],int,int,int,float);
    float compute2(float[][max],int);
    void  display(float[][max],float[][max],int,float);
    int  main(){
    float num[max][max],g[max][max],v[max][max],a[max][max];int dn,u;float det;
    	int register i,j;
    	dn=read(num,a);
    	det=compute2(num,dn);
    	for(i=0;i<dn;i++)
    	for(j=0;j<dn;j++){
    	compute1(a,g,v,dn,i,j,det);}
    	display(a,v,dn,det);
    	getch();
    	return 0;}
    //****************************************************************************
    int read(float num[][max],float a[][max]){
    int dn;clrscr();int register i,j;
    printf("\nenter degree of matrix:");
    scanf("%d",&dn);
    clrscr();
    for(i=0;i<dn;i++){
    printf("\n\n\nenter arguments of row[%d]:\n\n",i);
    for(j=0;j<dn;j++){
    scanf("%f",*(num+i)+j);
    *(*(a+i)+j)=*(*(num+i)+j);}}return dn;}
    //****************************************************************************
    void  display(float c[][max],float inv[][max],int dn,float det){
    int register i,j;clrscr();
    	printf("\n\n\n\n\n\t\t\t  --ORIGINAL MATRIX--\n");
    	for(i=0;i<dn;i++){
    	 printf("\n\t\t");
    	for(j=0;j<dn;j++)
    	printf("%10.3f",c[i][j]);}
    	printf("\n\n\n\t\t\t   --INVERSE MATRIX--\n");
    	for(i=0;i<dn;i++){
    	 printf("\n\t\t");
    	for(j=0;j<dn;j++)
    	printf("%10.6f ",inv[i][j]);}
    	printf("\n\n\n\t\tعؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤ؟");
    	printf("\n\t\t³ determinan of matrix= %19.7f ³ ",det);
    	printf("\n\t\tہؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤظ");
    	}
    //****************************************************************************
    void compute1(float g[][max],float v[][max],float inv1[][max],int dn,int r,int c,float e){
    int col=0,row=0,add=r+c,y;float y1=1;
    if(add%2)
    y1=-1;
    int register i,j;
    for(i=0;i<dn-1;i++){
    if(i==r)
    row=1;
    col=0;
    for(j=0;j<dn-1;j++){
    if(j==c)
    col=1;
    v[i][j]=g[i+row][j+col];}}
    inv1[c][r]=y1*compute2(v,dn-1)/e;}
    //****************************************************************************
    float compute2(float c[][max],int s){
    float *h=(float*)malloc(sizeof(float)),h1=1;int y=s-1,k=s;
    int register i,j;
    while(y>0){
    for(i=1;i<k;i++){
    if(c[y][y]!=0)
    h[i-1]=c[y-i][y]/c[y][y];
    else{
    for(j=0;j<s;j++)
    c[y][j]+=c[y-i][j];
    h[i-1]=c[y-i][y]/c[y][y];}}
    y--;k--;
    for(i=0;i<k;i++)
    for(j=s-1;j>=0;j--)
    c[y-i][j]=c[y-i][j]-h[i]*c[y+1][j];}
    for(i=0;i<s;i++)
    h1*=c[i][i];return h1;}
    //************************\/\/\/\/\/\/\/\/\/\/\/\/**************************//
    //              END OF PROGRAM                //
    //              HOSSEIN PAIMARD                //
    //            wednsday. january 25-2006             //
    //                11:57 A.M
    //             PLUSKID2000 @ YAHOO.COM              //
    //************************/\/\/\/\/\/\/\/\/\/\/\/***************************//
    we are here,it must be done
  8. #8
    2006/10/28
    esfahan
    79
    0

    پاسخ : برنامه های توپ برای طرفداران C

    برنامه پنجم
    دترمینان ماتریس را حساب میکنه :cry:
    حتما میگین چه ابکی ولی خوب :biggrin:اگه ماتریس بر حسب ضرایب پارامترs از توان دو باشه نظرتون چیه :rolleyes:
    اماhelp برنامه:
    اول درجه ماتریس را میدید مثلا 3
    بعد باید پارامترهای سطر اول ماتریس(یعنی در اینحالت 3 پارامتر سطر اول)را وارد کنید چون ورودی هر پارامتر بر حسب a.b.c هست(as^2+bs+c) در سطر اول در اینحالت باید
    9 پارامتریعنی 3 تا abc وارد کنید هر کدوما نخواستد 0 وارد کرده اعداد با فرمتfloat هستند

    کد:
    #include<stdio.h>
    #include<conio.h>
    const volatile max=25;
     int  read(float[][max]);
     void   prog(float[][max],float[][max],float[],int);
     void    conv(float[],float[][max],float[],int);
     void    compute1(float[][max],float[][max],int);
     void    compute2(float[][max],float[][max],float[][max],int,int);
     int    main(){float num[6][max],g[6][max]={0},
    	   p[15]={0};int dn,f,j,q,u,k,i=0;
    	dn=read(num);
    	compute1(num,g,dn+1);
    	prog(num,g,p,dn);
    //input\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    clrscr();
    for(f=1;f<=dn;f++){
    for(i=1;i<=dn;i++){
    gotoxy(20*(i-1)+2,5+f);q=1+3*(i-1);
    while(num[f][q]==0)q++;
    if(3*i-q>0)printf("%3.1fs^%d",num[f][q],3*i-q);
    for(k=q+1;k<3+(i-1)*3;k++){
    if(num[f][k]==0);else{
    if(num[f][k]>0)
    printf("+%3.1fs^%d",num[f][k],i*3-k);
    else printf("%3.1fs^%d",num[f][k],3*i-k);}}
    if(num[f][3*i]<0)printf("%3.1f",num[f][3*i]);
    else if(num[f][3*i]!=0)
    printf("+%3.1f",num[f][3*i]);printf(" ");}}
    //output\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    i=0;while(p[i]==0)i++;
    printf("\n\n\n\n determinan of matrix is:\n\n  ");
    if(dn*2+1-i)printf("%.4fs^%d",p[i],dn*2+1-i);
    for(j=i+1;j<dn*2+1;j++){if(p[j]==0);
    else{if(p[j]>0)
    printf("+%.4fs^%d",p[j],dn*2+1-j);else
    printf("%fs^%d",p[j],dn*2+1-j);}}
    if(p[dn*2+1]<0)
    printf("%.4f",p[dn*2+1]);
    else if(p[dn*2+1]!=0)
    printf("+%.4f",p[dn*2+1]);
    getch();return 0;}
    //****************************************************************************
    int read(float num[][25]){
    int dn=0;clrscr();int register i,j;
    printf("\nenter degree of matrix:");
    scanf("%d",&dn);
    clrscr();
    for(i=1;i<=dn;i++){
    printf("\n\n\nenter arguments of row[%d]:\n\n",i);
    for(j=1;j<=dn*3;j++)
    scanf("%f",&num[i][j]);}return dn;}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void prog(float num[][25],float g[][25],float p[],int dn){
    int register u,i;float v[6][25]={0},h[50]={0};
    for(u=1;u<=dn;u++){
    compute1(g,v,dn);
    if(dn-2)
    prog(g,v,h,dn-1);
    else{
    h[1]=g[1][1];h[2]=g[1][2];h[3]=g[1][3];}
    conv(h,num,p,u);
    compute2(num,g,v,dn,u);
    for(i=0;i<15;i++)
    h[i]=0;}}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void compute1(float g[][25],float v[][25],int dn){
    int register i,j;
    for(i=1;i<=(dn-2)*3;i++)
    for(j=1;j<(dn-1);j++)
    v[j][i]=g[j+1][i+3]; }
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void compute2(float num[][25],float g[][25],float v[][25],int dn,int u){
    int register j;
    for(j=1;j<dn;j++){
    g[j][3*(u-1)+1]=num[j+1][3*(u-1)+1];g[j][3*(u-1)+2]=num[j+1][3*(u-1)+2];g[j][3*u]=num[j+1][3*u];}
    for(j=1;j<dn-1;j++)
    v[j][3*u-2]=g[j+1][3*u-2];v[j][3*u-1]=g[j+1][3*u-1];v[j][3*u]=g[j+1][3*u];}
    //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    void conv(float l[],float k[][25],float h[],int u){
    int register i,j;
    for(i=0;i<=15;i++)
    for(j=1;j<=3;j++){
    if(u%2)
    h[j+i-1]+=l[i]*k[1][j+3*(u-1)];
    else
    h[j+i-1]-=l[i]*k[1][j+3*(u-1)];}}
    //************************/\/\/\/\/\/\/\/\/\/\/\/\**************************//
    //               END OF PROGRAM               //
    //               HOSSEIN PAIMARD               //
    //             THURSDAY. APRIL 29-2005             //
    //          improve sauterday. january 28-2006          //
    //             PLUSKID2000 @ YAHOO.COM             //
    //*************************/\/\/\/\/\/\/\/\/\/\/\/**************************//
    we are here,it must be done
  9. #9
    2006/10/28
    esfahan
    79
    0

    پاسخ : برنامه های توپ برای طرفداران C

    :biggrin:سلام
    برنامه ششم
    محاسبه دترمینان یک ماتریس عددی :eek:
    زیبایی این برنامه در تکنیک پیاده سازیش است
    الگوریتم محاسباتی این برنامه محاسبه دترمینان از طریق فاکتور سطر وستون هست ودر این برنامه روش با زگشتی به کار رفته

    کد:
    #include<stdio.h>
    #include<conio.h>
    const volatile max=15;
    int  read(float[][max]);
    float prog(float[][max],float[][max],int);
    void  compute1(float[][max],float[][max],int);
    float compute2(float[][max],float[][max],float[][max],float,int,int);
    void  main(){float num[max][max],g[max][max]={0},y;int dn,u;
        int register i,j;
    	dn=read(num);
    	compute1(num,g,dn+1);
    	y=prog(num,g,dn);
    	clrscr();
    	printf("\n\n\n\n");
    	for(i=1;i<=dn;i++){
    	printf("\n");
    	for(j=1;j<=dn;j++)
    	printf("%8.2f",*(*(num+i)+j));}
    	printf("\n\n\n\tعؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤ؟");
    	printf("\n\t³ determinan of matrix= %12.3f ³ ",y);
    	printf("\n\tہؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤؤظ");
    	getch();}
    //****************************************************************************
    int read(float num[][max]){
    int dn;int register i,j;clrscr();
    printf("\nenter degree of matrix:");
    scanf("%d",&dn);
    clrscr();
    for(i=1;i<=dn;i++){
    printf("\n\n\nenter arguments of row[%d]:\n\n",i);
    for(j=1;j<=dn;j++)
    scanf("%f",*(num+i)+j);}return dn;}
    //****************************************************************************
    //****************************************************************************
    float prog(float num[][max],float g[][max],int dn){
    int register u;float v[max][max],d,y=0;
    for(u=1;u<=dn;u++){
    compute1(g,v,dn);
    if(dn-2)
    d=prog(g,v,dn-1);
    else
    d=g[1][1];
    y+=compute2(num,g,v,d,dn,u);}
    return y;}
    //****************************************************************************
    //****************************************************************************
    void compute1(float g[][max],float v[][max],int dn){
    int register i,j;
    for(i=1;i<dn-1;i++)
    for(j=1;j<dn-1;j++)
    v[j][i]=g[j+1][i+1]; }
    //****************************************************************************
    float compute2(float num[][max],float g[][max],float v[][max],float d,int dn,int u)
    {float y=0;int register j;
    if(u%2)
    y+=d*num[1][u];
    else
    y-=d*num[1][u];
    for(j=1;j<dn;j++)
    v[j-1][u]=g[j][u]=num[j+1][u];
    return y;}
    //************************\/\/\/\/\/\/\/\/\/\/\/\/**************************//
    //              END OF PROGRAM                //
    //              HOSSEIN PAIMARD                //
    //            theursday. january 26-2006              //
    //            PLUSKID2000 @ YAHOO.COM              //
    //************************/\/\/\/\/\/\/\/\/\/\/\/***************************//
    we are here,it must be done
  10. #10
    2006/10/28
    esfahan
    79
    0

    پاسخ : برنامه های توپ برای طرفداران C

    برنامه هفتم
    سیستم ثبت نام دانشجویی با فایل
    help:برای ورود اطلاعات به اندازه خط تیره های زیر هر مشخصه باید رقم یا حرف وارد کنید و برای پایان ورودی باید مشخصه اول سطر جدید را .(نقطه) قرار دهید

    کد:
    #include<conio.h>
    #include<stdio.h>
    #include<ctype.h>
    #include<string.h>
    #include<stdlib.h>
    int menu1(void),menu2(void),menu3(void);
    void stuinf(void),load(),save(),masinf(void),reset(void);
    void lesinf(void),regist(void),display(void);
    #define size 30
    int main(){
    while(1){
    switch(menu1()){
       case 'l': lesinf();  break;
       case 's': stuinf();  break;
       case 'm': masinf();  break;
       case 'd':display();  break;
       case 'e': reset();  break;
       case 'r': regist();  break;
       case 'q':exit(1);}}return 0;}
    //////////////////////////////////////////////////////////////////////////////
    void regist(void){
    FILE *l,*m,*s,*r;int i=0,w,j,row=5,sum,p=0,k;float m1;char h[10],j1;
    struct reg{char stu1[12],les1[8],mas1[5];int day;char hour[6];}list[size];
    struct lesson{char code[8];char name[30];int degree;}list1[size];
    struct master{char code[5];char name[30];}list2[size];
    struct student{char code[12];char name[30];char course[20];float mid;}list3[size];
    for(i=0;i<size;i++){
    if(*list[i].stu1)
    *(list[i].stu1)='\0';}
    r=fopen("d:\maste","a+");
    if(!r){
    printf("\ncannot open file...");
    getch();
    return;}
    for(i=0;i<size;i++){
    fread(&list[i],sizeof(struct reg),1,r);
    if(!*(list[i].stu1))break;}
    if(i==size){
    printf("\n list is full.press a key...");
    getch();
    return;}
    clrscr();
    m=fopen("d:\master","r");
    if(!m){
    printf("\ncannot open file...");
    getch();
    return;}
    l=fopen("d:\lesson","r");
    if(!l){
    printf("\ncannot open file...");
    getch();
    return;}
    s=fopen("d:\student","r");
    if(!s){
    printf("\ncannot open file...");
    getch();
    return;}
    gotoxy(35,2);
    puts("<< INPUT DATE >>");
    gotoxy(1,3);
    printf("  c.student    c.lesson     c.master    day   hour");
    gotoxy(1,4);puts("-- --------    -------      ----      -    -----");
    
    for(;;){
    gotoxy(1,row);
    printf("%d",i+1);
     loop:
    gotoxy(5,row);
    gets(list[i].stu1);
    p=0;
    for(j=0;j<i;j++){
    if(strcmp(list[j].stu1,list[i].stu1))
    p++;else p=0;}
    if(!strcmp(list[i].stu1,"........")){fcloseall();break;}
    if(p<i){
    gotoxy(5,row);puts("impossible");getchar();gotoxy(5,row);puts("     ");
    goto loop;}
    m1=0;
    rewind(s);
    for(j=0;!feof(s);j++){
    fread(&list3[j],sizeof(struct student),1,s);
    if(strcmp(list[i].stu1,list3[j].code))
    p++;
    else{p=0;m1=list3[j].mid;}}
    if(m1==0){
    gotoxy(5,row);puts("not exist");getchar();gotoxy(5,row);puts("      ");
    goto loop;}
    sum=0;
    if(m1<12)w=14;
    else w=20;
    while(sum<w){
    loop1:
    gotoxy(21,row);
    gets(list[i].les1);
    p=0;rewind(l);
    for(j=0;j<size;j++){
    fread(&list1[j],sizeof(struct lesson),1,l);
    if(*list1[j].code){
    if(!strcmp(list[i].les1,list1[j].code)){
    p=1;
    sum+=list1[j].degree;
    k=j;}
    else;}else break;}
    if(p!=1){
    gotoxy(21,row);puts("not exist");getchar();gotoxy(21,row);puts("     ");
    goto loop1;}
    if(sum>w){
    sum-=list1[k].degree;
    if(sum>=12){
    gotoxy(20,25);printf("your degree is higher than (%d)",w);
    gotoxy(20,26);printf("would you like exit:");j1=getch();
    gotoxy(20,25);printf("                  ");
    gotoxy(20,26);printf("                  ");
    if(j1=='y')break;
    else{
    gotoxy(20,26);printf("so enter a new number again....   ");getch();
    gotoxy(20,26);printf("                  ");
    gotoxy(21,row);puts("    ");
    goto loop1;}}else{gotoxy(20,25);printf("you don't allow.          ");
    gotoxy(20,26);printf("enter a number again...      ");getch();
    gotoxy(21,row);
    puts("    ");
    gotoxy(20,25);printf("                  ");
    gotoxy(20,26);printf("                  ");
    goto loop1;}}
    loop2:
    gotoxy(39,row);gets(list[i].mas1);p=0;rewind(m);
    for(j=0;j<size;j++){fread(&list2[j],sizeof(struct master),1,m);
    if(*list2[j].code){
    if(!strcmp(list[i].mas1,list2[j].code))p=1;
    else;}else break;}
    if(p!=1){
    gotoxy(39,row);puts("not exist");getchar();gotoxy(39,row);puts("     ");
    goto loop2;}
    gotoxy(55,row);gets(h);list[i].day=atoi(h);
    gotoxy(63,row);gets(list[i].hour);
    fwrite(&list[i],sizeof(struct reg),1,r);row++;i++;
    j1=0;
    if(sum>=12){
    gotoxy(20,25);printf("your degree is (%d)      ",sum);
    gotoxy(20,26);printf("would you like exit:");j1=getch();
    gotoxy(20,25);printf("                  ");
    gotoxy(20,26);printf("                  ");
    if(j1=='y')
    break;
    else{
    gotoxy(15,26);printf("maybe you'v been allowed to enter next number...");getch();
    gotoxy(15,26);printf("                          ");
    if(sum==w){
    gotoxy(15,26);printf("sorry.you haven't allowed... ");
    gotoxy(15,27);printf("you must have been entered next student' number....");getch();
    gotoxy(15,26);printf("                          ");
    gotoxy(15,27);printf("                          ");
    }}}
    strcpy(list[i].stu1,list[i-1].stu1);}}}
    /////////////////////////////////////////////////////////////////////////////
    void stuinf(void){
    FILE *fpl;
    int row=5,j,p,i;char s[12];
    struct stt{char code[12];char name[30];char course[20];float mid;}list[size];
    for(i=0;i<size;i++){
    if(*list[i].code)
    *(list[i].code)='\0';
    (list[i].mid)=0;}
    fpl=fopen("d:\student","a+");
    for(i=0;i<size;i++){
    fread(&list[i],sizeof(struct stt),1,fpl);
    if(!*list[i].code)
    break;}
    if(i==size){
    printf("\n list is full.press a key...");
    getch();
    return;}
    clrscr();
    gotoxy(40,2);puts("<< INPUT DATE >>");
    gotoxy(1,3);printf("  code    name      field      average");
    gotoxy(1,4);puts("-- --------  -----------   ----------    -----");
    for(;;){
    gotoxy(1,row);printf("%d",i+1);
    loop:
    gotoxy(5,row);gets(list[i].code);p=0;
    for(j=0;j<i;j++){
    if(strcmp(list[j].code,list[i].code))p++;else p=0;}
    if(!strcmp(list[i].code,"........")){fclose(fpl);break;}
    if(p<i){
    gotoxy(5,row);puts(" exist  ");getchar();gotoxy(5,row);puts("     ");
    goto loop;}
    gotoxy(17,row);gets(list[i].name);
    gotoxy(33,row);gets(list[i].course);
    gotoxy(50,row);gets(s);list[i].mid=atof(s);
    fwrite(&list[i],sizeof(struct stt),1,fpl);
    row++;i++;}}
    ///////////////////////////////////////////////////////////////////////////////////
    void masinf(void){
    struct mas{char code[5];char name[30];}list[size];
    FILE *fpl;int row=5,j,p=0,i;
    for(i=0;i<size;i++){
    if(*list[i].code)
    *(list[i].code)='\0';}
    fpl=fopen("d:\master","a+");
    if(!fpl){
    printf("\ncannot open file...");
    getch();
    return;}
    for(i=0;i<size;i++){
    fread(&list[i],sizeof(struct mas),1,fpl);
    if(!*list[i].code)
    break;}
    if(i==size){
    printf("\n list is full.press a key...");
    getch();
    return;}
    clrscr();
    gotoxy(40,2);puts("<< INPUT DATE >>");
    gotoxy(1,3);printf("  code      name ");
    gotoxy(1,4);puts("-- ----      -------------- ");
    for(;;){
    gotoxy(1,row);printf("%d",i+1);
    loop:
    gotoxy(5,row);gets(list[i].code);p=0;
    for(j=0;j<i;j++){
    if(strcmp(list[j].code,list[i].code))p++;else p=0;}
    if(!strcmp(list[i].code,"....")){fclose(fpl);break;}
    if(p<i){
    gotoxy(5,row);puts("exist ");getchar();gotoxy(5,row);puts("    ");
    goto loop;}
    gotoxy(20,row);gets(list[i].name);
    fwrite(&list[i],sizeof(struct mas),1,fpl);
    row++;i++;}}
    //////////////////////////////////////////////////////////////////////////////
    void lesinf(void){
    FILE *fpl;int row=5,j,p=0,i;char s[10];
    struct lesson{char code[8];char name[30];int degree;}list[size];
    for(i=0;i<size;i++){
    if(*list[i].code)
    *(list[i].code)='\0';}
    fpl=fopen("d:\lesson","a+");
    for(i=0;i<size;i++){
    fread(&list[i],sizeof(struct lesson),1,fpl);
    if(!*list[i].code)
    break;}
    if(i==size){
    printf("\n list is full.press a key...");
    getch();
    return;}
    clrscr();
    gotoxy(40,2);puts("<< INPUT DATE >>");
    gotoxy(1,3);printf("  code       name            degree");
    gotoxy(1,4);puts("-- -------      ---------------------   ---------------");
    for(;;){
    gotoxy(1,row);printf("%d",i+1);
    loop:
    gotoxy(5,row);gets(list[i].code);p=0;
    for(j=0;j<i;j++){
    if(strcmp(list[j].code,list[i].code))p++;else p=0;}
    if(!strcmp(list[i].code,".......")){fclose(fpl);break;}
    if(p<i){
    gotoxy(5,row);puts(" exist  ");getchar();gotoxy(5,row);puts("     ");
    goto loop;}
    gotoxy(23,row);gets(list[i].name);
    gotoxy(50,row);gets(s);list[i].degree=atoi(s);
    fwrite(&list[i],sizeof(struct lesson),1,fpl);
    row++;i++;}}
    /////////////////////////////////////////////////////////////////////////////////
    int menu1(void){char s[10];clrscr();
    do{
    gotoxy(20,4);printf("L)enter lesson:");
    gotoxy(20,6);printf("S)enter student:");
    gotoxy(20,8);printf("M)enter master:");
    gotoxy(20,10);printf("R)register:");
    gotoxy(20,12);printf("D)display:");
    gotoxy(20,14);printf("E)reset:");
    gotoxy(20,16);printf("q)quit:");
    gotoxy(20,18);printf("enter your select:");gets(s);
    }while(!strchr("lmesqdr",tolower(*s)));return tolower(*s);}
    ///////////////////////////////////////////////////////////////////////////////
    int menu2(void){char s[10];clrscr();
    do{
    gotoxy(20,4);printf("L)display lesson:");
    gotoxy(20,6);printf("S)display student:");
    gotoxy(20,8);printf("M)display master:");
    gotoxy(20,10);printf("R)display register:");
    gotoxy(20,12);printf("q)quit:");
    gotoxy(20,16);printf("inter your select:");gets(s);
    }while(!strchr("lmsqr",tolower(*s)));return tolower(*s);}
    ////////////////////////////////////////////////////////////////////////////////
    int menu3(void){char s[10];clrscr();
    do{
    gotoxy(20,4);printf("L)reset information of lesson:");
    gotoxy(20,6);printf("S)reset information of student:");
    gotoxy(20,8);printf("M)reset information of master:");
    gotoxy(20,10);printf("R)reset information of register:");
    gotoxy(20,12);printf("q)quit:");
    gotoxy(20,16);printf("inter your select:");gets(s);
    }while(!strchr("lmsqr",tolower(*s)));return tolower(*s);}
    //////////////////////////////////////////////////////////////////////////////
    void reset(){char p,o;
    while(1){loop:o=menu3();
    if(o!='q'){gotoxy(26,18);printf("Are You Sure To Delete?");p=getch();
    if(p!='y')goto loop;}gotoxy(30,20);
    switch(o){
    case 'l':
    if(remove("d:\lesson"))printf("cannot delete...");
    else printf("delete successfully...");break;
    case 's':
    if(remove("d:\student"))printf("cannot delete...");
    else printf("delete successfully...");break;
    case 'm':
    if(remove("d:\master"))printf("cannot delete...");
    else printf("delete successfully...");break;
    case 'r':
    if(remove("d:\maste"))printf("cannot delete...");
    else printf("delete successfully...");break;
    case'q':return;}fcloseall();getch();}}
    //////////////////////////////////////////////////////////////////////////////
    void display(void){
    FILE *f;char dn;int i,row=5;
    struct lesson{char code[8];char name[30];int degree;}list[size];
    struct master{char code[5];char name[30];}list1[size];
    struct stud{char code[12];char name[30];char course[20];float mid;}list2[size];
    struct regist{char student[12],lesson[8],master[5];int day;char hour[6];}list3[size];
    fcloseall();
      while(1){
    	 dn=menu2();clrscr();gotoxy(26,2);puts("----output data----");
    	 switch(dn){
    	  case 'l':f=fopen("d:\lesson","r");
    	if(!f){
    	 printf("\ncannot open file...");
    	 getch();
    	 return;}
    	rewind(f);row=6;
    	 printf("\n  code      name           degree\n  -------    ---------------     ------");
    	 for(i=0;i<size;i++){
    	 fread(&list[i],sizeof(struct lesson),1,f);
    	 if(feof(f))break;
    	 if(*list[i].code){
    	 gotoxy(1,row );printf("%d",i+1);
    	 gotoxy(5,row );printf("%s",list[i].code);
    	 gotoxy(20,row);printf("%s",list[i].name);
    	 gotoxy(45,row);printf("%d",list[i].degree);}row++;}
    	 fclose(f);break;
    
    	 case 's':f=fopen("d:\student","r");
    	if(!f){
    	 printf("\ncannot open file...");
    	 getch();
    	 return;}
    	rewind(f);row=6;
    	 printf("\n  code      name      course     middle\n  -------    ------------- ----------   ------");
    	 for(i=0;i<size;i++){
    	 fread(&list2[i],sizeof(struct stud),1,f);
    	 if(feof(f))break;
    	 if(*list2[i].code){
    	 gotoxy(1,row );printf("%d",i+1);
    	 gotoxy(5,row );printf("%s",list2[i].code);
    	 gotoxy(20,row);printf("%s",list2[i].name);
    	 gotoxy(35,row);printf("%s",list2[i].course);
    	 gotoxy(50,row);printf("%f",list2[i].mid);
    	 }row++;}fclose(f);break;
    
    	 case 'm':f=fopen("d:\master","r");
    		if(!f){
       printf("\ncannot open file...");
       getch();
       return;}
    	rewind(f);
    	row=6;
       printf("\n   code     name  \n--  ----     ------------");
       for(i=0;i<size;i++){
       fread(&list1[i],sizeof(struct master),1,f);
       if(feof(f))break;
       if(*list1[i].code){
       gotoxy(1,row );printf("%d",i+1);
       gotoxy(7,row );printf("%s",list1[i].code);
       gotoxy(20,row);printf("%s",list1[i].name);}row++;}
       fclose(f);break;
    
    	 case 'r':f=fopen("d:\maste","r");
    	rewind(f);row=5;
       gotoxy(1,3);
       printf("  c.student    c.lesson     c.master    day   hour");
       gotoxy(1,4);
       puts("-- --------    -------      ----      -    -----");
       for(i=0;i<size;i++){
       fread(&list3[i],sizeof(struct regist),1,f);
       if(feof(f))break;
       if(*list3[i].student){
       gotoxy(1,row );printf("%d",i+1);
       gotoxy(5,row );printf("%s",list3[i].student);
       gotoxy(21,row);printf("%s",list3[i].lesson);
       gotoxy(39,row );printf("%s",list3[i].master);
       gotoxy(55,row);printf("%d",list3[i].day);
       gotoxy(63,row );printf("%s",list3[i].hour);
       }row++;}fclose(f);break;
       case 'q':return;}
       getch();
       }}
    //////////////////////////////////////////////////////////////////////////////
    we are here,it must be done
صفحه 1 از 3 123 آخرین
نمایش نتایج: از 1 به 10 از 30

موضوعات مشابه

  1. پاسخ: 38
    آخرين نوشته: 2016/03/24, 20:09
  2. برنامه نویسی یک برنامه ساده برای اندروید
    توسط alidehghan288 در انجمن موبايل
    پاسخ: 3
    آخرين نوشته: 2015/08/14, 18:21
  3. پاسخ: 0
    آخرين نوشته: 2014/03/07, 12:35
  4. فاجعه برای ویندوز ( مخصوص طرفداران ویندوز)
    توسط فرشاد اکرمی در انجمن نرم افزار
    پاسخ: 5
    آخرين نوشته: 2012/03/20, 21:57
  5. پاسخ: 2
    آخرين نوشته: 2007/12/06, 22:47

کلمات کلیدی این موضوع

علاقه مندي ها (Bookmarks)

علاقه مندي ها (Bookmarks)

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •