c++ wrong answer
来源:百度知道 编辑:UC知道 时间:2024/06/09 04:09:51
为什么显示问题已失效啊?
为什么我的提问被删除了啊??
还是以前那道题
寻找s number( The number which is only less than the largest number)
这是我写的程序
#include<iostream.h>
using namespace std;
int main()
{
int a[100],i,j,n,temp;
cin>>n;
if(n!=0)
for(i=0;i<n;i++)
{cin>>a[i];
if(n==0) break;}
for(i=0;i<n;i++)
for(j=0;j<n-1-i;j++)
if(a[j]<a[j+1])
{temp=a[j],a[j]=a[j+1];a[j+1]=temp;}
for(i=0;i<n;i++)
{if(a[i]!=a[i+1]) {cout<<a[i+1]; break;}}
system("pause");
return 0;
}
不知道哪里有问题,大家帮我看看把,谢谢了
由于我被扣掉了20分,所以只剩5分了,只能给5分了!!
为什么我的提问被删除了啊??
还是以前那道题
寻找s number( The number which is only less than the largest number)
这是我写的程序
#include<iostream.h>
using namespace std;
int main()
{
int a[100],i,j,n,temp;
cin>>n;
if(n!=0)
for(i=0;i<n;i++)
{cin>>a[i];
if(n==0) break;}
for(i=0;i<n;i++)
for(j=0;j<n-1-i;j++)
if(a[j]<a[j+1])
{temp=a[j],a[j]=a[j+1];a[j+1]=temp;}
for(i=0;i<n;i++)
{if(a[i]!=a[i+1]) {cout<<a[i+1]; break;}}
system("pause");
return 0;
}
不知道哪里有问题,大家帮我看看把,谢谢了
由于我被扣掉了20分,所以只剩5分了,只能给5分了!!
int main()
{
int a[100],i,j,n,temp;
cin>>n;
if (n<=1)
{
system("pause");
return 0;
}
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
for(j=0;j<n-1-i;j++)
if(a[j]<a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<n;i++)
cout<<a[i];
cout<<endl;
for(i=0;i<n-1;i++)
{
if(a[i]!=a[i+1])
{
cout<<a[i+1]; break;
}
}
system("pause");
return 0;
}
#include<iostream.h>改成#include<iostream>
冒泡排序算法,i只要循环到<n-1就行了.
题目只要求一组测试数据么?
C++: What would go wrong with the following?
wrong fault
wrong with
wrong是什么?
You can find out the informatio only in the ( ) way.A. right B.true C.wrong D.real
MAC 00-e0-4d-a9-2d-7c is in the allowed list, but has wrong IP.
anything can go wrong ,will go wrong
爱慕 right or wrong ?
What's wrong?
what's wrong?