// 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]<<" ";
}
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]<<" ";
}
Qaysi masalani ishlab berishimizni xohlaysiz?
Kommentda yozib qoldiring👇
Kommentda yozib qoldiring👇
Forwarded from Computer Programming (Asadbek Toʻlqinjonov)
Qaysi masalani ishlab berishimizni xohlaysiz?
Kommentda yozib qoldiring👇
Kommentda yozib qoldiring👇
C++ tilidan darslar va quizlar uchun linklar👇🏻:
1. C++ tilidan darslar va quizlar uchun linklar👇🏻:
1. W3Schools C++ Quiz
2. CodeVisionZ
3. CodeChef C++ Skill Test
@cpp_sirius🧑🏻💻
1. C++ tilidan darslar va quizlar uchun linklar👇🏻:
1. W3Schools C++ Quiz
2. CodeVisionZ
3. CodeChef C++ Skill Test
@cpp_sirius🧑🏻💻
W3Schools
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
❤2
‼️Lesson day‼️
Today we are going to conduct an extra lesson!
@cpp_sirius👨💻
Today we are going to conduct an extra lesson!
💻 Computer Programming
🗓️ Tuesday, 2nd December
🕓 Time: 21:00
🧩 *Pointers
@cpp_sirius👨💻
🔥6🎉1
Pointers:
Lvalue, Rvalue
* & operators
Pointers to Array
Matrix Pointers
Lvalue, Rvalue
* & operators
Pointers to Array
Matrix Pointers