Parsi Coders
سورس های ++C - نسخه قابل چاپ

+- Parsi Coders (http://parsicoders.com)
+-- انجمن: Software Development Programming (http://parsicoders.com/forumdisplay.php?fid=37)
+--- انجمن: C and C++ (http://parsicoders.com/forumdisplay.php?fid=54)
+--- موضوع: سورس های ++C (/showthread.php?tid=1851)



سورس های ++C - Ghoghnus - 02-25-2012

ساعت Clock
کد:
#include <iostream.h>
#include <conio.h>
#include <dos.h>
#include <math.h>
#include <graphics.h>
void clock_(int x,int y,int r,int c,int b);
void setgraph (void);
void main()
**
    clrscr();
    setgraph();
    while(!kbhit())
    **
       clock_(getmaxx()/2,getmaxy()/2,100,BLUE,WHITE);

    }
}
void setgraph (void)
**
   int gd=DETECT, gm;
   initgraph (&gd,&gm,"..\\bgi");
}
void clock_(int x,int y,int r,int c,int b)
**
   struct  dostime_t t;
   double p=3.1415;
   setcolor(b);
   setlinestyle(0,0,3);
   circle(x,y,r);
   settextstyle(2,0,4);
   outtextxy(x-5,y-r+1,"12");
   outtextxy(x-3,y+r-13,"6");
   outtextxy(x+r-10,y-5,"3");
   outtextxy(x-r+5,y-5,"9");
   _dos_gettime(&t);
   setcolor(c);
   setlinestyle(1,0,1);
   setfillstyle(1,c);
   pieslice(x,y,0,360,r-11);
   setcolor(b-2);
   line(x,y,x+(r-25)*(cos((t.hour*6-90)*p/180)),y+(r-25)*sin((t.hour*6-90)*p/180));
   line(x,y,x+(r-16)*(cos((t.minute*6-90)*p/180)),y+(r-16)*sin((t.minute*6-90)*p/180));
   setcolor(b);
   setlinestyle(0,0,1);
   line(x-(10)*(cos((t.second*6-90)*p/180)),y-(10)*sin((t.second*6-90)*p/180),x+(r-12)*(cos((t.second*6-90)*p/180)),y+(r-12)*sin((t.second*6-90)*p/180));

   char s[10];
   setcolor(11);
   circle(x,y,2);
}





RE: سورس های ++C - Ghoghnus - 02-25-2012

بزرگترين مقسوم عليه مشترک دو عدد به صورت بازگشتي
کد:
#include <conio.h>
#include <iostream.h>
int gcd(int,int);
int main()
**
int x,y;
cout<<"enter amount for x and y:";
cin>>x>>y;
int k=gcd(x,y);
cout<<k;
getch();
return 0;
}
int gcd(int x,int y)
**
if(y==0)
  return x;
else
  return gcd(y,x&y);
}



RE: سورس های ++C - Ghoghnus - 02-26-2012

کتابخانه با امکان ورود - ويرايش- حذف -به امانت گرفتن و پس دادن کتاب
کد:
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>

//===========================
//===========================
class book
**
friend class library;

private:
    char book_name[11];
    char explain[51];
    char aouther[11];
    char part;

    char user[11];    
    int reserved;

    book *next;

public:
        book();
    void edit();
    void reserv();
    void getback();
}
//---------------------------
    book::book()
    **
    clrscr();

    cout<<"============ add a new book =================="
        <<"\n\nto insert new book ,enter flow informations:"
        <<"\n\nbook name?";
    gets(book_name);
    book_name[10]=NULL;

    cout<<"\naouther name?";
    gets(aouther);
    aouther[10]=NULL;

    cout<<"\nany explain?";
    gets(explain);
    explain[50]=NULL;

    part=book_name[0];

    reserved=0;

    next=NULL;

    cout<<"\n\ninformathions set!";
    getch();
    }
//---------------------------
void book::edit()
    **
cout<<"error ";
    }
//---------------------------
void book::reserv()
    **
    clrscr();
    cout<<"\n=========== reserving book ===================";

    if(reserved==0)
       **
        cout<<"\n\nuser name?";
        gets(user);
        user[11]=NULL;

        reserved=1;
       }

    if(reserved==0)
       **
        cout<<"\n\nsorry! book has been reserved befor"
           <<"by user:";
        puts(user);
       }

    getch();
    }
//---------------------------
void book::getback()
    **
    reserved=0;

    cout<<"\n\nbook got bak.";
    getch();
    }
//===========================
//===========================
class library
**
public:
        library();
    void run_menu();

