Page 1 of 2 12 LastLast
Results 1 to 12 of 20

Thread: Calculator Code For C++ With 9 function & Do While Loop

  1. #1
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 01:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    30
    Gender
    Male
    Posts
    639
    Threads
    55
    Credits
    0
    Thanked
    105

    Smile Calculator Code For C++ With 9 function & Do While Loop

    #include <iostream>
    #include <math.h>
    using namespace std;
    int main ()
    {
    char ans='y';
    while (ans=='y' || ans== 'Y')
    {
    float a,b,c,d;
    double pi=3.14159265;
    cout<<" <<@ Calculator By Hashmat naqvi @>>"<<endl;
    cout<<" Press 1 for Addition"<<endl;
    cout<<" Press 2 for Subtrection"<<endl;
    cout<<" Press 3 for Division"<<endl;
    cout<<" Press 4 for Multiplication"<<endl;
    cout<<" Press 5 for Square"<<endl;
    cout<<" Press 6 for Compairing Numbers"<<endl;
    cout<<" Press 7 for Grades Calculator"<<endl;
    cout<<" Press 8 for Cube"<<endl;
    cout<<" Press 9 For Square Root"<<endl;
    cout<<" press 0 For Exit"<<endl;
    cout<<" Enter Your Choice : ";
    cin>>c;
    if (c==1)
    {
    cout<<" ADDITION:"<<endl;
    cout<<" Enter 1st Number:"<<endl;
    cin>>a;
    cout<<" Enter 2nd Number:"<<endl;
    cin>>b;
    cout<<" Result Is:"<<a+b<<endl;
    }
    else if (c==2)
    {
    cout<<" SUBRRECTION:"<<endl;
    cout<<" Enter 1st Number:"<<endl;
    cin>>a;
    cout<<" Enter 2nd Number:"<<endl;
    cin>>b;
    cout<<" Result Is:"<<a-b<<endl;
    }
    else if (c==3)
    {
    cout<<" DIVISION:"<<endl;
    cout<<" Enter 1st Number:"<<endl;
    cin>>a;
    cout<<" Enter 2nd Number:"<<endl;
    cin>>b;
    cout<<" Result Is:"<<a/b<<endl;
    }
    else if (c==4)
    {
    cout<<" MULTIPLICATION:"<<endl;
    cout<<" Enter 1nd Number:"<<endl;
    cin>>a;
    cout<<" Enter 2nd Number:"<<endl;
    cin>>b;
    cout<<" Result Is:"<<a*b<<endl;
    }
    else if (c==5)
    {
    cout<<" SQUARE:"<<endl;
    cout<<" Enter Number:"<<endl;
    cin>>a;
    cout<<" Result is:"<<a*a<<endl;
    }
    else if (c==6)
    {
    cout<<" COMPAIRING NUMBERS"<<endl;
    cout<<" Enter 1st Number:"<<endl;
    cin>>a;
    cout<<" Enter 2nd Number:"<<endl;
    cin>>b;
    cout<<" Enter 3rd Number:"<<endl;
    cin>>d;
    if (a>b&&a>d)
    {
    cout<<" 1st Number Is Greater"<<endl;
    }
    else if (b>a&&b>d)
    {
    cout<<" 2nd Number Is Greater"<<endl;
    }
    else
    {
    cout<<" 3rd Number Is Greater"<<endl;
    }
    }
    else if (c==7)
    {
    cout<<" GRADES CALCULATOR"<<endl;
    cout<<" Enter your Marks Percentage:"<<endl;
    cin>>a;
    if (a<60)
    {
    cout<<" You are Fail : Work Hard & Try Again"<<endl;
    }
    else if (a<68)
    {
    cout<<" You get C : Work Hard"<<endl;
    }
    else if (a<76)
    {
    cout<<" You Get C+ : Good"<<endl;
    }
    else if (a<83)
    {
    cout<<" You Get B : V.Good"<<endl;
    }
    else if (a<89)
    {
    cout<<" You Get B+ : Great"<<endl;
    }
    else if (a<=100)
    {
    cout<<" You Get A : Excellent"<<endl;
    }
    else

    {
    cout<<" INVALID INPUT"<<endl;
    }
    }
    else if (c==8)
    {
    cout<<" CUBE"<<endl;
    cout<<" Enter Number"<<endl;
    cin>>a;
    cout<<" Result="<<a*a*a<<endl;
    }
    else if (c==9)
    {
    cout<<" SQUARE ROOT"<<endl;
    cout<<" Enter Number"<<endl;
    cin>>a;
    cout<<" Result is="<<sqrt (a)<<endl;
    }
    else if (c==0)
    {
    cout<<" Bye Bye"<<endl;
    }

    else
    {
    cout<<" INVALID INPUT"<<endl;
    }
    {
    cout<<" THANKS FOR USING MY CALCULATOR"<<endl;
    cout<<" See You Soon"<<endl;
    }
    cout<<"Do YOu want to Continue or recalculate Yes(Y),No (N)";
    cin>>ans;
    }
    system ("pause");
    return 0;
    }


    Screen shot
    Name:  Calculator.jpg
