/* CS401: Introduction to Computer Science Week 1 - Code from class Instructor: Lane */ /* Program 1: Our first program This program just prints a greeting. */ #include #include using namespace std; // main() is where the program starts executing int main() { cout << "What are you doing?" << endl; return 0; } /* Program 2: Using a variable This program demonstrates the declaration and use of a simple integer variable. */ #include #include using namespace std; int main() { int value; // this declares a variable value = 401; // assigns the number 401 to value cout << "We are taking Computer Science "; cout << value << endl; // displays the number 401 return 0; } /* Program 3: Converting gallons to liters This program asks the user for a number of gallons, then prints the amount in liters (i.e., it converts gallons to liters). */ #include #include using namespace std; int main() { int gallons, liters; // two variables that hold important values cout << "Enter number of gallons: "; cin >> gallons; liters = gallons * 4; // the conversion is done here cout << "Liters: " << liters << endl; return 0; }