دانشنامه ریاضی و کامپیوتر

سایت جامع در باب کتب و جزوات رشته های ریاضی و کامپیوتر با دانلود مستقیم.

ورود
عضویت




    • مطلبی یافت نشد.
    • مطلبی یافت نشد.
    • مطلبی یافت نشد.



فروشگاه سی شارپ
فروشگاه کدهای php
فروشگاه asp.net

سورس ماشین حساب مهندسی و حرفه ای با c++

این برنامه برای Dev c++ نوشته شده و در کامپایلر های قدیمی turbo و borland باید کمی تغییرش بدین!


# include <iostream>
# include <cmath>

using namespace std;
void help();
//in tabe be onvane help baraye amalgar ha mibashad barname ast;

int fact (float a);
//in tabe factoryel ra hesab mikonad

void error();
//in tabe peyghame khata ra chap mikonad



int main(){
float result,zakhire ,a[50];
char b;
int flag=0,resultint, aint;

for (int i=1; i<50; i++){

    if (i==1) {
        help();
        cout <<"Enter Number:";
        cin>>result;
        i+=1;}
    do{
    do{
    system("cls");
    help();
    cout<<"Last result= "<<result<<endl;
    cout<<"Enter Operator: ";
    cin>>b;
    }while (b!='f' && b!='l'&& b!='z'&& b!='b'&& b!='c'&& b!='+'&& b!='m'&& b!='n'&& b!='-'&& b!='*'&& b!='/'&& b!='o'&& b!='s'&& b!='r'&&b!='q'&& b!='p'&& b!='');
    flag=3;

    if (b==''){
                if (result!=floor(result)){
                error();
                flag=2;
                }//end if
               
    }//end if
   

    }while(flag==2); //*/
    switch (b){
    case 'r':
        i=0;
        system("cls");
        continue;
    case 'f':
            result= fact(result);
            continue;
    case 's':
            result=sin(3.1416/(180/result));
            resultint=result*100;
            result=resultint*1./100;           
            continue;
    case 'o':
            result=cos(3.1416/(180/result));
            resultint=result*100;
            result=resultint*1./100;           
            continue;
    case 'm':
            resultint=result;
            if(resultint%180!=90){
                result=3.1416/(180/result);
                result=tan(result);
                resultint=result*100;
                result=resultint*1./100;}//end if
            else
                error();
             continue;
    case 'n':
            resultint=result;
            if(resultint%180!=0){
                result=3.1416/(180/result);
                result=1/(tan(result));
                resultint=result*100;
                result=resultint*1./100;}//end if
            else
                error();
             continue;
    case 'z':
            zakhire=result;           
            continue;
    case 'b':
            result=zakhire;           
            continue;
    case 'l':
            if(result>0)
                result=log10(result);           
            else
                error();
            continue;
    }//end switch
        if (b=='c') break;
//end for*/
       
    system("cls");
    help();
    cout<<"Last result= "<<result<<" "<<b<<endl;
    cout <<"Enter Number:";
    cin>>a;
   
    switch(b){
    case '+':
        result+=a ;break;
    case '-':
        result -= a; break;
    case '*':
        result *= a; break;
    case '/':
        if (a==0){
                error();
                break;
            }
        else{
            result/=a; break;}
    case 'p':
        result= pow(result,a); break;
    case 'q':
        result=pow(result, 1/a); break;
    case '':
        resultint=result;
        aint=a;
            if (a==floor(a)){
                result = resultint%aint; break;
                }//end if
            else{
                error();
                break;
                }//end else

    }//end switch
   
}//end for

return 0;
}//end main


void help(){
cout<<"      In the name of Godnn";
    cout<<"//Created By Sepehr Mohammad\"<<<<endl;
    cout<<"//  Http://cplusprogram.tk  \"<<endl<<endl;
cout<<"HELP:"<<endl;
cout<<"Enter in Operator"<<endl;
cout<<"Close:[c]"<<endl;
cout<<"Reset:[r]"<<endl;
cout<<"Save in Memory:[z]"<<endl;
cout<<"Load from Memory:"<<endl;
cout<<"Plus:[+]    ;example(2+3=5)"<<endl;
cout<<"Subtract:[-]    ;example(5-3=2)"<<endl;
cout<<"Multiply:[*]    ;example(2*3=6)"<<endl;
cout<<"Division:[/]    ;example(5/2=2.5 $ 5/0=Undefined)"<<endl;
cout<<"Reminder:[]    ;example(52=1 $ 5.32.1=Undefined)"<<endl;
cout<<"power:[p]    ;example(2 p 3=8)"<<endl;
cout<<"sqrt:[q]    ;example(8 s 3=2)"<<endl;
cout<<"factorial:[f]    ;example(4f=24)"<<endl;
cout<<"Sin:         ;example(30s=0.5)"<<endl;
cout<<"Cos:[o]         ;example(60o=0.5)"<<endl;
cout<<"tan:[m]         ;example(45m=1)"<<endl;
cout<<"Cot:[n]         ;example(45n=1)"<<endl;
cout<<"log:[l]         ;example(10l=1)"<<endl;
cout<<endl;
}//end help

int fact (float a){
int b=a, result=1;
    for (int i=2; i<=b; i++){
    result*=i;
        }//end for
return result;
}//end fact

void error(){
    system("cls");
    cerr<<endl<<"!!Undefined!!"<<endl<<endl;
    system("pause");
}//end error


//end

ارسال نظر

سوال: پایتخت ایران کدام شهر است؟
پررنگ کج خط دار خط دار در وسط | سمت چپ وسط سمت راست | قرار دادن شکلک قراردادن لینکقرار دادن لینک حفاظت شده انتخاب رنگ | پنهان کردن متن قراردادن نقل قول تبدیل نوشته ها به زبان روسی قراردادن Spoiler

پروژه دانلود مقاله