#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
a=0;
cin>>b;
do
{
if (b==1)
cout<<"case1a " ;
else if (b==2)
cout<<"case 1b ";
a=a+1;
}
while(a=0);
cout<<"Interval";
do
{
if (b==1)
cout<<"case 2a";
else if (b==2)
cout<<"case 2b";
a=a-1;
}
while(a=1);
getch();
}
上面的代码建立无限循环。 预期的输出是“case1a case2a case3a case4a”无限次,但该程序只打印“case1a”无限次Inifinite循环不打印的所有值
那么,如何纠正这一点,让我期望的输出?
PS我用移+破暂停输出到看到最新正在打印的屏幕
正确缩进您的代码,以使其可读。 – Michael
@Chemistpp - 有一个'使用命名空间标准',它只是从最上面的屏幕上脱离下来:) –
@Chemistpp他正在使用一个旧的编译器,它不使用'std ::' –