Views: 1935
Size:  68.1 KB

    if you like this then give me your feed back...
    Shadow xXx

  2. #2
    Umeed Khan is offline Senior Member+
    Last Online
    16th October 2014 @ 12:29 AM
    Join Date
    15 Mar 2012
    Location
    Tangi charsadda
    Age
    31
    Gender
    Male
    Posts
    215
    Threads
    34
    Credits
    930
    Thanked
    11

    Default

    zabardast

  3. #3
    Noman_Khan's Avatar
    Noman_Khan is offline Advance Member+
    Last Online
    29th September 2019 @ 01:05 PM
    Join Date
    06 Aug 2013
    Location
    @Itdunya.com
    Gender
    Male
    Posts
    6,793
    Threads
    142
    Credits
    79
    Thanked
    714

    Default

    Very nice Brother
    یہ وقت بھی گزر جائے گا

  4. #4
    Amar Ali's Avatar
    Amar Ali is offline Senior Member+
    Last Online
    20th June 2021 @ 02:40 AM
    Join Date
    09 Nov 2013
    Location
    Karachi, Sindh
    Age
    30
    Gender
    Male
    Posts
    592
    Threads
    24
    Credits
    56
    Thanked
    20

    Default

    dost ye cpp ka commond he ya turbo c ka ?

  5. #5
    Hashmatnaqvi's Avatar
    Hashmatnaqvi is offline Senior Member+
    Last Online
    18th February 2016 @ 01:27 AM
    Join Date
    16 Jan 2012
    Location
    Islamabad
    Age
    30
    Gender
    Male
    Posts
    639
    Threads
    55
    Credits
    0
    Thanked
    105

    Default

    Quote Amar Ali said: View Post
    dost ye cpp ka commond he ya turbo c ka ?
    cpp ka hai

  6. #6
    ___PATHAN___'s Avatar
    ___PATHAN___ is offline Junior Member
    Last Online
    11th November 2013 @ 11:39 PM
    Join Date
    15 Dec 2010
    Location
    ترے دل میں
    Age
    36
    Gender
    Male
    Posts
    26
    Threads
    1
    Credits
    0
    Thanked: 1

    Default

    nice works bro

  7. #7
    aurangxaib is offline Junior Member
    Last Online
    28th January 2015 @ 10:47 AM
    Join Date
    12 Sep 2013
    Age
    37
    Gender
    Male
    Posts
    6
    Threads
    0
    Credits
    0
    Thanked
    0

    Default

    superb

  8. #8
    ishfaq7615 is offline Junior Member
    Last Online
    29th November 2015 @ 06:18 PM
    Join Date
    06 Mar 2012
    Location
    KHANEWAL
    Age
    34
    Gender
    Male
    Posts
    4
    Threads
    1
    Credits
    945
    Thanked
    0

    Default

    very god dear

  9. #9
    Alibigboss's Avatar
    Alibigboss is offline Senior Member+
    Last Online
    22nd July 2022 @ 06:46 PM
    Join Date
    17 Jan 2014
    Location
    Faisalabad
    Age
    34
    Gender
    Male
    Posts
    406
    Threads
    30
    Credits
    353
    Thanked
    40

    Default

    Very nice yar..

  10. #10
    w_luck is offline Member
    Last Online
    6th January 2016 @ 11:39 PM
    Join Date
    30 Apr 2011
    Age
    32
    Gender
    Male
    Posts
    1,823
    Threads
    347
    Thanked
    51

    Default

    thanks

  11. #11
    Join Date
    25 Feb 2011
    Location
    London, UK
    Gender
    Male
    Posts
    2,224
    Threads
    52
    Credits
    340
    Thanked
    86

    Default

    zabardast

  12. #12
    Join Date
    25 Feb 2011
    Location
    London, UK
    Gender
    Male
    Posts
    2,224
    Threads
    52
    Credits
    340
    Thanked
    86

    Default


Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 45
    Last Post: 29th February 2016, 02:21 PM
  2. Solved visual basic helppp loops
    By patner in forum Solved Problems (IT)
    Replies: 9
    Last Post: 29th January 2012, 05:20 PM
  3. Help about Excel
    By Adeel Anjum in forum Ask an Expert
    Replies: 4
    Last Post: 21st December 2011, 10:09 AM
  4. Solved "Gw basic"
    By mugheez in forum Solved Problems (IT)
    Replies: 4
    Last Post: 1st October 2011, 08:52 PM
  5. funtions help (lecture)
    By knowldge_hunter in forum Ask an Expert
    Replies: 12
    Last Post: 28th December 2010, 10:37 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
  •