主题:[讨论]求教 为何我的算法不能连续循环
#include <stdio.h>
int main()
{
int count=0;
int number;
while(count!=10)
{
int largest1=0,largest2=0;
count++;
printf("%d请输入数字:\n",count);
scanf("%d",&number);
if(largest1<number||largest2<number)
{
largest2=largest1;
largest1=number;
printf("%d %d\n",largest1,largest2) ;
}
else if(largest1>number||largest2<number)
{
largest2=number;
printf("%d %d\n",largest1,largest2);
}
else(largest1>number||largest2>number) {
printf("%d %d",largest1,largest2);
}
while(count!=10)
{
printf("%d请输入数字:\n",count+1);
scanf("%d",&number);
count++;
break;
}
}
}
这个从10个数中算出俩个最大的数 largest1 》largest2
int main()
{
int count=0;
int number;
while(count!=10)
{
int largest1=0,largest2=0;
count++;
printf("%d请输入数字:\n",count);
scanf("%d",&number);
if(largest1<number||largest2<number)
{
largest2=largest1;
largest1=number;
printf("%d %d\n",largest1,largest2) ;
}
else if(largest1>number||largest2<number)
{
largest2=number;
printf("%d %d\n",largest1,largest2);
}
else(largest1>number||largest2>number) {
printf("%d %d",largest1,largest2);
}
while(count!=10)
{
printf("%d请输入数字:\n",count+1);
scanf("%d",&number);
count++;
break;
}
}
}
这个从10个数中算出俩个最大的数 largest1 》largest2