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

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

Threaded View

پست قبلی پست قبلی   پست بعدی پست بعدی
  1. #8
    کاربر تازه وارد آواتار StepUp
    تاریخ عضویت
    شهریور 1394
    محل زندگی
    تــــهران
    پست
    41

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

    سلام ، این برنامه من هستش که توی ++C نوشتم ،
    برنامه‌ای که اول به صورت Hard و Easy و به اتخاب تعداد سوالات توسط شما ازتون سوال ریاضی (جمع ، تفریق ، ضرب ، تقسیم ) میپرسه!
    سعی شده به صورت ساده و روان نوشته بشه ، برای نوشتن از کامپایلر CodeBlocks استفاده شده
    کسی اگر سوالی داشت در خدمتیم
    # include <iostream>
    # include <string>
    # include <math.h>
    # include <conio.h>
    # include <stdio.h>
    # include <cstdlib>
    # include <ctime>
    using namespace std;
    string name = " ";
    string age = " ";
    string grade = " ";
    string surname = " ";
    int i=0;
    int main()
    {


    cout << "Welcome to our Math Exam , i hope that you can evaluate yourself by taking this \n";
    cout << "But before you Start you must answer some questions : \n\n";
    cout << "Tell us your Full name : ";
    cin >> name;
    cin >> surname;
    cout <<"\n";
    cout << "How old are you ? ";
    cin >> age;
    cout <<"\n";
    cout << "What's the grade are you in ? ";
    cin >> grade;
    cout <<"\n";
    cout << "Thanks for answering our questions , Now if you are ready choose one of these sections : \n ";
    cout <<"\n";
    int level,questioncounts=0;
    cout << "1-Easy" <<endl;
    cout << "2-Hard" <<endl;
    cin >> level;
    int rand1=0,rand2=0,f=0,t=0;
    cout << "How many questions do you want to answer ? " << endl;
    cin >> questioncounts;
    if(level==1)
    {
    while (i<questioncounts)
    {
    int s;
    srand(time(0)+430*5*4*34);
    rand1=((rand()%100)+1)*sin(time(0));
    rand2=((rand()%100)+1)*sin(time(0));
    if(rand1>0&&rand2<0) //+-
    {
    cout << rand1 << rand2 <<" = " << endl;
    cin>>s;
    if(s==rand1+rand2)
    {
    t++;
    }
    else
    f++;
    i++;
    }
    if(rand1>0&&rand1<rand2) //++
    {
    cout << rand1 <<"+"<< rand2 <<" = " << endl;
    cin>>s;
    if(s==rand1+rand2)
    {
    t++;
    }
    else
    f++;
    i++;
    }
    if(rand1<0&&rand1>rand2) //--
    {
    cout << rand1 << rand2 <<" = " << endl;
    cin>>s;
    if(s==rand1+rand2)
    {
    t++;
    }
    else
    f++;
    i++;
    }


    }
    cout <<"true" <<"=" << t << endl;
    cout <<"false"<<"="<< f << endl;
    cout <<"your total score"<<"="<<t*100/questioncounts<<"%"<<endl;


    }
    if(level==2)
    {
    while (i<questioncounts)
    {
    int randSign=(rand()%3)+1;
    if(randSign==1)
    {




    int s;
    srand(time(0)+430*5*4*34);
    rand1=((rand()%100)+1)*sin(time(0));
    rand2=((rand()%100)+1)*sin(time(0));
    if(rand1>0&&rand2<0) //+-
    {
    cout << rand1 << rand2 <<" = " << endl;
    cin>>s;
    if(rand1+rand2)
    {
    t++;
    }
    else
    f++;
    i++;
    }
    if(rand1>0&&rand1<rand2) //++
    {
    cout << rand1 <<"+"<< rand2 <<" = " << endl;
    cin>>s;
    if(rand1+rand2)
    {
    t++;
    }
    else
    f++;
    i++;
    }
    if(rand1<0&&rand1>rand2) //--
    {
    cout << rand1 << rand2 <<" = " << endl;
    cin>>s;
    if(rand1+rand2)
    {
    t++;
    }
    else
    f++;
    i++;
    }
    }
    if(randSign==2)


    {
    int s,t=0,f=0;
    srand(time(0)+430*5*4*34);
    rand1=((rand()%50)+1);
    rand2=((rand()%100)+1);
    cout << rand1 <<"*"<<rand2<<"="<<endl;
    int m = rand1*rand2;
    cin >>s;
    if(s==m)
    {
    t++;
    i++;
    }
    else
    f++;
    i++;


    }
    if(randSign==3)


    {
    int s,t=0,f=0;
    srand(time(0)+430*5*4*34);
    rand1=((rand()%50)+1);
    rand2=((rand()%100)+1);
    cout << rand1 <<"/"<<rand2<<"="<<endl;
    int m = rand1/rand2;
    cin >>s;
    if(s==m)
    {
    t++;
    i++;
    }
    else
    f++;
    i++;
    }
    }
    cout <<"true" <<"=" << t << endl;
    cout <<"false"<<"="<< f << endl;
    cout <<"your total score"<<"="<<t*100/questioncounts<<"%"<<endl;
    }
    return 0;


    }








    آخرین ویرایش به وسیله StepUp : چهارشنبه 04 شهریور 1394 در 13:00 عصر

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

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

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