// ***************************************************************** // Author: Zhixiang Chen // Class: CSCI/CMPE 1170, Spring 2009 // Lab 3: Math expressions, , type conversion, named const // combined assignments // Date: Januray 12, 2009 // Comment: The code here is meant to be revised. // //----------------------------------------------------------------- // // Practice math expressions, functions in , type conversion, // named consts, combined assignments // // Compile and run your program. When everything is fine, // print your .cpp file and turn it to me or the TA // ***************************************************************** #include < iostream > #include < string > #include < cmath> using namespace std; void showMenu(); int main( ) { //named const declaration const double PI=3.1415926; //variable declarations int u=3, v=7; //vars to store two int values double x = 100.89, y=2.70, //vars to store double values z=0; int intResult; //var to store the integer result double doubleResult; //var to store double result double radius, area; //vars to store area and radius int choice; //var to store an int value for choice char option; //var to store y/n option for ( ; ; ) { showMenu(); //show menu cin>>choice; //get the user's choice if (choice == 1) //see int to double { intResult= u/v; cout<<"Without conversion, "<< u <<" / " << v <<" is " << intResult < (u) / static_cast(v); cout<<"With conversion, " << u <<" / " << v <<" is " << doubleResult < (x) / static_cast(y); cout<<"With conversion, " << x <<" / " << y <<" is " << intResult< " << static_cast('A')< " << static_cast(65)<>option; if (option !='y') { cout<<"Bye bye!"< "; return; }