asgn2 - CSCI 1120 Introduction to Computing using C(1st...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI 1120 Introduction to Computing using C++ (1 st Term 2011-12) Assignment #2 Due: 10 th Oct 2011 (Monday) Full Score: 100 Introduction Your goal is to write a program to ask a user to guess a number between 1 and 1000 in at most 12 attempts. For each guess made by the user your program will provide some hint. Specification Input 1. The first input to your program is the number to be guessed. 2. The subsequent input values are the user’s guesses. We assume the user is going to enter one integer at a time. Output 1. For output format, please refer to the sample program and the sample output. Game Rules Let X be the number to be guessed Let Y i be the i th guess made by the user , i = 1, 2, 3, …, 12. 1. If X > Y i , your program should output “Larger”. 2. If X < Y i , your program should output “Smaller” 3. If X - Y i > 300, your program s hould output “Much larger”. 4. If X - Y i < - 300, your program should output “Much smaller”. 5. If |X - Y i | > 500, your program should output “Today is not your day”.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern