C++上机课的习题答案

源代码在线查看: digits.cpp

软件大小: 65 K
上传用户: libhzsmo
关键词:
下载地址: 免注册下载 普通下载 VIP

相关代码

				// digits.cpp
				//从左至右分别提取一个5位数整数各位数上的数字
				//提示:综合使用运算符/和% 
				//思考:如果从右至左该怎么做? 
				#include 
				
				using std::cout;
				using std::cin;
				using std::endl;
				
				int main()
				{
				   int number;
				
				   cout 				   cin >> number;
				
				   /* Write a statement to print the left-most digit of the 
				      5-digit number */   
				   /* Write a statement that changes number from 5-digits 
				      to 4-digits */ 
				   /* Write a statement to print the left-most digit of the 
				      4-digit number */
				   /* Write a statement that changes number from 4-digits
				      to 3-digits */
				   /* Write a statement to print the left-most digit of the
				      3-digit number */
				   /* Write a statement that changes number from 3-digits
				      to 2-digits */
				   /* Write a statement to print the left-most digit of the
				      2-digit number */
				   /* Write a statement that changes number from 2-digits 
				      to 1-digit */
				   cout 				   
				   system("PAUSE");
				   return 0;
				
				} // end main
				
				
							

相关资源