Lab3_A_S09.doc

# Lab3_A_S09.doc - CSCI 101: Fundamentals of Computer...

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 Fall 2008 Lab 3: 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 &quot;Lunch.cpp&quot;. // 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 &lt;iostream&gt; using name space 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 &lt;&lt; &quot;There were &quot; &lt;&lt; TotalCalories &lt;&lt; cout &lt;&lt; &quot; calories in my lunch yesterday.&quot; &lt;&lt; endl; cout &lt;&lt; &quot;What is for lunch today?&quot; &lt;&lt; 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

## Lab3_A_S09.doc - CSCI 101: Fundamentals of Computer...

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

View Full Document
Ask a homework question - tutors are online