Ժողովուրդ շտապ պետք է կարկուլյատոր գրված C++- ով.
Ժողովուրդ շտապ պետք է կարկուլյատոր գրված C++- ով.
կալկուլատոր Visual-ի տակ թե Consoli ?
Էս ծրագիրը մի 3-4 տարվա պատմություն ունի, գրել եմ առաջին կամ երկրորդ կուրսում, չեմ հիշում ինչ, ոնց, նոր էինք սովորում... կոդի մեջ թերություններ կլինեն, ոնց էլ չլինի, բայց նորմալ աշխատում ա էլի![]()
Կուրսայինս հենց կալկուլատորա, արդեն հանձնում եմ 2շաբթի, բայց գաղափար չունեմ![]()
Համատարած խավարի մասին խոսելու փոխարեն փոքրիկ մոմ վառեք!!!
մդաա, մի կալկուլյատոր (հաշվիչ) եմ գրել, շատ-շատ պարզ, բայց կուզենայի, որ այն աշխատեր նաև սահող կետով թվերի(իրական թվերի) հետ: Այլ ի՞նչ ձև կա կենդանացնելու կետով կոճակը...
Մի մաս կոդից.
Կոդ:void CCalcDlg::OnEqu() { switch(m_operation) {case ADD:m_number+=m_result; break; case SUB:m_number=m_result-m_number; break; case MUL:m_number=m_result*m_number; break; case DIV:if(m_result%m_number==0) { m_number=m_result/m_number; UpdateData(FALSE);} else {CString str; str.Format("%10.3f", (double)m_result/m_number); SetDlgItemText(IDC_EDIT1, str); } break; } if(m_operation!=DIV)UpdateData(FALSE); m_number=0; OnNumber(); } void CCalcDlg::OnDot() { ///???????????? այստեղ չգիտեմ.... }
Вот и все... я уже НЕ в армии
Կոմպիլյացիա արա:
Ի միջայլոց նոր կոմպիլյատորներում(իմ դեպքում visaul studio 2008) վերբեռնած pow ֆունկցիայի նորմալ աշխատանքի համար բոլոր m_tiv=(int)(m_tiv*pow(10, ex)/10); տողերում պետք է 10 թիվը գրել 10,0 տեսքովլ:
Այսինքն m_tiv=(int)(m_tiv*pow(10.0, ex)/10);
Իմ մոտ միայն դրանից հետո սկսեց աշխատել:
էսպես չի մնա
Ահա իմ գրած հաշվիչը
Ես նոր եմ սովորում :Կոդ:#include<iostream.h> #include<math.h> // ast = ( 180 / pi ) * rad const double degress = 0.0174532925199432958 ; // 3.141926535897932384626433832795 / 180 double gumarum (double a , double b) { cout << "aha gumar@\t\t" << a + b << endl << endl ; return 0 ; } double hanum (double a , double b) { cout << "aha tarberutyun@\t" << a - b << endl << endl ; return 0 ; } double bazmapatkum (double a , double b) { cout << "aha artadryal@\t\t" << a * b << endl << endl ; return 0 ; } double bazhanum (double a , double b) { cout << "aha qanord@\t\t" << a / b << endl << endl ; return 0 ; } double sinus (double a) { cout << "aha sinus@\t\t" << sin(a * degress) << endl << endl ; return 0; } double cosinus (double a) { cout << "aha sinus@\t\t" << cos(a * degress) << endl << endl ; return 0; } double tangens (double a) { cout << "aha tangens@\t\t" << tan(a * degress) << endl << endl ; return 0; } double logaritm (double a , double b) { cout << "aha logaritm@\t\t" << log(b) / log(a) << endl << endl ; return 0 ; } double astichan (double a , double b) { cout << "aha ardyunq@\t\t" << pow(a,b) << endl << endl ; return 0 ; } double armat (double a , double b) { cout << "aha ardyunq@\t\t" << pow(a,1/b) << endl << endl ; return 0 ; } int bun () { double a; double b; short int action ; cout << "Mutqagrir hetevyal tiv@ hetevyal gortzoxutyan hamar" << endl ; cout << "1\tgumarum" << " ||\t" <<"5\tsin" << " ||\t"<<" 9\tarmat"<<endl ; cout << "2\thanum" << " ||\t" <<"6\tcos" << " ||\t"<<" 10\tastichan" << endl ; cout << "3\tbazmapatkum" << " ||\t" <<"7\ttan" << endl ; cout << "4\tbazhanum" << " ||\t" <<"8\tlog" <<endl ; cin >> action ; if ( action == 1 ) { cout << "Mutqagrir erku tiv" << endl; cout << "\t\t\t"; cin >> a ; cout << "\t\t\t"; cin >> b ; gumarum(a,b); } if (action == 2 ) { cout << "Mutqagrir erku tiv" << endl; cout << "\t\t\t"; cin >> a ; cout << "\t\t\t"; cin >> b ; hanum(a,b); } if (action == 3 ) { cout << "Mutqagrir erku tiv" << endl; cout << "\t\t\t"; cin >> a ; cout << "\t\t\t"; cin >> b ; bazmapatkum(a,b); } if (action == 4 ) { cout << "Mutqagrir erku tiv" << endl; cout << "\t\t\t"; cin >> a ; cout << "\t\t\t"; cin >> b ; bazhanum(a,b); } if (action == 5) { cout << "Mutqagrir mek tiv" << endl; cout << "\t\t\t"; cin >> a ; sinus(a); } if (action == 6) { cout << "Mutqagrir mek tiv" << endl; cout << "\t\t\t"; cin >> a ; cosinus(a); } if (action == 7 ) { cout << "Mutqagrir mek tiv" << endl; cout << "\t\t\t"; cin >> a ; tangens(a); } if (action == 8 ) { cout << "Mutqagrir himq@ ev tiv@" << endl; cout << "\t\t\t"; cin >> a ; cout << "\t\t\t"; cin >> b ; logaritm(a,b); } if (action == 9 ) { cout << "Mutqagrir tiv@ ev astichan@" << endl; cout << "\t\t\t"; cin >> a ; cout << "\t\t\t"; cin >> b ; armat(a,b); } if (action == 10 ) { cout << "Mutqagrir tiv@ ev astichan@" << endl; cout << "\t\t\t"; cin >> a ; cout << "\t\t\t"; cin >> b ; astichan(a,b); } if ( action > 10 || action < 1 ) { cout << "*>*>*>*>*>*>*>*>*>*>*>*>>>>>>>_____Sxal_____<<<<<<<*<*<*<*<*<*<*<*<*<*<*<*" << endl ; } return bun(); } int main() { cout << "Barev , du bacel es Hrant-i tzragravoratz Hasvic@" << endl ; bun () ; return 0; }
Enipra դու որտեղ ես սովորել ?
Վերջին խմբագրող՝ Cyber: 26.09.2009, 16:54: Պատճառ: ուղղագրական սխալ
Այս պահին թեմայում են 1 հոգի. (0 անդամ և 1 հյուր)
Էջանիշներ