Home » C++ Programming » Data Structures » Question
  1. What will be the output of this program?
    #include 
    using namespace std;
    int main()
    {
    struct MansWear
    {
    string Brand;
    double price;
    };
    MansWear MansWear1, MansWear2;
    MansWear1.Brand = "Peter England";
    MansWear1.price = 999.99;
    cout << MansWear1.Brand << " $ "<MansWear2 = MansWear1;
    MansWear2.price = MansWear2.price / 10;
    cout << MansWear1.Brand << " $ "<< MansWear2.price;
    return 0;
    }
    1. Peter England $ 999.99
    2. Peter England $ 99.999
    3. Peter England $ 999.99
      Peter England $ 99.999
    4. Peter England $ 99.999
      Peter England $ 999.99
    5. None of these
Correct Option: C

We copied the value of MansWear1 into MansWear2 and divide the MansWear2 value by 10, So this is the output.
Peter England $ 999.99
Peter England $ 99.999



Your comments will be displayed only after manual approval.