#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    I am a beginner, help required.... plz


    Write down C statements to perform the following operations. Take x, y and z from the user:
    z = 4.2(x+y)5/z 0.52x/(y+z) / (x+y)

    Code:
    #include <iostream.h> 
    main() 
    { 
    z = 4.2(x+y)5/z  0.52x/(y+z) / (x+y) 
    }

    How to implement the code for this?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    156
    Rep Power
    34
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0
    #include <iostream.h>
    main()
    {
    int x,y,z;
    cin>>x>>y;
    z = 4.2*x+y*5/z 0.52*x/y+z/x+y
    cout<<z;
    }

    It's showing error on line 7 "statement missing"
  6. #4
  7. No Profile Picture
    I haz teh codez!
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2003
    Posts
    2,549
    Rep Power
    2337
    And how do you end a statement in C++? You're doing it properly everywhere else...
    I ♥ ManiacDan & requinix

    This is a sig, and not necessarily a comment on the OP:
    Please don't be a help vampire!
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    156
    Rep Power
    34
    Also z is not initialized or assigned a value before being used.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0
    Look at this

    #include <iostream.h>
    main()
    {
    int x,y,z;
    cin>>x>>y;
    z=4.2*x+y*5/z-0.52*x/y+z/x+z
    cout<<z;
    return 0;
    }
    Still statement missing, will you help what to do?

    Comments on this post

    • ptr2void disagrees : Pay attention to what people are telling you.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    156
    Rep Power
    34
    pay attention to semicolons
  14. #8
  15. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,158
    Rep Power
    2222
    As they keep telling you, pay attention to semicolons and to how you end statements in C++.

    Also, from your problem statement, pay attention to grouping symbols, which is what parentheses are. Grouping symbols appear in your problem statement, but not in your attempts to code it.

    And finally, read the problem statement! In particular, read this:
    Take x, y and z from the user:
    Why then do you only ask for x and y?

IMN logo majestic logo threadwatch logo seochat tools logo