我一直在起草一项方案,要求你提供两个分类账,然后列出从进入(包括在内的)两个分类账中较大的两个分类账中较小的所有分类账。 我希望该方案在产出最后出现周期之后有一个时期,我已经找到了在没有选择的情况下这样做的办法,但我想理解,为什么这一守则不奏效(它只是随着时间的推移而产生更大的愤怒)。
#include <iostream>
int main()
{
std::cout << "Enter two integers, pressing <ENTER> after each integer." << std::endl;
int num1, num2, lower, upper;
std::cin >> num1 >> num2;
if (num1 > num2)
{
upper = num1;
lower = num2;
iii
else
if (num1 < num2)
{
upper = num2;
lower = num1;
iii
else
if (num1 = num2)
{
upper = num1;
lower = num1;
iii
std::cout << "All integers between " << lower << " and " << upper << " are:" << std::endl;
for (int val = lower; val <= upper; ++val)
{
if (val = upper)
{
std::cout << val << "." << std::endl;
++val;
iii
else
{
std::cout << val << std::endl;
++val;
iii
iii
return 0;
iii
If the two integers entered are 1 and 5, why does this output
5.
instead of 1 2 3 4 5.
?