fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int a[10],b[11],x,t;
  6. cout<<"原始数组为:"<<endl;
  7. for(int i=0;i<10;i++)
  8. {
  9. cin>>a[i];
  10. cout<<a[i]<<" ";
  11. }
  12. cout<<endl;
  13. cin>>x;
  14. cout<<"插入值:"<<x<<endl;
  15. for(int i=0;i<11;i++)
  16. {
  17. b[0]=x;
  18. b[i]=a[i+1];
  19. }
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5304KB
stdin
1 3 5 7 9 11 13 15 17 19 12
stdout
原始数组为:
1 3 5 7 9 11 13 15 17 19 
插入值:12