private:
    book *parts[24];
    void insert(book*);
    void find();
    void search();

}
//---------------------------
    library::library()
    **
    for(int i=0;i<=23;i++)
       parts[i]=NULL;

    }
//---------------------------
void library::run_menu()
    **

    char ch='n';

    while(ch!='4')
       **
        clrscr();

        cout<<"================= LIBRARY =================="
           <<"\n\n1:add a new book."
           <<"\n2:find a book."
           <<"\n3:search a book."
           <<"\n4:exit."
           <<"press numbers:";


        ch=getch();


        if(ch=='1')
          **
           book *n=new book;
           insert(n);
          }
        if(ch=='2')
          **
           find();
          }
        if(ch=='3')
          **
           search();
          }

       }//while
    }
//---------------------------
void library::insert(book *s)
    **
    int d=s->part-97;

    if(parts[d]==NULL)
       **
        parts[d]=s;
       }
    else
       **
        book *p=parts[d],*q;
        while(p!=NULL && strcmp(p->book_name,s->book_name)<0)
          **
           q=p;
           p=p->next;
          }
        q->next=s;
        s->next=p;
       }

    }
//---------------------------
void library::find()
    **
    clrscr();

    cout<<"=========== edit / delete books ============"
        <<"\nenter exact book name:";
    char name[11];
    gets(name);
    name[11]=NULL;
    int d=name[0]-97;

    book *p=parts[d],*q;
    while(p!=NULL && strcmp(p->book_name,name)!=0)
       **
        q=p;
        p=p->next;
       }
    if(p==NULL)
       **
        cout<<"not found!";
       }
    if(p!=NULL)
       **
        cout<<"\n\ndelete it?('d')  or edit?('e')"
           <<"  or reserv?('r')   or getback?('g') :";
        char ch=getch();
        if(ch=='d')
           **
            q->next=p->next;
            delete p;
           }
        if(ch=='e')
           **
            p->edit();
           }
        if(ch=='r')
           **
            p->reserv();
           }
        if(ch=='g')
          **
           p->getback();
          }
       }
    getch();
    }
//---------------------------
void library::search()
    **
    char ch='6';

    while(ch!='4')
       **
        clrscr();
        cout<<"================== SEARCH ===================";
        cout<<"\n\n1:search for name."
           <<"\n2:search for aouther."
           <<"\n3:search for explanations."
           <<"\n4:back to main menu.(press numbers)";

        ch=getch();

        if(ch=='1')
          **
           cout<<"\n\nenter exact name:";
           char name[10];
           gets(name);
           name[11]=NULL;

           int d=name[0]-97;
           book *p=parts[d];
           while(p!=NULL && strcmp(p->book_name,name)!=0)
             **
              p=p->next;
             }
           if(p==NULL)
             **
              cout<<"\nnot founded!";
             }
           else
             **
              cout<<"\n\n";
              cout<<"name:";puts(p->book_name);
              cout<<"aouther:";puts(p->aouther);
              cout<<"explain:";puts(p->explain);
              if(p->reserved==1)
                **
                 cout<<"RESERVED by:";
                 puts(p->user);
                }
              else
                **
                 cout<<"NOT RESERVES";
                }
             }//else
           getch();
          }//1
        if(ch=='2')
          **
           cout<<"\n\nenter exact aouther name:";
           char name[11];
           gets(name);
           name[11]=NULL;
           int f=0;

           for(int i=0;i<=23;i++)
            **
             book *p=parts[i];
             while(p!=NULL)
             **
              if(strcmp(p->aouther,name)==0)
                **
                 f++;
                 cout<<"\n"<<f<<":";
                 cout<<"name:";puts(p->book_name);
                 cout<<"aouthor:";puts(p->aouther);
                 cout<<"explain:";puts(p->explain);
                 if(p->reserved==1)
                    **
                    cout<<"RESERVED BY";
                    puts(p->user);
                    }
                 else
                    **
                    cout<<"NOT RESERVED";
                    }
                }

              p=p->next;
             }//while
            }
           getch();
          }//2
        if(ch=='3')
          **
           cout<<"\n\nenter key(15char):";
           char name[16];
           gets(name);
           name[15]=NULL;
           int f=0;

           for(int i=0;i<=23;i++)
            **
             book *p=parts[i];
             while(p!=NULL)
             **
              char *tokenptr;
              tokenptr=strtok(p->explain," ");
              while(tokenptr!=NULL)
                **
                 if(strcmp(tokenptr,name)==0)
                    **
                    f++;

                    cout<<"\n"<<f<<":";
                    cout<<"name:";puts(p->book_name);
                    cout<<"aouthor:";puts(p->aouther);
                    cout<<"explain:";puts(p->explain);
                    if(p->reserved==1)
                        **
                        cout<<"RESERVED BY";
                        puts(p->user);
                        }
                    else
                        **
                        cout<<"NOT RESERVED";
                        }
                    }
                 tokenptr=strtok(NULL," ");
                }

              p=p->next;
             }//while
            }//for i
           getch();
          }//3

       }

    }
