// ***************************************************************** // Author: Zhixiang Chen // Class: CSCI/CMPE 1170, Spring 2009 // Lab 18: Array declarations and simple I/O // Date: January 12, 2009 // Comment: The code here is meant to be revised. // //----------------------------------------------------------------- // // This lab exercise is to show how to deal with simply array delarations // and initializations as well as I/O // // Compile and run your program. When everything is fine, // print your .cpp file and turn it to me or the TA. // ***************************************************************** #include < iostream > #include #include < string > #include < cstring > #include < cmath> #include #include using namespace std; int main( ) { //define a const array size const int SIZE = 10; //array declaration int cat[5]; //declare an array without initialization int dog[5]={11, 22, 33, 44, 55}; //declaration plus full initialization int rat[5]={66, 77}; //declaration with partial initialization int bat[ ]={12, 23, 34, 45, 56}; //declaration with implicit size and full initialization int numbers[SIZE]; int i; //loop var //get input for array cat for (i=0; i<5; i++) { cout<<"Enter an integer => "; cin>>cat[i]; //see how get input for cat[i] } //output arrays for (i=0; i<5; i++) { cout<<"cat["<