Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

shivamsinha

  • 2 years ago

hey pplll.plz help me with this one .........1-d

  • This Question is Closed
  1. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    1 Attachment
  2. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    What's the main problem you're having?

  3. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    find the answwer of 1-d

  4. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    void calc(int &a, int b) { cout << a << "\t" << b << endl; a = b++; b = a++; cout << a << "\t" << b << endl; } void main() { int x = 5; calc(x++, ++x); cout << x << endl; } that one?

  5. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    yes...

  6. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    i know this is easy ques...but i suck in c++ coz f ma tchr

  7. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    it's a pretty tricky questions =P so when the program enters calc what would the values and a and b be?

  8. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    no idea,...

  9. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    so to begin with x = 5 when you call calc(x++, ++x) x will be incremented before the function and after x = 6 calc effectively gets called with a = 6 and b = 6 this is before a is a reference of x so the first output would be 6 6

  10. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    make sense?

  11. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    it does.....

  12. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    i suppose u r right

  13. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    awesome do you think you could do the rest now or still a little stuck?

  14. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    and the second part..

  15. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    7 8 ?

  16. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    1 Attachment
  17. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    almost a = b++; // b is 6 so now a and x are 6, remember this is a post increment b = a++; // a is 6 so now b is 6 and a and x are 7 So the output should be 7 6

  18. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    okiezz..thanks...and can u answer 1e and 1f

  19. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    plzz???

  20. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    I can't read all of 1e

  21. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    i've attached anotherfile...c above

  22. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    ok i see now, with 1f you have x = 725 y = 245 a is between 4 and 6 (i'm assuming the random function returns [0, n) ) b is between 2 and 3 do you think you could do this one now?

  23. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    i said naa.....my c++ 'll improve only aftr a month....oz now i 've joined a coaching class....so plz help me today...:(

  24. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    for 1f the answer would be a) and 1e the first for loop is working out the length of the string. c strings are terminated by a '\0' the second loop is looping from 0 to the middle of the word and if statement is looking for capital A's and E's since there are no A's or E's in the first half this wont ever happen and in the else it's swapping characters, eg first with last, second with second last etc so the result would be a word that is reversed if it doesn't have any A's or E's in the first half of the word PreboardExam would become maxEbraoberP

  25. ndani14
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    hopefully that all makes sense good luck with the c++ =)

  26. shivamsinha
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    tnx a lot...:)

  27. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.