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





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









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





صفحه 4 از 10 نخست 1234567 ... آخرین
نمایش نتایج: از 31 به 40 از 92
  1. #31
    programer
    كاربر عادي
    http://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gif
    تاریخ عضویت
    2011 Dec
    نوشته ها
    62
    1
    10
    سورس کد پرطرفدار ؛ساعت
    کد:
    #include<stdio.h>
    #include<conio.h>
    #include<graphics.h>
    #include<stdlib.h>
    #include<math.h>
    #include<dos.h>
    #include<time.h>
    void sline(int,int,int,int,int,int,float,int,int);
    void hline(int,int,int,int,int,int,float,int,int);
    void mline(int,int,int,int,int,int,float,int,int);
    void grid(int,int,int,int);
    void main()
    {
     int gd=DETECT,gm,maxx,maxy,midx,midy;
     int sincolor=4,soutcolor=0,hincolor=1,houtcolor=0,mincolor=13,moutcolor=0;
     int bakcolor=14;
     int gcolor=0,grad=3;
     float thita,X,Y,h,s,m;
     initgraph(&gd,&gm,"c:\\tc\\bgi");
     maxx=getmaxx();
     maxy=getmaxy();
     midx=maxx/2;
     midy=maxy/2;
     float phi=3.1423,degree,dh,dm;
     int rad=125;
     int HX,HY,MX,MY,SX,SY,ML=rad-25,SL=rad-20,HL=rad-55;
     char str[10];
     cleardevice();
      setfillstyle(1,bakcolor);
     circle(midx,midy,rad-10);
     floodfill(midx,midy,15);
      setfillstyle(1,1);
     circle(midx,midy,rad+10);
     floodfill(midx+rad+5,midy,15);
     for(thita=270+45;thita<=360+135;thita=thita+(180/60))
     {
       degree=((2*phi)/180)*thita;
       X=midx+rad*(cos(degree));
       Y=midy+rad*(sin(degree));
       itoa(degree,str,10);
       setfillstyle(1,4);
       circle(X,Y,1);
       floodfill(X,Y,15);
     }
      for(thita=270+45;thita<=360+135;thita=thita+(180/12))
      {
       degree=((2*phi)/180)*thita;
       X=midx+rad*(cos(degree));
       Y=midy+rad*(sin(degree));
       setfillstyle(1,4);
       circle(X,Y,3);
       floodfill(X,Y,15);
      }
      struct time t;
      gettime(&t);
       s=270+45+t.ti_sec*(180/60);
       h=270+45+t.ti_hour*(180/12)+((t.ti_min*(180/60)))/12;
       m=270+45+t.ti_min*(180/60)+((t.ti_sec*(180/60))/60);
       degree=((2*phi)/180)*s;
       dh=((2*phi)/180)*h;
       dm=((2*phi)/180)*m;
       SX=midx+SL*(cos(degree));
       SY=midy+SL*(sin(degree));
       HX=midx+HL*(cos(dh));
       HY=midy+HL*(sin(dh));
       MX=midx+ML*(cos(dm));
       MY=midy+ML*(sin(dm));
      while(!kbhit())
      {
       grid(midx,midy,grad,gcolor);
       sline(midx,midy,SX,SY,bakcolor,bakcolor,degree,rad,SL);
       circle(SX,SY,2);
       hline(midx,midy,HX,HY,bakcolor,bakcolor,dh,rad,HL);
       mline(midx,midy,MX,MY,bakcolor,bakcolor,dm,rad,ML);
       gettime(&t);
       if(t.ti_sec==0)
       {
        gotoxy(44,4);
        printf("0 ");
       }
       gotoxy(35,4);
       printf("%d : %d : %d",t.ti_hour,t.ti_min,t.ti_sec);
       s=270+45+t.ti_sec*(180/60);
       h=270+45+t.ti_hour*(180/12)+((t.ti_min*(180/60)))/12;
       m=270+45+t.ti_min*(180/60)+((t.ti_sec*(180/60))/60);
       degree=((2*phi)/180)*s;
       dh=((2*phi)/180)*h;
       dm=((2*phi)/180)*m;
       SX=midx+SL*(cos(degree));
       SY=midy+SL*(sin(degree));
       HX=midx+HL*(cos(dh));
       HY=midy+HL*(sin(dh));
       MX=midx+ML*(cos(dm));
       MY=midy+ML*(sin(dm));
       sline(midx,midy,SX,SY,sincolor,soutcolor,degree,rad,SL);
       circle(SX,SY,2);
       hline(midx,midy,HX,HY,hincolor,houtcolor,dh,rad,HL);
       mline(midx,midy,MX,MY,mincolor,moutcolor,dm,rad,ML);
       delay(1000);
      }
     getch();
    }
    void sline(int midx,int midy,int SX,int SY,int incolor,int outcolor,float degree,int rad,int SL)
    {
     int lx,ly,rx,ry,mx,my;
     float phi=3.1423;
     float width=0.04;
     lx=midx+(SL-10)*(cos(degree+width));
     ly=midy+(SL-10)*(sin(degree+width));
     rx=midx+(SL-10)*(cos(degree-width));
     ry=midy+(SL-10)*(sin(degree-width));
     mx=midx+(rad/2)*(cos(degree));
     my=midy+(rad/2)*(sin(degree));
     setcolor(outcolor);
     line(midx,midy,lx,ly);
     line(midx,midy,rx,ry);
     line(lx,ly,SX,SY);
     line(rx,ry,SX,SY);
     setfillstyle(1,incolor);
     floodfill(mx,my,outcolor);
    }
    void mline(int midx,int midy,int SX,int SY,int incolor,int outcolor,float degree,int rad,int ML)
    {
     int lx,ly,rx,ry,mx,my;
     float phi=3.1423;
     float width=0.07;
     lx=midx+(ML-20)*(cos(degree+width));
     ly=midy+(ML-20)*(sin(degree+width));
     rx=midx+(ML-20)*(cos(degree-width));
     ry=midy+(ML-20)*(sin(degree-width));
     mx=midx+(rad/2)*(cos(degree));
     my=midy+(rad/2)*(sin(degree));
     setcolor(outcolor);
     line(midx,midy,lx,ly);
     line(midx,midy,rx,ry);
     line(lx,ly,SX,SY);
     line(rx,ry,SX,SY);
     setfillstyle(1,incolor);
     floodfill(mx,my,outcolor);
     line(midx,midy,SX,SY);
    }
    void hline(int midx,int midy,int SX,int SY,int incolor,int outcolor,float degree,int rad,int HL)
    {
     int lx,ly,rx,ry,mx,my;
     float phi=3.1423;
     float width=0.155;
     lx=midx+(HL-30)*(cos(degree+width));
     ly=midy+(HL-30)*(sin(degree+width));
     rx=midx+(HL-30)*(cos(degree-width));
     ry=midy+(HL-30)*(sin(degree-width));
     mx=midx+(rad/2)*(cos(degree));
     my=midy+(rad/2)*(sin(degree));
     setcolor(outcolor);
     line(midx,midy,lx,ly);
     line(midx,midy,rx,ry);
     line(lx,ly,SX,SY);
     line(rx,ry,SX,SY);
     setfillstyle(1,incolor);
     floodfill(mx,my,outcolor);
     line(midx,midy,SX,SY);
    }
    void grid(int midx,int midy,int grad,int gcolor)
    {
     for(int i=1;i<=grad;i++)
     {
     setcolor(gcolor);
     circle(midx-1,midy+1,i);
     }
     //setfillstyle(1,gcolor);
     //floodfill(midx,midy,15);
    }
  2. #32
    programer
    كاربر عادي
    http://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gif
    تاریخ عضویت
    2011 Dec
    نوشته ها
    62
    1
    10
    نمونه کد،کار کردن با رشته ها و آرایه ها ...
    کد:
    //---------------------------------------------------------------------------
    #ifndef PersonH
    #define PersonH
    
    //---------------------------------------------------------------------------
    class TPerson
    {
    private:
        char* FirstName;
        char* LastName;
        char* Address;
        char* City;
         char* State;
        long  ZIPCode;
    
    public:
        void  setFirstName(const char *FN);
        char* getFirstName() const { return FirstName; }
        void  setLastName(const char *LN);
        char* getLastName() const { return LastName; }
        char* FullName() const;
        void  setAddress(const char *Adr);
        char* getAddress() const { return Address; }
        void  setCity(const char *CT);
        char* getCity() const { return City; }
        void  setState(const char *St);
        char* getState() const { return State; }
        void  setZIPCode(const long ZIP);
        long  getZIPCode() const { return ZIPCode; }
    
        TPerson();
        TPerson(char *FName, char *LName, char *Adr,
                char *Ct, char *St, long  ZIP);
        TPerson(const TPerson &Pers);
        TPerson(char * FName, char * LName);
        virtual ~TPerson();
    };
    //---------------------------------------------------------------------------
    #endif
    
    Source File: Person.cppfont>
    
    //---------------------------------------------------------------------------
    
    #i#include <iostream>
    using namespace std;
    
    #pragma hdrstop
    
    #include "Person.h"
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    
    //---------------------------------------------------------------------------char *__fastcall TPerson::FullName() const
    {
        char *FName = new char[40];
        strcpy(FName, FirstName);
        strcat(FName, " ");
        strcat(FName, LastName);
    
        return FName;
    }
    //---------------------------------------------------------------------------
    __fastcall TPerson::TPerson()
        : ZIPCode(0)
    {
        //TODO: Add your source code here  
        FirstName = new char[20];
        strcpy(FirstName, "John");
        LastName  = new char[20];
        strcpy(LastName, "Doe");
        Address   = new char[40];
        strcpy(Address, "123 Main Street Apt A");
        City      = new char[32];
        strcpy(City, "Great City");
        State     = new char[30];
        strcpy(State, "Our State");
    }
    //---------------------------------------------------------------------------
    __fastcall TPerson::TPerson(char * FName, char * LName)
        : ZIPCode(0)
    {
        //TODO: Add your source code here
        FirstName = new char[strlen(FName) + 1];
        strcpy(FirstName, FName);
        LastName  = new char[strlen(LName) + 1];
        strcpy(LastName, LName);
        Address   = new char[40];
        strcpy(Address, "123 Main Street Apt A");
        City      = new char[32];
        strcpy(City, "Great City");
        State     = new char[30];
        strcpy(State, "Our State");
    } 
    //---------------------------------------------------------------------------
    __fastcall TPerson::TPerson(char *FName, char *LName, char *Adr,
                           char *Ct, char *St, long  ZIP)
        : ZIPCode(ZIP)
    {                          
        //TODO: Add your source code here  
        FirstName = new char[strlen(FName) + 1];
        strcpy(FirstName, FName);
        LastName  = new char[strlen(LName) + 1];
        strcpy(LastName, LName);
        Address   = new char[40];
        strcpy(Address, Adr);
        City      = new char[32];
        strcpy(City, Ct);
        State     = new char[30];
        strcpy(State, St);
    }
    //---------------------------------------------------------------------------
    __fastcall TPerson::TPerson(const TPerson &Pers)
        : ZIPCode(Pers.ZIPCode)
    {              
        //TODO: Add your source code here
        FirstName = new char[strlen(Pers.FirstName) + 1];
        strcpy(FirstName, Pers.FirstName);
        LastName  = new char[strlen(Pers.LastName) + 1];
        strcpy(LastName, Pers.LastName);
        Address   = new char[strlen(Pers.Address) + 1];
        strcpy(Address, Pers.Address);
        City      = new char[strlen(Pers.City) + 1];
        strcpy(City, Pers.City);
        State     = new char[strlen(Pers.State) + 1];
        strcpy(State, Pers.State);
    }
    //---------------------------------------------------------------------------
    void __fastcall TPerson::setFirstName(const char *FN)
    {
        strcpy(FirstName, FN);
    }
    //---------------------------------------------------------------------------
    void __fastcall TPerson::setLastName(const char *LN)
    {
        strcpy(LastName, LN);
    }
    //---------------------------------------------------------------------------
    void __fastcall TPerson::setAddress(const char *Adr)
    {
        strcpy(Address, Adr);
    }
    //---------------------------------------------------------------------------
    void  __fastcall TPerson::setCity(const char *CT)
    {
        strcpy(City, CT);
    }
    //---------------------------------------------------------------------------
    void  __fastcall TPerson::setState(const char *St)
    {
        strcpy(State, St);
    }
    //---------------------------------------------------------------------------
    void  __fastcall TPerson::setZIPCode(const long ZIP)
    {
        ZIPCode = ZIP;
    }
    //---------------------------------------------------------------------------
    __fastcall TPerson::~TPerson()
    {
        //TODO: Add your source code here
        delete [] FirstName;
        delete [] LastName;
        delete [] Address;
        delete [] City;
        delete [] State;
    }
    //---------------------------------------------------------------------------
    
    Main File: Main.cpp
    
    ////---------------------------------------------------------------------------
    #include <iostream>
    using namespace std;
    
    #agma hdrstop
    
    #i#include "Person.h"
    //---------------------------------------------------------------------------
    
    #pragma argsused
    
    TPerson ProcessRegistration();
    void DisplayInformation(const TPerson&);
    //---------------------------------------------------------------------------
    int main(int argc, char* argv[])
    {
        TPerson Employee = ProcessRegistration();
        DisplayInformation(Employee);
    
        return 0;
    }
    //---------------------------------------------------------------------------
    TPerson ProcessRegistration()
    {
        char FName[12], LName[12];
        char Addr[40], CT[32], St[30];
        long ZC;
    
        cout << "Enter personal information\n";
        cout << "First Name: "; cin >> FName;
        cout << "Last Name:  "; cin >> LName;
        cout << "Address:    "; cin >> ws;
        cin.getline(Addr, 40);
        cout << "City:       ";
        cin.getline(CT, 32);
        cout << "State:      ";
        cin.getline(St, 30);
        cout << "Zip Code:   "; cin >> ZC;
    
        TPerson Pers(FName, LName, Addr, CT, St, ZC);
        return Pers;
    }
    //---------------------------------------------------------------------------
    void DisplayInformation(const TPerson& Pers)
    {
        cout << "\nEmployee Identification";
        cout << "\nFull Name: " << Pers.FullName();
        cout << "\nAddress:   " << Pers.getAddress();
        cout << "\nCity:      " << Pers.getCity() << ", "
             << Pers.getState() << " " << Pers.getZIPCode();
    }
    //---------------------------------------------------------------------------
  3. #33
    programer
    كاربر عادي
    http://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gif
    تاریخ عضویت
    2011 Dec
    نوشته ها
    62
    1
    10
    دفتر تلفن ساده
    کد:
    #include <iostream.h>
    #include <conio.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <ctype.h>
    #include <string.h>
     
    //=====================================
    //=====================================
    struct address {
           char name[30] ;
           char street[30] ;
           char city[20] ;
           char state[3] ;
           char number[14] ;
           struct address *next ;
           struct address *prior ;
    } list_entry ;
    //=====================================
    //=====================================
    struct address *start ;
    struct address *last ;
     
    void enter() , display() , search() ;
    void list() , del();
    void display(struct address *info, int *row);
     
    struct address *find(char *);
    int menu_select();
    struct address *store(struct address *, struct address *);
    //=====================================
    //=====================================
     
     
     
     
    //****************
     
    int menu_select()
    {
          char s[5];
          system("cls");
          gotoxy(25,4) ;
          printf("1. enter a name ") ;
          gotoxy(25,6) ;
          printf("2. delete a name ") ;
          gotoxy(25, 8) ;
          printf("3. list all files ") ;
          gotoxy(25, 10) ;
          printf("4. search ") ;
          gotoxy(25, 12) ;
          printf("5. quit ") ;
          do {
          gotoxy(20, 18) ;
          printf("enter your select--power By majid (1-5):");
          gets(s);
          } while (atoi(s) < 0 || atoi(s) > 5) ;
          return atoi(s) ;
    }
    //*********************
     
     
    void enter ()
    {
       struct address *info ;
       int i ;
       char ch ;
       system("cls") ;
       gotoxy(3, 2) ;
       printf("   name        street     city     state    number");
       gotoxy(3, 3) ;
       printf(" ------------ -------- ");
       printf("--------   -----  ------- ");
       i = 4 ;
       for (;;) {
         info = (struct address *)malloc(sizeof(list_entry)) ;
         if(!info) {
        printf("\n out of memory. press a key ") ;
        getch();
        return ;
         }
         gotoxy(3, i) ;
         gets(info -> name) ;
         if (!info -> name[0]) {
          gotoxy(15, i + 1) ;
          printf("press a key to continue");
          getch() ;
          break ;
         }//end of if
         gotoxy(18, i);
         gets(info -> street) ;
         gotoxy(28, i) ;
         gets(info -> city) ;
         gotoxy(38, i) ;
         gets(info -> state) ;
         gotoxy(45, i) ;
         gets(info -> number) ;
         i++ ;
         start = store(info, start) ;
         } /* entry loop */
        }
    //**************
     
     
    struct address *store(struct address *i, struct address *top)
    {
       struct address *old, *p ;
       if(last == NULL) {
        i -> next = NULL ;
        i -> prior = NULL ;
        start = i;
        last = i ;
        return i ;
       }
       p = top ;
       old = NULL ;
       while (p != NULL) {
           if(strcmp(p -> name, i -> name) < 0) {
              old = p ;
              p = p -> next ;
           }//end of if
           else {
             if (p -> prior) {
              p -> prior -> next=i ;
              i -> next=p ;
              i -> prior=p -> prior;
              p -> prior=i ;
              return top ;
             }//end of if
             i -> next = p ;
             i -> prior = NULL ;
             p -> prior = i ;
             return i ;
           }//end of if
       } // end of while
       old -> next = i ;
       i -> next = NULL ;
       i -> prior = old ;
       last = i ;
       return start ;
    }
    //******************
     
     
    void del()
    {
       struct address *info;
       char name[80];
       gotoxy(20, 20) ;
       printf(" enter name for delete : ") ;
       gets(name) ;
       info = find(name) ;
       if(info == NULL) {
           gotoxy(10, 20) ;
           printf(" name not found! press a key to continue.");
           getch() ;
       }
       if (info)
         if (start == info)
        {
          start = info -> next ;
          if(start)
             start -> prior = NULL ;
          else
             last = NULL ;
        } //end of if
         else  {
           info -> prior -> next = info -> next;
           if(info != last)
             info -> next -> prior = info -> prior;
           else
            last = info -> prior ;
         } //end of else
         free(info) ;
         gotoxy(10,20) ;
         printf("name deleted, press a key to continue.");
         getch() ;
    }
    //*******************************
     
     
    struct address *find(char *name)
    {
         struct address *info ;
         info = start ;
         while(info != NULL) {
        if (strcmp(name, info -> name) == 0)
           return info;
        info = info -> next ;
         }
         return NULL ;
    }
    //*****************
     
     
    void list ()
    {
        struct address *info ;
        int i ;
        info = start ;
        system("cls") ;
        gotoxy(3, 2) ;
        printf("   name        street     city     state    number");
        gotoxy(3, 3) ;
        printf(" ------------ --------  -");
        printf("-------   -----  ------- ");
        i = 4 ;
        while(info != NULL) {
        display(info, &i) ;
        info = info -> next ;
        }
        gotoxy(15, i + 2) ;
        printf("press a key to continue.");
        getch() ;
    }
    //*******************
     
     
    void display(struct address *info, int *row)
    {
          gotoxy(3, *row) ;
          printf("%s", info -> name) ;
          gotoxy(18, *row) ;
          printf("%s", info -> street) ;
          gotoxy(28, *row) ;
          printf("%s", info -> city) ;
          gotoxy(38, *row) ;
          printf(info -> state) ;
          gotoxy(47, *row) ;
          printf(info -> number) ;
          *row = *row + 1 ;
    }
    //**************************
     
     
    void search()
    {
         char name[40] ;
         int i ;
         struct address *info;
         gotoxy(20, 20) ;
         printf(" enter name to find : ");
         gets(name) ;
         info = find(name) ;
         if(info == NULL) {
          gotoxy(10, 20) ;
          printf(" name not found! press a key to continue.");
          getch() ;
         }//end of if
         else  {
              system("cls") ;
              gotoxy(3, 2) ;
              printf("   name        street   city     state   number");
              gotoxy(3, 3) ;
              printf(" ------------ -------");
              printf("-  --------   -----  ------- ") ;
              i = 4 ;
              display(info ,&i) ;
              gotoxy(15, i + 2) ;
              printf("press a key to continue.");
              getch() ;
         }//end of else
    }
    //*********************
     
    int main()
    {
           start = last = NULL ;
           for(;;) {
             switch(menu_select()) {
               case 1:  enter();  break ;
               case 2 : del();    break ;
                case 3:  list() ;  break ;
               case 4:  search(); break ;
               case 5:  exit(0) ;
     
            }//end of switch
           }//end of for
    }//end of main
  4. #34
    programer
    كاربر عادي
    http://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gif
    تاریخ عضویت
    2011 Dec
    نوشته ها
    62
    1
    10
    سورس کد رسم لوزی در سی پلاس پلاس
    کد:
    #include <iostream>
    #include <conio>
    void fasele(int n){
    for(int i=1;i<=n;i++)
    cout<<" ";
    return;
    }
    //---------------------
    int main(){
    int n;
    cout<<"Enter n\n";
    cin>>n;
    int a=n,b=n-1,c=n-1;
    for(int i=1;i<=2*n-1;i+=2){
    fasele(a);
     for(int j=1;j<=i;j++)
     cout<<"*";
     fasele(b);
     fasele(c);
     for(int k=1;k<=i;k++){
     
     cout<<"*";}
     cout<<endl;
     a--;
     b--;
     c--;
     }
    int d=2,e=1,f=1;
    for(int i=2*n-3;i>=1;i-=2){
     fasele(d);
     for(int j=1;j<=i;j++)
     cout<<"*";
     fasele(e);
     fasele(f);
     for(int k=1;k<=i;k++)
     cout<<"*";
     cout<<endl;
     e++;
     f++;
     d++;
     }
    cout<<"---------------------------------------------------\n\n";
    cout<<" Designer : Salar Ashgi\n";
     getch();
     }
  5. #35
    programer
    كاربر عادي
    http://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gif
    تاریخ عضویت
    2011 Dec
    نوشته ها
    62
    1
    10
    finding OS Version
    کد:
    #include <iostream>
    #include <conio>
    #include <stdlib>
    int main(){
    system("ver");
    getch();
    }
  6. #36
    programer
    كاربر عادي
    http://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gif
    تاریخ عضویت
    2011 Dec
    نوشته ها
    62
    1
    10
    یک بازی که 6 عدد را به صورت تصادفی انتخاب میکند و کاربر باید آن را حدس بزند:
    کد:
    #include 
    #include 
    #include 
    #include
    
    int main()
    
    {
    
      // ba tarife yek araye be sorate tasadofi adadhaye beine 1 ta 6
      // ra dar arraye gharar midahim
      // in kar be vasile tabehaye Srand() va Rand() anjam mishe
    //***********************************************************************
      int Array[6];
      srand(time(0));
      for (int j = 0; j<= 5; j++ )
       Array[j] = 0;
      int n = 0;
      for (int i = 1; i<= 100; i++ )
     {
      // dastore Rand() yek adade tasadofi beyne 1 ta 32767 ra entekhab mikonad
      // baraye inke in adad dar baze 1 ta 6 gharar begirad
      // as dastore zir estefade mikonim
      int num = rand() % 6 + 1;
      // in dastor baraye in ast ke addadhaye entekhab shode tekrari nabashand
      if ( num == Array[0] || num == Array[1]|| num == Array[2]
                   || num == Array[3]|| num == Array[4]|| num == Array[5])
      continue;
    
      Array[n] = num;
      n = n+1;
     if (n > 6 )
       break;
     }
    //***********************************************************************
    
    // in halghe for() baraye namayeshe adadhaye entekhab shode ast
    //  for (int k = 0; k<= 5; k++ )
    //   {
    //   cout << Array[k];
    //   cout << endl;
    //   }
    
      int m[6] ;
     for (int e1 = 0; e1<= 5; e1++ )
       m[e1] = 0 ;
      cout << "          Enter A number Less of 1 for Exit "<< endl << endl;
      int w ;
    
      // halghe for() tanha 10 bar tekrar mishavad yani har nafar faghat 10 bar
      // forsat darad adadha ra hads bezanad
      //***********************************************************************
      for(int v=1;v<=10;v++)
      {
     w = 0 ;
     cout << "          Enter Six Number Between 1 to 6 : ";
     // in halghe adadhaye neveshte shode ra mikhanad
     // agar bishtar as 6 bood peighame khata neshan dade mishavad
     // agar karbar adade 0 ra vared karde bashad barname exit mishavad
    
      for (int e =0; e<= 5; e++ )
       {
       cin >> m[e] ;
       }
       for (int e3 =0; e3<= 5; e3++ )
       {
       if (m[e3] > 6 )
        {
       cout <   w = 1;
       for (int e2 = 0; e2<= 5; e2++ )
         m[e2] = 0 ;
       break;
        }
       if ( m[e] < 1 )
       exit(0);
       }
      // cout << "nvbvg"<< m[0]<<" "<  if ( w == 0 )
      {
      // ba moghayese adadhaye vared shode va adadhaye tasadofi bejaye adadhaye
      // eshtebah "F" gharar migirad
      cout << endl<< "                         " ;
      for ( int z = 0; z<= 5 ; z++ )
      {
        if (  m[z]== Array[z] )
       cout << m[z]<< " " ;
        else
       cout << "F ";
      }
       cout << endl ;
      }
      cout << endl ;
     }
    
      return 0;
    }
  7. #37
    programer
    كاربر عادي
    http://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gif
    تاریخ عضویت
    2011 Dec
    نوشته ها
    62
    1
    10
    یک بازی که 6 عدد را به صورت تصادفی انتخاب میکند و کاربر باید آن را حدس بزند:
    کد:
    #include 
    #include 
    #include 
    #include
    
    int main()
    
    {
    
      // ba tarife yek araye be sorate tasadofi adadhaye beine 1 ta 6
      // ra dar arraye gharar midahim
      // in kar be vasile tabehaye Srand() va Rand() anjam mishe
    //***********************************************************************
      int Array[6];
      srand(time(0));
      for (int j = 0; j<= 5; j++ )
       Array[j] = 0;
      int n = 0;
      for (int i = 1; i<= 100; i++ )
     {
      // dastore Rand() yek adade tasadofi beyne 1 ta 32767 ra entekhab mikonad
      // baraye inke in adad dar baze 1 ta 6 gharar begirad
      // as dastore zir estefade mikonim
      int num = rand() % 6 + 1;
      // in dastor baraye in ast ke addadhaye entekhab shode tekrari nabashand
      if ( num == Array[0] || num == Array[1]|| num == Array[2]
                   || num == Array[3]|| num == Array[4]|| num == Array[5])
      continue;
    
      Array[n] = num;
      n = n+1;
     if (n > 6 )
       break;
     }
    //***********************************************************************
    
    // in halghe for() baraye namayeshe adadhaye entekhab shode ast
    //  for (int k = 0; k<= 5; k++ )
    //   {
    //   cout << Array[k];
    //   cout << endl;
    //   }
    
      int m[6] ;
     for (int e1 = 0; e1<= 5; e1++ )
       m[e1] = 0 ;
      cout << "          Enter A number Less of 1 for Exit "<< endl << endl;
      int w ;
    
      // halghe for() tanha 10 bar tekrar mishavad yani har nafar faghat 10 bar
      // forsat darad adadha ra hads bezanad
      //***********************************************************************
      for(int v=1;v<=10;v++)
      {
     w = 0 ;
     cout << "          Enter Six Number Between 1 to 6 : ";
     // in halghe adadhaye neveshte shode ra mikhanad
     // agar bishtar as 6 bood peighame khata neshan dade mishavad
     // agar karbar adade 0 ra vared karde bashad barname exit mishavad
    
      for (int e =0; e<= 5; e++ )
       {
       cin >> m[e] ;
       }
       for (int e3 =0; e3<= 5; e3++ )
       {
       if (m[e3] > 6 )
        {
       cout <   w = 1;
       for (int e2 = 0; e2<= 5; e2++ )
         m[e2] = 0 ;
       break;
        }
       if ( m[e] < 1 )
       exit(0);
       }
      // cout << "nvbvg"<< m[0]<<" "<  if ( w == 0 )
      {
      // ba moghayese adadhaye vared shode va adadhaye tasadofi bejaye adadhaye
      // eshtebah "F" gharar migirad
      cout << endl<< "                         " ;
      for ( int z = 0; z<= 5 ; z++ )
      {
        if (  m[z]== Array[z] )
       cout << m[z]<< " " ;
        else
       cout << "F ";
      }
       cout << endl ;
      }
      cout << endl ;
     }
    
      return 0;
    }
  8. #38
    programer
    كاربر عادي
    http://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gif
    تاریخ عضویت
    2011 Dec
    نوشته ها
    62
    1
    10
    مثلث کامل n عددی
    کد:
    #include <iostream.h>
    int cNum (int k)
    {
     int val =1;
     while( k/10 > 0 )
     {
      k /=10;
      val ++;
     }
     return val;
    }
    int cNumCount (int k)
    {
     int val = 0;
     for( int i=k; i>0 && cNum(i)== cNum(k); i--)
       val ++;
     return val;
    }
    int main()
    {
     int n, c, b, j;
     cout<<"\n add ro vared konid >";
     cin>>n;
     c = n*2;
     b = 1;
     for(int i=0;i<n;i++){
       cout<<"\n";
       for(j=0;j<c-i-cNumCount(b)*(cNum(i)-1);j++)
        cout<<" ";
       for( j=1;j<=b;j++)
        cout<<j;
       for( j=1;j<i+cNum(i);j++)
        cout<<j;
       b+=1;
     }
     return 0;
    }
  9. #39
    programer
    كاربر عادي
    http://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gif
    تاریخ عضویت
    2011 Dec
    نوشته ها
    62
    1
    10
    سورس کد از نمونه کوچک و تمرینی از ثبت نام و انتخاب واحد ئ کار با فایل ها رو خدمتتون ارائه بدم به درخواست یکی از عزیزان نوشته شده و نکات آموزشی داره در کل دیدنش بدک نیست
    کد:
    #include<stdio.h>
    #include<conio.h>
    #include<dos.h>
    #include<iostream.h>
    #include<stdlib.h>
    #include<fstream.h>
    #define max 100
    
    //--------------FUNCTION---------
    void menu();
    void tab(char[max]);
    void add();
    void select_vhd();
    void view_vhd();
    void view_reg();
    void edit_st();
    void edit_vhd();
    void delet();
    char msgg(int,int,char[max]);
    //------------------END_FUNCTION------------
    struct student{
                  char name[21];
              char fname[21];
              char codem[21];
              char telphone[15];
              char address[40];
              int  code;
                  char del;
                   }st;
    struct vahed{
                  
                  char vname[21];
                  int tvhd;
                  char master[21];
                  char del;
                  int code;
                   }vhd;
    
    main()
    {
    menu();
    
    
    
       getch();
    return 0;
    
    }
    
    void tab(char str[max])
    {
     int i;
     clrscr();
     gotoxy(10,5);
      cout<<"+-----------------"<<str<<"-------------------+" <<endl;
      for(i=0;i<32;i++)
      {
        gotoxy(10,(6+i));
        cout<<"|";
         gotoxy(65,(6+i));
        cout<<"|";
    
      }
      gotoxy(10,37);
      cout<<"+------------------------------------------------------+";
    
    }
    
    
    void menu()
    {
      int i;
    char s;
      clrscr();
      gotoxy(10,5);
      cout<<"+-----------------IN THE NAME OF GOD-------------------+" <<endl;
      for(i=0;i<32;i++)
      {
        gotoxy(10,(6+i));
        cout<<"|";
         gotoxy(65,(6+i));
        cout<<"|";
    
      }
      gotoxy(10,37);
      cout<<"+------------------------------------------------------+";
      gotoxy(20,8);
      cout<<"1=>Regeister";
      gotoxy(20,12);
      cout<<"2=>Select Vahed";
      gotoxy(20,16);
      cout<<"3=>View VAHED";
      gotoxy(20,20);
      cout<<"4=>View Register";
      gotoxy(20,24);
      cout<<"5=>Edit Info";
      gotoxy(20,28);
      cout<<"6=>Delet";
      gotoxy(20,32);
      cout<<"7=>Exit";
      gotoxy(32,35);
      cout<<"SELECT ITEM(1-7):";
      s=getch();
      switch(s)
      {
      case '1':
      {
        add();
        break;
      }
       case '2':
      {
        select_vhd();
        break;
      }
       case '3':
      {
        view_vhd();
        break;
      }
       case '4':
      {
        view_reg();
        break;
      }
       case '5':
      {
        edit_st();
        break;
      }
       case '6':
      {
        delet();
        break;
      }
       case '7':
      {
        exit(1);
        break;
      }
    }
    
    }
    
    //ADD------------------------
    void add()
    {
      tab("ADD NEW Student---");
      ofstream fp("studata.dat" , ios::out | ios::in | ios::binary);
         if(!fp){
                       cout<<"CAN NOT OPEN FILE .";
                        
                       getch();
                       exit(0);}   
         
    
    int code;
    
    
            gotoxy(25,8);
        cout <<"* NAME: ";
         cin>>st.name;
        gotoxy(25,12);
        cout <<"*FNAME: ";
         cin>>st.fname;
        gotoxy(25,16);
        cout <<"*Code MELI: ";
         cin>>st.codem;
        gotoxy(25,20);
        cout <<"*TELPHONE: ";
         cin>>st.telphone;
        gotoxy(25,24);
         cout <<"*ADDRESS: ";
         cin>>st.address;
        gotoxy(25,28);
         cout<<"Enter a new code (NO REPETITIVE)";
         cin >>code;
    
    
         if (code > 0)
         {
                    st.del='n';
                    st.code=code;
            fp.seekp(sizeof(struct student)* code,ios::beg);
            fp.write((char *) &st, sizeof(struct student));
            fp.close();
          }
           gotoxy(20,48);
           cout<<"SAVED PRESS ANy Key TO Return MENU....";
           getch();
           menu();
    }
    //------------------------SELECT_VAHED___________
    void select_vhd()
    {
    
     tab("ADD NEW VAHED-----");
      ofstream fp("vhddata.dat" , ios::out | ios::in | ios::binary|ios::app);
         if(!fp){
                       cout<<"CAN NOT OPEN FILE .";
                       getch();
                       exit(0);}   
         
    
    int code;
    
           
            gotoxy(25,8);
        cout <<"* Vahed Name: ";
         cin>>vhd.vname;
             cin.get();
        gotoxy(25,12);
        cout <<"*Vahed Number: ";
         cin>>vhd.tvhd;
        gotoxy(25,16);
        cout <<"*Name Of Teacher: ";
         cin>>vhd.master;
        gotoxy(25,20);
        cout <<"*STudent ID(NO Premitive): ";
         cin>>code;
        //gotoxy(25,24);
    
         if (code > 0)
         {
                    vhd.del='n';
            vhd.code=code;
            fp.seekp(sizeof(struct vahed)* code,ios::beg);
            fp.write((char *) &vhd, sizeof(struct vahed));
            fp.close();
          }
           gotoxy(20,48);
           cout<<"VAHED SAVED PRESS ANy Key TO Return MENU....";
           getch();
           menu();
    
    }
    
    void view_vhd()
    {
     int r=11;
    
    
      ifstream fp("vhddata.dat" , ios::in | ios::binary);
      if(!fp){
                       cout<<"CAN NOT OPEN FILE .";
                       getch();
               exit(0);}
    
      tab("View VAHED--------");
                          gotoxy(12,8);
                      cout <<"ID";
                          gotoxy(12,9);
                      cout <<"--";
                          gotoxy(16,8);
                      cout <<"NAME";
                          gotoxy(16,9);
                      cout <<"----";
                          gotoxy(25,8);
                      cout <<"NUMBER";
                          gotoxy(25,9);
                      cout <<"------";
                          gotoxy(35,8);
                     cout <<"TName";
                         gotoxy(35,9);
                      cout <<"-----";
      
    
        while (fp.read((char *) &vhd, sizeof(struct vahed)))
        {
            if(vhd.del=='n')
            {
    
    
                        
    
     
                gotoxy(12,r);
                cout <<vhd.code;
    
                gotoxy(16,r);
                cout <<vhd.vname;
    
                gotoxy(28,r);
                cout <<vhd.tvhd;
    
                gotoxy(35,r);
                cout <<vhd.master;
    
    
                r++;
            }
       }
        fp.close();
         gotoxy(20,48);
           cout<<" PRESS ANy Key TO Return MENU....";
           getch();
           menu();
    
    }
    
    
    
    void view_reg()
    {
    
    int r=11;
    
      tab("View Regeister----");
    
            ifstream fp("studata.dat" , ios::in | ios::binary);
            if(!fp){
               cout<<"CAN NOT OPEN FILE .";
               getch();
               exit(0);}
    
    
                  gotoxy(11,8);
                  cout <<"Code";
                  gotoxy(11,9);
                  cout <<"----";
    
                  gotoxy(16,8);
                  cout <<"Name";
                  gotoxy(16,9);
                  cout <<"----";
                  gotoxy(22,8);
                  cout <<"FNAME";
                  gotoxy(22,9);
                  cout <<"-----";
                  gotoxy(30,8);
                  cout <<"CodeMeli";
                  gotoxy(30,9);
                  cout <<"--------";
                  gotoxy(42,8);
                 cout <<"TELPHONE";
                 gotoxy(42,9);
                  cout <<"--------";
                  gotoxy(55,8);
                 cout <<"ADDRESS";
                 gotoxy(55,9);
                  cout <<"-------";
    
            while (fp.read((char *) &st, sizeof(struct student)))
        {
            if(st.del=='n')
            {
    
    
    
    
    
                gotoxy(12,r);
                cout <<st.code;
    
                gotoxy(16,r);
                cout <<st.name;
    
                gotoxy(22,r);
                cout <<st.fname;
    
                gotoxy(31,r);
                cout <<st.codem;
    
                gotoxy(43,r);
                cout <<st.telphone;
    
                gotoxy(55,r);
                cout <<st.address;
    
    
                r++;
            }
       }
        fp.close();
    
         gotoxy(20,48);
           cout<<"PRESS ANy Key TO Return MENU....";
           getch();
           menu();
                   
      
    
        
    
    }
    
    void edit_st()
    {
     
     int c;
        tab("Edit Regeister----");
            gotoxy(25,8);
        cout <<"Enter Code: ";
        cin >>c;
        if (c>0)
        {
            fstream fp("studata.dat" , ios::out | ios::in | ios::binary);
            
              if(!fp){
                       cout<<"CAN NOT OPEN FILE .";
                       getch();
              exit(0);}        
    
    
            fp.seekg(sizeof(struct student) * c,ios::beg);
            fp.read((char *) &st, sizeof(struct student));
    
            gotoxy(25,12);
                cout <<"* NAME: ";
                cin>>st.name;
             gotoxy(25,16);
                cout <<"*FNAME: ";
             cin>>st.fname;
            gotoxy(25,20);
            cout <<"*Code MELI: ";
             cin>>st.codem;
            gotoxy(25,24);
            cout <<"*TELPHONE: ";
             cin>>st.telphone;
            gotoxy(25,26);
             cout <<"*ADDRESS: ";
             cin>>st.address;
    
    
            fp.seekp(sizeof(struct student) * c,ios::beg);
            fp.write((char *) &st, sizeof(struct student));
        }
         gotoxy(20,48);
             cout<<"VAHED SAVED PRESS ANy Key TO Return MENU....";
             getch();
             menu();
    
    }
    
    void edit_vhd()
    {
     cout<<"FUN EDIT_VAHED";
    
    }
    
    void delet()
    {
    
            int c;
        tab("DELET STUDENT-----");
         gotoxy(25,8);
        cout <<"Enter Code: ";
        cin >>c;
        if (c>0)
        {
            fstream fp("studata.dat" , ios::out | ios::in | ios::binary);
            fp.seekg(sizeof(struct student) * c,ios::beg);
            fp.read((char *) &st, sizeof(struct student));
            st.del='y';
            fp.seekp(sizeof(struct student) * c,ios::beg);
            fp.write((char *) &st, sizeof(struct student));
            fp.close();
        }
        
         gotoxy(20,48);
             cout<<"RECORD:="<<c<<" DELET PRESS ANy Key TO Return MENU....";
             getch();
             menu();
    }
    
    char msgg(int x,int y,char str[max])
    {
       gotoxy(x,y);
       cout<<str;
       return(getch());
    
    }
  10. #40
    programer
    كاربر عادي
    http://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/rgk38wbh3cfxod62rhr2.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gifhttp://up.vbiran.ir/images/qndtfn66fcrrq7cw6yh.gif
    تاریخ عضویت
    2011 Dec
    نوشته ها
    62
    1
    10
    مرتب سازی سریع
    کد:
    #include <iostream.h>
    #include <conio.h>
    #include <time.h>
    #include <stdlib.h>
    void quickSort(int numbers[], int array_size);
    void q_sort(int numbers[], int left, int right);
    void main (void)
    {
        const n = 10;
        int X[n];
    
        randomize();
        for (int i=0; i<n; i++)
        {
            X[i] = rand() % 100;
            cout << X[i] << "\t";
        }
    
        quickSort (X, n);
    
        cout<< endl;
        for (i=0; i<n; i++)
            cout << X[i] << "\t";
    
        getch();
    }
    void quickSort(int numbers[], int array_size)
    {
      q_sort(numbers, 0, array_size - 1);
    }
    
    
    void q_sort(int numbers[], int left, int right)
    {
      int pivot, l_hold, r_hold;
    
      l_hold = left;
      r_hold = right;
      pivot = numbers[left];
      while (left < right)
      {
        while ((numbers[right] >= pivot) && (left < right))
          right--;
        if (left != right)
        {
          numbers[left] = numbers[right];
          left++;
        }
        while ((numbers[left] <= pivot) && (left < right))
          left++;
        if (left != right)
        {
          numbers[right] = numbers[left];
          right--;
        }
      }
      numbers[left] = pivot;
      pivot = left;
      left = l_hold;
      right = r_hold;
      if (left < pivot)
        q_sort(numbers, left, pivot-1);
      if (right > pivot)
        q_sort(numbers, pivot+1, right);
    }
