Lab 2

# Lab 2 - CSCI 101 Fundamentals of Computer Programming...

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSCI 101: Fundamentals of Computer Programming Spring 2010 Lab 2: First C++ Program 1) Log into your UNIX account and type in the following program(use emacs or a similar test editor) , and save it as "Lunch.cpp". // Program Lunch calculates the number of calories in a cheese sandwich. Each sandwich contains // 2 slices of bread, 3 slices of cheese, 4 pieces of pickles, and 2 grams of mayonnaise. #include <iostream> using namespace std ; int main() { const int BREAD = 63; //calories in a slice of bread const int CHEESE = 106; //calories in a slice of cheese const int MAYONNAISE = 49; //calories in 1 gram of mayonnaise const int PICKLE = 25; //calories in a slice of pickle int TotalCalories ; TotalCalories = BREAD + CHEESE + MAYONNAISE + PICKLES; cout << "There were " << TotalCalories << cout << " calories in my lunch yesterday." << endl; cout << "What is for lunch today?" << end1; return 0; } 2) Check the program and make sure there are no logical or syntax errors. List any corrections you made.2) Check the program and make sure there are no logical or syntax errors....
View Full Document

## This note was uploaded on 02/04/2011 for the course CSCI 101 taught by Professor Ghyam during the Spring '08 term at USC.

### Page1 / 2

Lab 2 - CSCI 101 Fundamentals of Computer Programming...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online