//===========================
//===========================
int main()
    **
    clrscr();

    library l1;
    l1.run_menu();

    return(0);
    }



RE: سورس های ++C - sh13h - 06-22-2012

سلام دوستان یه پروژه دارم


1.
صفحه Splash
form


2.
Login با استفاده از
دیتا بیس داشته باشد


3.
فرم اصلی


4.
منو داشته باشد


5.
قابلیت خواندن فایل اکسل داشته باشد


6.
تاریخ شمسی


7.
ماشین حساب


8.
اضافه کردن و حذف کاربر از بانک اطلاعاتی


9.
مبدل تاریخ میلادی – شمسی – هجری قمری


من فقط 2 5 8 رو میخوام غیب داشتم اصلا نمیدونم چی به چی هستش ممنون میشم کمکم کنید مرسی.


RE: سورس های ++C - Amin_Mansouri - 06-22-2012

درود
سورس کد خواندن و نوشتن در فایل اکسل (سی پلاس پلاس)
download:

.zip   excel-ado(www.parsicoders.com).zip (اندازه 7.11 KB / تعداد دانلود: 11)


RE: سورس های ++C - Kei armin - 06-22-2012

5 رو که امین جواب داد ...



این هم دو سورس در زمینه کار با دیتابیس های Access و SQL !



رمز :

کد:
www.parsicoders.com




.rar   connect to database.rar (اندازه 377.76 KB / تعداد دانلود: 14)


RE: سورس های ++C - امیر - 07-12-2012

درود:
این یک انیمیشن که من عاشقشم خیلی قشنگه حتما ببینین (حرکت ماهی ها )
کد:
// Created Amir

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

using namespace std;

void gotoxy(int x, int y){
  COORD coord;
  coord.X = x;
  coord.Y = y;
  SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}

void loading() {

system("cls");
cout << "Loading.";
Sleep(1000);
system("cls");
cout << "Loading..";
Sleep(1000);
system("cls");
cout << "Loading...";
Sleep(1000);
system("cls");
cout << "Loading....";
Sleep(1000);
system("cls");
cout << "Loading.....";
Sleep(1000);
system("cls");
Sleep(1000);;
cout << "Loading......";
system("cls");

}

int main() {

    system("cls");
    loading();
    system("cls");
    gotoxy(16,1); cout << "FISH ANIMATION 1.0";
      gotoxy(5,2); cout << "By: Mr. Jake Rodriguez Pomperada, MAED-IT";

    for(int a =1; a<50; a=a+2){
        gotoxy(a,3);
        cout << "~^";
    }

    for(int a =1; a<20; a++){
        gotoxy(49,a);
        cout << "||";
    }
    for(int a =48; a>0; a--){

        gotoxy(a,19);
        cout << "=";
    }

    for(int a = 19; a>0; a--){

        gotoxy(0,a);
        cout << "||";
    }

    int time=0;
    while(time <= 10){

    for(int a =3; a<40; a++){


        Sleep(100);
        gotoxy(a,6);
        cout << "   __";
        gotoxy(a,7);
        cout << " \\/ o\\";
        gotoxy(a,8);
        cout << " /\\__/";
        gotoxy(a,9);
        cout << "     ";

        gotoxy(45-a-2,13);
        cout << "   ,    ";
        gotoxy(45-a-2,14);
        cout << " <' (=< ";
        gotoxy(45-a-2,15);
        cout << "   '    ";
        gotoxy(45-a-2,16);
        cout << "        ";


    }

    for(int a =40; a>3; a--){
        Sleep(100);
        gotoxy(a,6);
        cout << "  __     ";
        gotoxy(a,7);
        cout << " /o \\/  ";
        gotoxy(a,8);
        cout << " \\__/\\ ";
        gotoxy(a,9);
        cout << "         ";

        gotoxy(3+40-a,13);
        cout << "    '   ";
        gotoxy(3+40-a,14);
        cout << " >=) '> ";
        gotoxy(3+40-a,15);
        cout << "    '   ";
        gotoxy(3+40-a,16);
        cout << "        ";
    }
    time++;
    }

    getch();
    system("cls");
return 0;
}