?? 1380.cpp
字號:
#include <iostream>
#include <iomanip>
using namespace std;
struct t
{
long int data;
struct t *next;
}*q,*p,*head;
int main()
{
int n;
head=NULL;
p=new t;
q=p;
cout<<"Please input the n and n numbers:"<<endl;
while(1)
{
p=new t;
if(!p)
{
cout<<"\nApplition Memory falied!\n";
exit(-1);
}
cin>>n;
if(n==0) break;
while(n<1||n>10000)
{
cout<<"Input error!\n";
cin>>n;
}
long int *a=new long int [n];
for(int i=0;i<n;i++)
{ cin>>a[i];
if(a[i]>1000000000||a[i]<-1000000000)
{
cout<<"Input error!Again:"<<endl;
cin>>a[i];
}
}
long int b=a[0];
for(int j=1;j<n;j++)
{
if(a[j]>b)
b=a[j];
}
p->data=b;
if(!head)
head=p;
else
q->next=p;
q=p;
}
q->next=NULL;
t *s=head;
while(s!=NULL)
{
cout<<s->data<<endl;
s=s->next;
}
int r;
cin>>r;
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -