Results 1 to 5 of 5

Thread: calculator in c++

  1. #1
    hussain king is offline Senior Member+
    Last Online
    4th April 2019 @ 06:44 AM
    Join Date
    14 Feb 2018
    Gender
    Male
    Posts
    100
    Threads
    42
    Credits
    -1,186
    Thanked
    2

    Thumbs up calculator in c++

    /* prepared by : HILAL AHMAD HUSSAIN (STUDENT: SOFTWERE ENGINEERING)
    */
    #include<iostream>
    #include<conio.h>
    int add(int a,int b);
    int sub(int a,int b);
    int mul(int a,int b);
    int div(int a,int b);
    using namespace std;
    int main()
    {
    int m,n;
    xy:
    cout<<endl;
    cout<<"___________________________________________ __________________________"<<endl;
    cout<<"please enter your first number=";
    cin>>m;
    cout<<endl;
    cout<<"please enter your 2nd number=";
    cin>>n;
    cout<<endl;
    cout<<"1: for addition"<<endl;
    cout<<"2: for substriction"<<endl;
    cout<<"3: for multifaction "<<endl;
    cout<<"4: for division"<<endl;
    cout<<"please enter your option do you want to operation----";
    char op;
    cin>>op;
    switch(op)
    {
    if(op=='1')
    {
    case '1':
    add( m, n);
    break;
    }
    else{
    cout<<"dear your enter invilid option please corrent option enter try again"<<endl;
    }
    if(op=='2')
    {
    case '2':
    sub( m, n);
    break;
    }
    else{
    cout<<"dear your enter invilid option please corrent option enter try again"<<endl;
    }
    if(op=='3')
    {
    case '3':
    mul(m, n);
    break;
    }
    else{
    cout<<"dear your enter invilid option please corrent option enter try again"<<endl;
    }
    if(op=='4')
    {
    case'4':
    div( m, n);

    }else{
    cout<<"dear your enter invilid option please corrent option enter try again"<<endl;

    }
    default:
    cout<<"invilid option----";
    }
    goto xy;
    }
    int add(int a,int b)
    {
    cout<<"--------------------------------"<<endl;
    cout<<"the addition of a and b ="<<a+b<<endl;
    cout<<"--------------------------------"<<endl;
    cout<<endl;

    }
    int mul(int a, int b)
    {
    cout<<"--------------------------------"<<endl;
    cout<<"the multifaction of a and b="<<a*b<<endl;
    cout<<"--------------------------------"<<endl;
    cout<<endl;

    }
    int sub(int a,int b)
    {
    cout<<"--------------------------------"<<endl;
    cout<<"the substraction of a and b="<<a-b<<endl;
    cout<<"--------------------------------"<<endl;
    cout<<endl;
    }
    int div(int a,int b)
    {
    if(b==0)
    {
    cout<<"--------------------------------"<<endl;
    cout<<"a is not divide by zero"<<endl;
    cout<<"--------------------------------"<<endl;
    }
    else
    {
    cout<<"--------------------------------"<<endl;
    cout<<"the division of a and b="<<a/b<<endl;
    }

    cout<<endl;

    }




    dear no error see result again
    Attached Images Attached Images  
    Last edited by hussain king; 30th March 2018 at 08:12 PM.

  2. #2
    Join Date
    09 Apr 2009
    Location
    KARACHI&
    Gender
    Male
    Posts
    19,275
    Threads
    411
    Credits
    39,651
    Thanked
    1813

    Default

    ٹھیک ہے جناب ضرور اس کو بھی ٹرائی کریں گے

    ابھی تک پروگرام پڑھ کر سمجھنا کچھ کچھ آگیا ہے کہ کیا کیا کام ہو رہا ہے اور کس طرح
    جب آغاز کریں گے تو ضرور ٖضرور آپ کا دماغ کھائیں گے
    بہت شکریہ

  3. #3
    Y.Muhammad is offline Junior Member
    Last Online
    14th March 2023 @ 01:08 AM
    Join Date
    10 Mar 2018
    Gender
    Male
    Posts
    4
    Threads
    0
    Credits
    87
    Thanked
    0

    Default

    super hit

  4. #4
    Y.Muhammad is offline Junior Member
    Last Online
    14th March 2023 @ 01:08 AM
    Join Date
    10 Mar 2018
    Gender
    Male
    Posts
    4
    Threads
    0
    Credits
    87
    Thanked
    0

    Default

    4:19: fatal error: conio.h: No such file or directory
    compilation terminated.
    yaha problem dy raha hy Bahi#hussain King

  5. #5
    hussain king is offline Senior Member+
    Last Online
    4th April 2019 @ 06:44 AM
    Join Date
    14 Feb 2018
    Gender
    Male
    Posts
    100
    Threads
    42
    Credits
    -1,186
    Thanked
    2

    Default

    dear friends conio.h ma koye problem nahe ha ap konsa compiler use karte ha dev 5.11 version install karo c drive ma per daklo

Similar Threads

  1. AGE CALCULATOR
    By abid436 in forum Excel Course From Zaara
    Replies: 18
    Last Post: 10th March 2021, 11:34 AM
  2. All in One Calculator
    By ItHero in forum Software Reviews
    Replies: 50
    Last Post: 21st May 2016, 11:13 AM
  3. C++ (OOP) - ITD Calculator 8.5
    By bais in forum C++
    Replies: 11
    Last Post: 25th November 2015, 11:25 PM
  4. WEb Calculator
    By shaaf in forum English IT Zone
    Replies: 6
    Last Post: 15th December 2010, 07:47 AM
  5. My VB Calculator!
    By SufyanGujar in forum English IT Zone
    Replies: 5
    Last Post: 30th November 2009, 08:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •