نمایش نتایج 1 تا 40 از 320

نام تاپیک: مجموعه برنامه های نوشته شده به زبان C و ++C

Threaded View

پست قبلی پست قبلی   پست بعدی پست بعدی
  1. #8
    کاربر دائمی آواتار voiceoffox
    تاریخ عضویت
    مهر 1389
    محل زندگی
    مشهد
    پست
    122

    Cool نقل قول: مجموعه برنامه های نوشته شده به زبان C و ++C

    سلام
    اینم بازی "سنگ - کاغذ - قیچی" هست ! اما با بازی سنگ و کاغذ و قیچی که چند صفحه قبل یکی نوشته بود فرق هایی داره!

    این بازیتک نفره اس و فقط شمایین با کامپیوتر ! یه جورایی هوشمنده !

    #include<iostream.h>
    #include<conio.h>
    #include<stdlib.h>
    int mantegh(int,int);
    main()
    {
    randomize();
    int pcp=0,hup=0,mon=0,sel=0,pcsel=0,ans=0;
    error1:
    cout<<"Choose your round mode by pressing the number of mode wich you want :"<<"\n";
    cout<<"(This will be the number of rounds wich you play)"<<"\n";
    cout<<"0. <1>Round"<<"\n"<<"1. <3>Rounds"<<"\n"<<"2. <5>Rounds"<<"\n";
    cout<<"3. <10>Rounds"<<"\n"<<"4. <15>Rounds"<<"\n"<<"5. <20>Rounds"<<"\n";
    cout<<"6. <25>Rounds"<<"\n"<<"7. <50>Rounds"<<"\n"<<"8. <75>Rounds"<<"\n";
    cout<<"9. <100>Rounds"<<"\n";
    cout<<"Now ! insert the numbr of your mode :"<<"\n";
    mon=getche();
    if(mon=='0')
    mon=1;
    else if(mon=='1')
    mon=3;
    else if(mon=='2')
    mon=5;
    else if(mon=='3')
    mon=10;
    else if(mon=='4')
    mon=15;
    else if(mon=='5')
    mon=20;
    else if(mon=='6')
    mon=25;
    else if(mon=='7')
    mon=50;
    else if(mon=='8')
    mon=75;
    else if(mon=='9')
    mon=100;
    else
    {
    clrscr();
    cout<<"Just press the number of mode , nothing else ! OK ?"<<"\n";
    goto error1;
    }
    cout<<"\n"<<"Ok !"<<" Remmember that you must reach to htis point !"<<"\n";
    cout<<"press any key to start the game ..."<<"\n";
    getch();
    clrscr();
    for(int i=1;i<=mon;i++)
    {
    error2:
    cout<<"Press the number of the thing that you wantb to use :"<<"\n";
    cout<<"1. Sang"<<"\n"<<"2. Kaghaz"<<"\n"<<"3. Gheychi"<<"\n";
    sel=getch();
    if(sel=='1')
    {
    clrscr();
    cout<<"******************************"<<"\n";
    cout<<"Your selection : <SANG>"<<"\n";
    }
    else if(sel=='2')
    {
    clrscr();
    cout<<"******************************"<<"\n";
    cout<<"Your selection : <KAGHAZ>"<<"\n";
    }
    else if(sel=='3')
    {
    clrscr();
    cout<<"******************************"<<"\n";
    cout<<"Your selection : <GHEYCHI>"<<"\n";
    }
    else
    {
    clrscr();
    cout<<"You are just aloud to enter numbers 1 or 2 or 3 ! OK ?"<<"\n";
    goto error2;
    }
    pcsel=((rand()%3)+1);
    if(pcsel==1)
    cout<<"Computer selection : <GHEYCHI>"<<"\n";
    else if(pcsel==2)
    cout<<"Computer selection : <SANG>"<<"\n";
    else
    cout<<"Computer selection : <KAGHAZ>"<<"\n";
    ans=mantegh(pcsel,sel);
    if(ans==1)
    {
    cout<<"====="<<"\n"<<"No added point !"<<"\n";
    cout<<"Computer points : "<<pcp<<"\n"<<"Human points : "<<hup<<"\n";
    }
    else if(ans==2)
    {
    cout<<"====="<<"\n"<<"Player gained the point !"<<"\n";
    ++hup;
    cout<<"Computer points : "<<pcp<<"\n"<<"Human Points : "<<hup<<"\n";
    }
    else if(ans==3)
    {
    cout<<"====="<<"\n"<<"Computer gained the point !"<<"\n";
    ++pcp;
    cout<<"Computer points : "<<pcp<<"\n"<<"Human Points : "<<hup<<"\n";
    }
    else
    {
    clrscr();
    goto error2;
    }
    cout<<"******************************"<<"\n";
    }
    if(pcp==hup)
    {
    clrscr();
    cout<<"##########################################" <<"\n";
    cout<<"# There wasn't any winner in this game ! #"<<"\n";
    cout<<"##########################################" <<"\n";
    cout<<" *Computer points : "<<pcp<<"\n"<<" *Player points : "<<hup<<"\n";
    }
    else if(pcp>hup)
    {
    clrscr();
    cout<<"##########################################" <<"\n";
    cout<<"# Computer won this game ! #"<<"\n";
    cout<<"##########################################" <<"\n";
    cout<<" *Computer points : "<<pcp<<"\n"<<" *Player points : "<<hup<<"\n";
    }
    else if(hup>pcp)
    {
    clrscr();
    cout<<"##########################################" <<"\n";
    cout<<"# Player won this game ! #"<<"\n";
    cout<<"##########################################" <<"\n";
    cout<<" *Computer points : "<<pcp<<"\n"<<" *Player points : "<<hup<<"\n";
    }
    else
    getch();
    }
    int mantegh(int com,int man)
    {
    if((com==2 && man=='1')||(com==3 && man=='2')||(com==1 && man=='3'))
    return 1;
    //No one didn't take the point !
    else if((com==1 && man=='1')||(com==2 && man=='2')||(com==3 && man=='3'))
    return 2;
    //Human took the point !
    else if((com==1 && man=='2')||(com==2 && man=='3')||(com==3 && man=='1'))
    return 3;
    //Computer took the point !
    else
    return 0;
    }


    کامپایل شده تحت Turbo C++‎ 4.5
    آخرین ویرایش به وسیله voiceoffox : جمعه 24 دی 1389 در 12:07 عصر دلیل: یه نقص فنی کوچولو !

برچسب های این تاپیک

قوانین ایجاد تاپیک در تالار

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