Results 1 to 8 of 8

Thread: c++.....

  1. #1
    hasib ahmed's Avatar
    hasib ahmed is offline Advance Member
    Last Online
    12th November 2022 @ 11:45 PM
    Join Date
    08 Sep 2008
    Location
    rawalpindi
    Age
    34
    Gender
    Male
    Posts
    850
    Threads
    106
    Credits
    83
    Thanked
    15

    Default c++.....

    write a program that create a simple calculator it reads two float numbers NI,N2 and a character CH(+,-,/,*) thyen perform calculation depending upon the type of character enter by user and display result in format n1 op n2=result
    ma ishq-e-kainaat ma zanjeer ho saku
    mujh ko hisar-e-zaat ke shar se rahai de


  2. #2
    MFaisal khan is offline Senior Member+
    Last Online
    27th February 2015 @ 12:47 PM
    Join Date
    13 Jun 2011
    Location
    Peshawar
    Age
    31
    Gender
    Male
    Posts
    138
    Threads
    32
    Credits
    0
    Thanked
    3

    Default

    hasib kya ap bhi bscs 1st semester mai ho anyway ye boht asan hai apko bs ye krna hoga...
    cout<< "Jo sentence apne likha hai:";
    cin>> (N1+N2);

    bs isis ko copy paster kerte jain or bs plus ki jaga minus multiply or divide ka sign dalte hain.. calculator ban gaya

  3. #3
    Ghalib Awan's Avatar
    Ghalib Awan is offline Advance Member
    Last Online
    14th February 2022 @ 02:55 AM
    Join Date
    01 Feb 2010
    Location
    Hong Kong
    Age
    35
    Gender
    Male
    Posts
    6,672
    Threads
    187
    Credits
    86
    Thanked
    789

    Default

    Bhai jan pehly 2 float variables declare kar lain n1 aur n2, aur aik character variable op declare kar lain aur phir sab ko cin karwa lain
    Phir condition kuch youn lagayein
    Code:
    if(op=='+')
    cout<<n1+n2
    else if(op=='-')
    cout<<n1-n2
    .
    .
    .
    .
    .

    Is tarah tamam arithmetic operation perform kar lain

  4. #4
    hasib ahmed's Avatar
    hasib ahmed is offline Advance Member
    Last Online
    12th November 2022 @ 11:45 PM
    Join Date
    08 Sep 2008
    Location
    rawalpindi
    Age
    34
    Gender
    Male
    Posts
    850
    Threads
    106
    Credits
    83
    Thanked
    15

    Default

    Quote MFaisal khan said: View Post
    hasib kya ap bhi bscs 1st semester mai ho anyway ye boht asan hai apko bs ye krna hoga...
    cout<< "Jo sentence apne likha hai:";
    cin>> (N1+N2);

    bs isis ko copy paster kerte jain or bs plus ki jaga minus multiply or divide ka sign dalte hain.. calculator ban gaya
    han yar abhi start hi hua hai or12 programs ki assignment mil gae yar iss ma operator ki declaration ma problem aa rahi thi iss lea yahan poast kar dia

  5. #5
    hasib ahmed's Avatar
    hasib ahmed is offline Advance Member
    Last Online
    12th November 2022 @ 11:45 PM
    Join Date
    08 Sep 2008
    Location
    rawalpindi
    Age
    34
    Gender
    Male
    Posts
    850
    Threads
    106
    Credits
    83
    Thanked
    15

    Default

    Quote ghalib_awan said: View Post
    Bhai jan pehly 2 float variables declare kar lain n1 aur n2, aur aik character variable op declare kar lain aur phir sab ko cin karwa lain
    Phir condition kuch youn lagayein
    Code:
    if(op=='+')
    cout<<n1+n2
    else if(op=='-')
    cout<<n1-n2
    .
    .
    .
    .

    Is tarah tamam arithmetic operation perform kar lain

    bahi if statment use karni hai just else wagera nae

  6. #6
    MFaisal khan is offline Senior Member+
    Last Online
    27th February 2015 @ 12:47 PM
    Join Date
    13 Jun 2011
    Location
    Peshawar
    Age
    31
    Gender
    Male
    Posts
    138
    Threads
    32
    Credits
    0
    Thanked
    3

    Smile

    Quote hasib ahmed said: View Post
    bahi if statment use karni hai just else wagera nae
    hasib yar else if bhi if ki types ya functions mai ata hai ye bhi parh lo gay ap.. wese konsi book parh rhay ho ap university mai?? koi specific course book btai hai kya apko??

  7. #7
    hasib ahmed's Avatar
    hasib ahmed is offline Advance Member
    Last Online
    12th November 2022 @ 11:45 PM
    Join Date
    08 Sep 2008
    Location
    rawalpindi
    Age
    34
    Gender
    Male
    Posts
    850
    Threads
    106
    Credits
    83
    Thanked
    15

    Default

    Quote MFaisal khan said: View Post


    hasib yar else if bhi if ki types ya functions mai ata hai ye bhi parh lo gay ap.. wese konsi book parh rhay ho ap university mai?? koi specific course book btai hai kya apko??
    programing in c++ by robert lafore 6th ed

  8. #8
    Ghalib Awan's Avatar
    Ghalib Awan is offline Advance Member
    Last Online
    14th February 2022 @ 02:55 AM
    Join Date
    01 Feb 2010
    Location
    Hong Kong
    Age
    35
    Gender
    Male
    Posts
    6,672
    Threads
    187
    Credits
    86
    Thanked
    789

    Default

    Quote hasib ahmed said: View Post
    bahi if statment use karni hai just else wagera nae
    To ap else ka lafz khatam kar dain, program phir bhi theek hee chaly ga

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
  •