صفحه 4 از 10 نخست 1234567 ... آخرین
نمایش نتایج: از 31 به 40 از 92

اطلاعات موضوع

کاربرانی که در حال مشاهده این موضوع هستند

در حال حاضر 1 کاربر در حال مشاهده این موضوع است. (0 کاربران و 1 مهمان ها)

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

  1. ارشيو سورس كد هاي سي شارپ
    توسط MspSoft در انجمن #C
    پاسخ: 69
    آخرين نوشته: 2016-12-13, 11:32 PM
  2. تشخيص درايو سي دي در ويژوال بيسيک
    توسط MspSoft در انجمن برنامه نویسی در 6 VB
    پاسخ: 0
    آخرين نوشته: 2012-02-18, 11:37 PM
  3. ارشيو سورس هاي كابردي ويژوال بيسك
    توسط halalabad در انجمن برنامه نویسی در 6 VB
    پاسخ: 25
    آخرين نوشته: 2011-12-10, 01:41 AM
  4. تاريخچه ويژوال استديو و ورود ان به دنيا دات نت
    توسط MspSoft در انجمن برنامه نویسی مبتنی بر Microsoft .Net Framework
    پاسخ: 0
    آخرين نوشته: 2011-12-05, 08:16 PM
  5. اموزش تصويري ويژوال استديو 2010 قسمت اول
    توسط MspSoft در انجمن برنامه نویسی مبتنی بر Microsoft .Net Framework
    پاسخ: 3
    آخرين نوشته: 2011-11-30, 04:39 PM

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

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

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

Content Relevant URLs by vBSEO 3.6.0 RC 2