正在加载图片...
Programming in C++ float weightin Pounds =165.8; char weightUnit M/ user enters letter for desired weightUnit switch( weightUnit case“P casep. cout≤ weightln Pounds≤≤“ pounds“≤<endl break case case‘o3 cout≤<16.0* weightIn Pounds≤“ ounces“≤<endl; break case“K case“k cout < weightIn Pounds/22≤≤“klos“<end; break case‘G case ' g cout≤<454.0* weightin Pounds<“ grams“≤<end break default cout≤<“ That unit is not handled!“≤endl; break 44 float weightInPounds = 165.8 ; char weightUnit ; . . . // user enters letter for desired weightUnit switch ( weightUnit ) { case ‘P’ : case ‘p’ : cout << weightInPounds << “ pounds “ << endl ; break ; case ‘O’ : case ‘o’ : cout << 16.0 * weightInPounds << “ ounces “ << endl ; break ; case ‘K’ : case ‘k’ : cout << weightInPounds / 2.2 << “ kilos “ << endl ; break ; case ‘G’ : case ‘g’ : cout << 454.0 * weightInPounds << “ grams “ << endl ; break ; default : cout << “That unit is not handled! “ << endl ; break ; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有