美文网首页
第一章习题解答

第一章习题解答

作者: AshinYan | 来源:发表于2018-03-07 21:25 被阅读4次

练习1.4 使用乘法运算符"*"打印两个数的积。

#include "stdafx.h"

#include <iostream>

 /*

 * 主函数: 

 * 读取两个数,并求出它们的积。 

 */ 

 int main() 

                std::cout << "Enter two numbers:" << std::endl; 

                int v1 = 0, v2 = 0; 

                std::cin >> v1 >> v2; 

                std::cout << " The sum of " 

                                 << v1 << " and " 

                                 << v2 << " is " 

                                  << v1 * v2 << std::endl; 

                system("pause"); 

                return 0;

 }

相关文章

网友评论

      本文标题:第一章习题解答

      本文链接:https://www.haomeiwen.com/subject/qrbsfftx.html