PROGRAM_1 - CS 31 Introduction to Computer Science I UCLA...

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

View Full Document Right Arrow Icon
CS 31: Introduction to Computer Science I: Winter 2010: Project 1 Program Page 1 // UCLA Winter 2010 // CS 33 Project 1 // John A. Rohr // January 6, 2010 // // // This program prompts for and accepts grocery list items until an empty // item description is entered. Then the program reports the number of // different items and the total count of all items to be purchased. // // // Example Execution // // GROCERY LIST // // Enter an item: Cookies // Enter the quantity:12 // // Enter an item: Candy // Enter the quantity:4 // // Enter an item: Soda Pop // Enter the quantity:6 // // Enter an item: // // Number of different items: 3 // Total number of items to purchase:22 // // End. #include <iostream> #include <string> using namespace std; int main() { int diff; // Total number of different items int all; // Total number of items to be purchased int quantity; // Quantity for current item string description; // Item description // Display a title cout << "GROCERY LIST" << endl; // Display a blank line cout << endl; // Initialize the number of different items diff = 0; // Initialize the total number of items to be purchased all = 0;
Image of page 1

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

View Full Document Right Arrow Icon
CS 31: Introduction to Computer Science I:
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