TGTGInsighttelegram intelligenceLIVE / telegram public index
Innhold
Innholdet i innlegget
// problem 17 int n; cout<<"Enter the size: "; cin>>n; vector<int> a(n); vector<int> b(n+1); for (int i = 0; i < n; i++) cin>>a[i]; cout<<endl; int x; cout<<"Value: "; cin>>x; int k; cout<<"Index: "; cin>>k; for (int i = 0; i <= n; i++) { if (i<k) b[i]=a[i]; else if (i==k) b[i]=x; else b[i] = a[i-1]; cout<<b[i]<<" "; }