#include using namespace std; int main() { vector v = {1,1,2,3,3,3,4,5,6,6,7}; int 1 = 0; v[1] = v[r]; } cout<<"Unique elements of the vector: "; //printing elements upto index 1+1 for(int i=0;i<=1;i++){ cout<

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question
main.cpp
1 #include <bits/stdc++.h>
2 using namespace std;
4 int main()
5- {
vector<int> v = {1,1,2,3,3,3,4,5,6,6,7};
int 1 = 0;
8.
v[1] = v[r];
}
cout<<"Unique elements of the vector: ";
//printing elements upto index l+1
for(int i=0;i<=1;i++){
cout<<v[i]<<" ";
}
return e;
9.
%3D
10
11
12
13
14
15
16
17 }
input
Compilation failed due to following error(s).
main.cpp:9:18: error: 'r' was not declared in this scope
9 |
v[1]
v[r];
!!
main.cpp: At global scope:
main.cpp:11:5: error
11 |
|
: "cout' does not name a type
cout<<"Unique elements of the vector: ";
main.cpp:13:5: error: expected unqualified-id before for'
13 |
for(int i=0;i<=1;i++){
main.cpp:13:17: error: 'i' does not name a type
Transcribed Image Text:main.cpp 1 #include <bits/stdc++.h> 2 using namespace std; 4 int main() 5- { vector<int> v = {1,1,2,3,3,3,4,5,6,6,7}; int 1 = 0; 8. v[1] = v[r]; } cout<<"Unique elements of the vector: "; //printing elements upto index l+1 for(int i=0;i<=1;i++){ cout<<v[i]<<" "; } return e; 9. %3D 10 11 12 13 14 15 16 17 } input Compilation failed due to following error(s). main.cpp:9:18: error: 'r' was not declared in this scope 9 | v[1] v[r]; !! main.cpp: At global scope: main.cpp:11:5: error 11 | | : "cout' does not name a type cout<<"Unique elements of the vector: "; main.cpp:13:5: error: expected unqualified-id before for' 13 | for(int i=0;i<=1;i++){ main.cpp:13:17: error: 'i' does not name a type
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning